[CMake] Issues with FindBoost / ${Boost_LIBRARIES}

Rolf Eike Beer eike at sf-mail.de
Wed Feb 1 03:46:25 EST 2012


> Hi all,
>
> I have been trying to compile a very simple example with cmake (2.8.5) and
> boost, and I can't get what I am doing wrong...
>
> CMakeLists.txt
> ----------------------
>
> cmake_minimum_required(VERSION 2.6)
>
> project(ReadGraph)
>
> find_package(Boost 1.46 COMPONENTS graph regex )

Maybe you need to add 1.46.0 here?

> link_directories(${Boost_LIBRARY_DIRS})

This is wrong. You don't need link_directories().

> include_directories(BEFORE ${Boost_INCLUDE_DIRS})
>
> add_executable(ReadGraph ReadGraph.cpp)
> target_link_libraries(ReadGraph ${Boost_LIBRARIES} )
> # target_link_libraries(ReadGraph boost_graph boost_regex )

Please use a clean build directory and add "-D Boost_DEBUG=On" to your
command line. Then look at the configuration output. If you do not find
what's going wrong paste it here.

Eike


More information about the CMake mailing list