Bug #2155
find_package(RSB) changes boost cmake configuration in downstream projects
Status: | Rejected | Start date: | 01/13/2015 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | - | % Done: | 0% | |
Category: | Build System | |||
Target version: | - |
Description
In my rsb downstream project I have the following cmake configuration for including some boost components and rsb in my library:
CMakeLists.txt:
... set(Boost_USE_MULTITHREADED ON) find_package(Boost COMPONENTS program_options system serialization REQUIRED) message(STATUS "****BOOST: Boost_LIBRARY_DIRS=${Boost_LIBRARY_DIRS} , Boost_LIBRARIES=${Boost_LIBRARIES}") link_directories(${Boost_LIBRARY_DIRS}) find_package(RSB 0.9 REQUIRED) message(STATUS "RSB version: ${RSB_VERSION}") include_directories(BEFORE SYSTEM ${RSB_INCLUDE_DIRS}) add_definitions(${RSB_DEFINITIONS}) message(STATUS "****BOOST: Boost_LIBRARY_DIRS=${Boost_LIBRARY_DIRS} , Boost_LIBRARIES=${Boost_LIBRARIES}") ...
As the cmake output indicates:
... Boost version: 1.54.0 -- Found the following Boost libraries: -- program_options -- system -- serialization -- ****BOOST: Boost_LIBRARY_DIRS=/usr/lib/x86_64-linux-gnu , Boost_LIBRARIES=/usr/lib/x86_64-linux-gnu/libboost_program_options.so;/usr/lib/x86_64-linux-gnu/libboost_system.so;/usr/lib/x86_64-linux-gnu/libboost_serialization.so -- Boost version: 1.54.0 -- Found the following Boost libraries: -- regex -- date_time -- program_options -- system -- signals -- RSB version: 0.12.0 -- ****BOOST: Boost_LIBRARY_DIRS=/usr/lib/x86_64-linux-gnu , Boost_LIBRARIES=/usr/lib/x86_64-linux-gnu/libboost_regex.so;/usr/lib/x86_64-linux-gnu/libboost_date_time.so;/usr/lib/x86_64-linux-gnu/libboost_program_options.so;/usr/lib/x86_64-linux-gnu/libboost_system.so;/usr/lib/x86_64-linux-gnu/libboost_signals.so ...
the
find_package(RSB)
command changes the Boost_LIBRARIES to forget my desired boost components (such as e.g. boost::serialization).
So, to wrap it up: including rsb into my project partly deletes/changes my cmake configuration which should not be...
BTW: the workaround to first include rsb and then include my additional boost components works.
History
#1 Updated by J. Wienke over 9 years ago
- Status changed from New to Rejected
There is no mechanism to handle this correctly in CMake. Only the workaround you described can be used, i.e. deferring the find_package call to the moment you need it. See e.g.: https://stackoverflow.com/questions/19720639/handling-multiple-find-package-calls-in-cmake. So we basically can't do anything. :/ If we remove the find_package call for boost from the CMake config file, others will start to complain because they have to search for boost then on their own and a lot of existing build systems will probably break.
#2 Updated by J. Wienke over 9 years ago
- Category set to Build System