[CMake] Boost_ADDITIONAL_VERSIONS works not correctly
Jan Dinger
dinger.jan at googlemail.com
Tue Jan 31 07:27:40 EST 2012
Hello Folks,
I've issue with my CMake. I'm looking for a boost installation and
components. I the right version of boost, but there is some mistake.
CMake links my program against
libboost_thread.so.1.46.1 that is not correct. The correct version is
libboost_thread.so.1.4.7.0. Every boost library is linked against
version 1.47.0, the exception is libboost_thread. I don't know whats
happen.
Here is my CMakeLists.txt
### snip ###
# Set up thirdparty library directory
set(BOOST_ROOT ${PROJECT_SOURCE_DIR}/thirdparty/boost_1_47_0)
# Components that need linking (NB does not include header-only
components like bind)
set(GGMCONTROL_BOOST_COMPONENTS thread program_options filesystem system log)
#Find Boost
set(Boost_ADDITIONAL_VERSIONS "1.47" "1.47.0")
find_package(Boost COMPONENTS ${GGMCONTROL_BOOST_COMPONENTS} REQUIRED)
if(NOT Boost_FOUND)
# Try again with the other type of libs
set(Boost_USE_STATIC_LIBS NOT ${Boost_USE_STATIC_LIBS})
find_package(Boost COMPONENTS ${GGMCONTROL_BOOST_COMPONENTS} QUIET)
endif()
# Set up referencing of Boost
include_directories(${Boost_INCLUDE_DIR})
add_definitions(-DBOOST_ALL_NO_LIB)
#add_definitions(-DBOOST_ALL_DYN_LINK)
set(GGMCONTROL_LIBRARIES ${GGMCONTROL_LIBRARIES} ${Boost_LIBRARIES})
# Set up executable and linking
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE})
add_executable(ggmControl ${HDRS} ${SRCS})
set_target_properties(ggmControl PROPERTIES DEBUG_POSTFIX _d)
target_link_libraries(ggmControl ${GGMCONTROL_LIBRARIES})
### snap ###
If I take a look at my executable with ldd, I can see all linked libraries:
### snip ###
ldd ggmControl_d
libboost_thread.so.1.46.1 => /usr/lib/libboost_thread.so.1.46.1
(0x00007f03613bb000)
libboost_program_options.so.1.47.0 =>
/home/jan/projects/cpp/ggmcontrol-experimental/thirdparty/boost_1_47_0/lib/libboost_program_options.so.1.47.0
(0x00007f036115f000)
libboost_filesystem.so.1.47.0 =>
/home/jan/projects/cpp/ggmcontrol-experimental/thirdparty/boost_1_47_0/lib/libboost_filesystem.so.1.47.0
(0x00007f0360f41000)
libboost_system.so.1.47.0 =>
/home/jan/projects/cpp/ggmcontrol-experimental/thirdparty/boost_1_47_0/lib/libboost_system.so.1.47.0
(0x00007f0360d3d000)
libboost_log.so.1.47.0 =>
/home/jan/projects/cpp/ggmcontrol-experimental/thirdparty/boost_1_47_0/lib/libboost_log.so.1.47.0
(0x00007f0360a2d000)
libboost_thread.so.1.47.0 =>
/home/jan/projects/cpp/ggmcontrol-experimental/thirdparty/boost_1_47_0/lib/libboost_thread.so.1.47.0
(0x00007f035f8ab000)
### snap ###
So you can see my program is linked against two different boost
versions, that is really bad...
Did someone have a solution for my problem?
Special Thank.
so long and best regards
jan
More information about the CMake
mailing list