-
Notifications
You must be signed in to change notification settings - Fork 421
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
Provide CMake exported targets #116
Provide CMake exported targets #116
Conversation
Modify build/install rules to provide a CMake package configuration file with modern exported targets. This makes it much easier for users to use FCL.
Thanks, Matthew! My preference would be to require CMake >= 2.8.12 and simplify the logic. Does anyone object to that? |
If I'm reading this correctly the default CMake for Ubuntu 14.04 is 2.8.12. |
Linux CI builds failed. |
When present, octomap needs to be a public link dependency. Change the target_link_libraries accordingly.
Bump minimum required CMake version. Simplify logic to generate exported targets accordingly.
Done, as a separate commit so I can easily back it out again if there are objections. Hopefully the CI is also fixed (I don't have octomap in my build which is why it was working on my machine). |
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||
|
||
install(EXPORT ${PROJECT_NAME}Config | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this installation location, fclConfig.cmake
will not be found automatically on Windows even if the system CMAKE_PREFIX_PATH
enviromental variable matches the CMAKE_INSTALL_PREFIX
of fcl
. [1]
Modifying the code as in [2] :
if(WIN32 AND NOT CYGWIN)
set(_EXPORT_INSTALL_DESTINATION CMake)
else()
set(_EXPORT_INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
endif()
install(EXPORT ${PROJECT_NAME}Config
DESTINATION ${_EXPORT_INSTALL_DESTINATION})
will ensure that the library will be easily found also in Windows.
[1] : https://cmake.org/cmake/help/v3.0/command/find_package.html
[2] : https://github.com/robotology/ycm/blob/master/modules/InstallBasicPackageFiles.cmake#L176
Change the install destination for the CMake package configuration file to use, on Windows, a location that is searched by default on Windows. (The prior logic only worked for UNIX platforms.) With thanks to Silvio Traversaro for the suggestion.
54c5108
to
2d131ed
Compare
Ping? CI passes now. Is this just waiting on a suitable period for objections to elapse, or is there something else I should change? |
Sorry, GitHub doesn't notify when new commits are pushed so I don't think anyone noticed this is ready. A ping definitely helps! Thanks, Matthew! |
Thanks, @sherm1! |
Modify build/install rules to provide a CMake package configuration file with modern exported targets. This makes it much easier for users to use FCL:
I wrote this in a way that the new logic only takes effect when compiled with a more recent version of CMake, because I wasn't sure of the impact of bumping the minimum required CMake version. If it's okay with the project to require 2.8.12, please let me know and I can simplify the logic accordingly.