Skip to content

Commit

Permalink
Added an OpenRAND::OpenRAND alias for making find_package OpenRAND + …
Browse files Browse the repository at this point in the history
…target_link_libraries easier.
  • Loading branch information
palmerb4 committed Feb 17, 2024
1 parent e015f15 commit 95e6901
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Define the main library as an interface
add_library(${PROJECT_NAME} INTERFACE)

# Create an alias target for users to include OpenRAND with a namespace
# This isn't explicitly necessary as OpenRAND is header-only but it takes including OpenRAND
# via find_package + target_link_libraries straightforward.
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})

# Specify the C++ flags using target_compile_options and generator expressions for better control and compatibility
target_compile_options(${PROJECT_NAME} INTERFACE
$<$<CXX_COMPILER_ID:GNU>:
Expand Down Expand Up @@ -97,6 +102,7 @@ configure_package_config_file(

install(EXPORT ${PROJECT_NAME}Targets
FILE ${PROJECT_NAME}Targets.cmake
NAMESPACE ${PROJECT_NAME}::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)

Expand Down

0 comments on commit 95e6901

Please sign in to comment.