Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add namespace fcl to exported CMake targets #518

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion fcl-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set(FCL_VERSION "@FCL_VERSION@")
set(FCL_ABI_VERSION "@FCL_ABI_VERSION@")

set_and_check(FCL_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
set(FCL_LIBRARIES @PROJECT_NAME@)
set(FCL_LIBRARIES @PROJECT_NAME@::@PROJECT_NAME@)
set_and_check(FCL_LIBRARY_DIRS "@PACKAGE_CMAKE_INSTALL_LIBDIR@")

include(CMakeFindDependencyMacro)
Expand All @@ -17,4 +17,10 @@ include(CMakeFindDependencyMacro)

include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")

add_library(@PROJECT_NAME@ INTERFACE IMPORTED)
set_target_properties(@PROJECT_NAME@ PROPERTIES INTERFACE_LINK_LIBRARIES "@PROJECT_NAME@::@PROJECT_NAME@")
if(NOT CMAKE_VERSION VERSION_LESS 3.17)
set_property(TARGET @PROJECT_NAME@ PROPERTY DEPRECATION "Deprecated target. Please use @PROJECT_NAME@::@PROJECT_NAME@ instead.")
endif()

check_required_components(@PROJECT_NAME@)
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ else()
add_library(${PROJECT_NAME} SHARED ${FCL_HEADERS} ${FCL_SOURCE_CODE})
endif()

add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})

# Be sure to pass to the consumer the set of SIMD used in the compilation
target_compile_options(${PROJECT_NAME} PUBLIC ${SSE_FLAGS})

Expand Down Expand Up @@ -115,6 +117,7 @@ target_include_directories(${PROJECT_NAME} INTERFACE
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

export(TARGETS ${PROJECT_NAME}
NAMESPACE ${PROJECT_NAME}::
FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-targets.cmake"
)

Expand All @@ -136,6 +139,7 @@ install(TARGETS ${PROJECT_NAME}
)

install(EXPORT ${PROJECT_NAME}-targets
NAMESPACE ${PROJECT_NAME}::
DESTINATION ${FCL_INSTALL_CONFIGDIR}
COMPONENT Development
)
Expand Down