[CMake] CMake and FindBoost cannot set the library variables

Roger Leigh rleigh at codelibre.net
Fri Jun 10 15:03:43 EDT 2016


On 10/06/2016 13:50, Xi Shen wrote:
> find_package(Boost REQUIRED COMPONENTS regex program_options)
>
> add_executable(winotify winotify.cpp)
>
> message(STATUS "xxx ${Boost_program_options_LIBRARY_DEBUG}")

Try Boost_PROGRAM_OPTIONS_LIBRARY_DEBUG

> message(STATUS "xxx ${Boost_INCLUDE_DIR}")
> message(STATUS "xxx ${Boost_LIBRARY_DIR}")

Try Boost_LIBRARY_DIRS

Even easier: use the Boost::program_options interface target

   target_link_libraries(winotify Boost::program_options)

and it will handle both the include dir and the library to link with 
transparently.  It's the way forward!


Regards,
Roger


More information about the CMake mailing list