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

Clean up install config files and ensure find_dependency is called as appropriate #452

Merged
merged 2 commits into from
Feb 26, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
convex distance:
[#446](https://github.com/flexible-collision-library/fcl/pull/446)

### FCL 0.6.1 (????-??-??)

* Build/Test/Misc

* Clean up install config files and ensure find_dependency is called as
appropriate:
[#452](https://github.com/flexible-collision-library/fcl/pull/452)

### FCL 0.6.0 (2020-02-10)

* Core/Common
Expand Down
47 changes: 46 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ endif (MSVC OR MSVC90 OR MSVC10)

set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
include(CMakePackageConfigHelpers)
include(GenerateExportHeader)
include(GNUInstallDirs)
include(CompilerSettings)
Expand Down Expand Up @@ -264,6 +265,47 @@ else()
message(STATUS "FCL does not use OctoMap (as requested)")
endif()

if(TARGET ccd)
set(FIND_DEPENDENCY_CCD "find_dependency(ccd)")
else()
set(FIND_DEPENDENCY_CCD)
endif()

if(TARGET Eigen3::Eigen)
set(FIND_DEPENDENCY_EIGEN3 "find_dependency(Eigen3)")
else()
set(FIND_DEPENDENCY_EIGEN3)
endif()

if(TARGET octomap)
set(FIND_DEPENDENCY_OCTOMAP "find_dependency(octomap)")
else()
set(FIND_DEPENDENCY_OCTOMAP)
endif()

if(WIN32 AND NOT CYGWIN)
set(FCL_INSTALL_CONFIGDIR CMake)
else()
set(FCL_INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
endif()

configure_package_config_file(fcl-config.cmake.in fcl-config.cmake
INSTALL_DESTINATION ${FCL_INSTALL_CONFIGDIR}
PATH_VARS CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR
)

write_basic_package_version_file(fcl-config-version.cmake
VERSION ${FCL_VERSION}
COMPATIBILITY AnyNewerVersion
)

install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/fcl-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/fcl-config-version.cmake"
DESTINATION ${FCL_INSTALL_CONFIGDIR}
COMPONENT Development
)

# FCL's own include dir should be at the front of the include path
include_directories(BEFORE "include")
include_directories(BEFORE "${CMAKE_CURRENT_BINARY_DIR}/include")
Expand All @@ -283,7 +325,10 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/fcl.pc"
)

# Install catkin package.xml
install(FILES package.xml DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME})
install(FILES package.xml
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}
COMPONENT Development
)

# Add uninstall target
configure_file(
Expand Down
20 changes: 20 additions & 0 deletions fcl-config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by CMake @CMAKE_VERSION@ for @PROJECT_NAME@.

@PACKAGE_INIT@

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_and_check(FCL_LIBRARY_DIRS "@PACKAGE_CMAKE_INSTALL_LIBDIR@")
jamiesnape marked this conversation as resolved.
Show resolved Hide resolved

include(CMakeFindDependencyMacro)

@FIND_DEPENDENCY_CCD@
@FIND_DEPENDENCY_EIGEN3@
@FIND_DEPENDENCY_OCTOMAP@

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

check_required_components(@PROJECT_NAME@)
30 changes: 20 additions & 10 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,23 +112,33 @@ endif()
target_include_directories(${PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>)
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

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

if(CMAKE_VERSION VERSION_LESS 3.12)
set(NAMELINK_COMPONENT_OPTION)
else()
set(NAMELINK_COMPONENT_OPTION NAMELINK_COMPONENT Development)
endif()

install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}Config
EXPORT ${PROJECT_NAME}-targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT Development
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
COMPONENT Runtime ${NAMELINK_COMPONENT_OPTION}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT Runtime
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

if(WIN32 AND NOT CYGWIN)
install(EXPORT ${PROJECT_NAME}Config DESTINATION CMake)
else()
install(EXPORT ${PROJECT_NAME}Config
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
endif()
install(EXPORT ${PROJECT_NAME}-targets
DESTINATION ${FCL_INSTALL_CONFIGDIR}
COMPONENT Development
)

# Setup the coveralls target and tell it to gather coverage data for all the lib sources.
if(FCL_COVERALLS)
Expand Down