My CMakeLists.txt file makes cmake point to the wrong version of Boost:
find_package(Boost COMPONENTS program_options)
In my case it points to Boost 1.39 in /otherDir/boost
instead of Boost 1.50 in /usr/local/include/boost
.
Since the version of Boost will change, I would like to avoid specifying it with:
find_package(Boost 1.50 COMPONENTS program_options)
or having to set the environment variable $ENV{BOOST_ROOT}.
The problem is due to the fact that the directory hierarchy has the following structure:
/usr/local/include/boost
/otherDir/boost
/otherDir/otherNeededFiles
and my CMakeLists.txt file contains:
include_directories(${Boost_INCLUDE_DIRS})
include_directories(/usr/local/include)
include_directories(/otherDir)
The value of Boost_INCLUDE_DIRS
is correct (/usr/local/include
), as the value of Boost_LIBRARIES
(/usr/local/lib/libboost_program_options.a
).
If I rename /otherDir/boost
as /otherDir/boost_old
, the linker is happy and points to the latest boost version. However I am not allowed to rename that directory.
Is it possible to do the equivalent of:
find_package(Boost latest COMPONENTS program_options)
Thank you.