Support Modern CMake practices
RFRIEDM-Trimble opened this issue · comments
RFRIEDM-Trimble commented
As a user of this library in gscam2, I'd like to consume the libraries in image_common with a modern cmake interface, but it's not supplied here.
Here's my proposal:
- Replace calls to
include_directories
withtarget_include_directories
- - Add ALIAS libraries for better determinism
- - Replace calls to
ament_target_dependencies
withtarget_link_libraries
- - Specify linkage type as PUBLIC, PRIVATE or INTERFACE when calling target_link_libraries
- - Bump Minimum cmake for galactic to 3.12.2 and use some of the new features in it for installation
- - Add an EXPORT set to the install commands
- - Support a CONFIG mode export to support find_package allowing consumers to link to targets like
camera_calibration_parsers::camera_calibration_parsers
- - Remove
ament_export_include_directories
andament_export_libraries
calls as they are superfluous - - Could use ament_auto_package to handle the install of the targets
References:
- Professional CMake by Craig Scott, 12th Ed
- ament_cmake
- Modern CMake
Clyde McQueen commented
- Bump Minimum cmake for galactic to 3.16.3 and use some of the new features in it for installation
Hi, @RFRIEDM-Trimble -- the CMake versions are defined in REP2000, and would have to be updated there. Looks like the highest version supported by all recommended Galactic platforms is 3.12.2. For Humble it's 3.14.4. https://www.ros.org/reps/rep-2000.html
RFRIEDM-Trimble commented
3.12.2
Got it. I'll bump to 3.12.2 and implement the proposal.