I want to define a minimum boost version to be available on the system. I tried the following approach. Unfortunately this did not work, as it tries to compile also with only boost 1.40.0 available on the system.
SET(Boost_USE_STATIC_LIBS OFF)
SET(Boost_USE_MULTITHREAD OFF)
SET(BOOST_MIN_VERSION "1.47.0")
FIND_PACKAGE(Boost REQUIRED)
FIND_PACKAGE(Boost REQUIRED)
if (NOT Boost_FOUND)
message(FATAL_ERROR "Fatal error: Boost (version >= 1.47.0) required.\n")
endif (NOT Boost_FOUND)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
How did I get cmake to control the correct boost version, before compiling?
Based on this it seems that FIND_PACKAGE ignores SET(BOOST_MIN_VERSION "1.47.0")
instead you could use FIND_PACKAGE(Boost 1.47.0 REQUIRED)
or slightly nicer FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} REQUIRED)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With