-
Notifications
You must be signed in to change notification settings - Fork 15
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 find_package component support #82
Conversation
Levi-Armstrong
commented
Aug 20, 2023
•
edited
Loading
edited
- Update documentation
- Possible update package tooling to support components also
0bde17b
to
6f8e5e0
Compare
6f8e5e0
to
4868bad
Compare
Looks fine to me for the most part, but I don't really understand how to make CMake components. Does this affect CPack and debian generation? |
I would take a look at the tesseract PR where I leverage the new features for generating components Instead of having a single tesseract_kinematics-config.cmake file with everything switching things off and on with build options leveraging the components feature you get a separate component config where the tesseract_kinematics-config.cmake looks like this. # Default *-config.cmake file created by ros-industrial-cmake-boilerplate
####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
####### Any changes to this file will be overwritten by the next CMake run ####
####### The input file was tesseract_kinematics-config.cmake.in ########
get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
macro(set_and_check _var _file)
set(${_var} "${_file}")
if(NOT EXISTS "${_file}")
message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
endif()
endmacro()
####################################################################################
set(tesseract_kinematics_FOUND ON)
# Components
set(supported_components core ikfast kdl opw ur)
if (NOT tesseract_kinematics_FIND_COMPONENTS)
foreach(component ${supported_components})
include(${CMAKE_CURRENT_LIST_DIR}/${component}-config.cmake)
endforeach()
else()
foreach(component ${tesseract_kinematics_FIND_COMPONENTS})
if(NOT component IN_LIST supported_components)
set(tesseract_kinematics_${component}_FOUND OFF)
set(tesseract_kinematics_${component}_NOT_FOUND_MESSAGE "Unsupported component")
if (tesseract_kinematics_FIND_REQUIRED_${component})
message(FATAL_ERROR "Failed to find required component ${component} for package tesseract_kinematics")
endif()
else()
include(${CMAKE_CURRENT_LIST_DIR}/${component}-config.cmake)
endif()
endforeach()
endif()
# Extra configuration files
include("${CMAKE_CURRENT_LIST_DIR}/tesseract_kinematics-extras.cmake") |
This should not affect the cpack debain generation, but I think we should be able to create a separate debian for each component to avoid having one which installs all components. |