[CMake] cmake, boost on windows, and linking: shouldn't find_package have put BOOST_ROOT/lib into LIB?

Dan Kegel dank at kegel.com
Sun Oct 30 20:53:00 EDT 2011


Thanks to David & Daniel for the replies, but I was
already doing everything by the book, so their replies
didn't help.  It seems to be a bug, or flaky feature, in boost; I had
to disable "auto-linking".  Here's the final, working CMakeLists.txt:

cmake_minimum_required(VERSION 2.8)
# Turn off boost's autolinking feature, since it seems to guess wrong
about the name of the library
add_definitions(-DBOOST_ALL_NO_LIB)
find_package(Boost 1.45 COMPONENTS date_time REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
add_executable(mymain mymain.cpp)
target_link_libraries(mymain ${Boost_LIBRARIES})

The only change from before was adding the add_definitions line.


More information about the CMake mailing list