Can CMake find_package be “common dependency version aware”?
You may use config mode of the
find_package for allow you modules to expose some internal properties to their user (root project).
If each your module provides library target, you may expose that target with property containing Boost version attached and list this property in a special COMPATIBLE_INTERFACE_STRING property.
Your root project will include modules via
find_package() calls and will read these properties. When it will try to link libraries, provided by such modules, version compatibility will be automatically performed by CMake:
modA/CMakeLists.txt:
modA/modA-config.cmake.in:
(modB is implemented in similar manner)
root/CMakeLists.txt:
Additionally, an executable created in the root project may request specific Boost version via setting appropriate property:
In this case it will be prohibited (by CMake) for its dependencies to use Boost library with other versions.
More info and usage examples see in CMake build system description.
|




0 commentaires: