FindBoost incorrectly links against the system library
Hello,
I am using cmake 3.12 on a ppc64le
cluster. Both cmake and boost I compiled from source myself and I am using Lmod to manage my environment. In the environment I set
prepend_path("LIBRARY_PATH","/path/to/my/boost/1.68.0/lib")
prepend_path("LD_LIBRARY_PATH","/path/to/my/boost/1.68.0/lib")
prepend_path("C_INCLUDE_PATH","/path/to/my/boost/1.68.0/include")
prepend_path("CPLUS_INCLUDE_PATH","/path/to/my/boost/1.68.0/include")
setenv("BOOST_ROOT","/path/to/my/boost/1.68.0")
In CMakeLists.txt
I set
find_package(Boost 1.67.0 REQUIRED COMPONENTS program_options)
which resolves correctly at the config stage to my version 1.68.0
. We put this minimum version in order to differentiate this boost from the system one which is at version 1.5*
.
Following @rleigh suggestion from the mailing list I have also double checked in CMakeCache.txt
.
...
Boost_PROGRAM_OPTIONS_LIBRARY_DEBUG:FILEPATH=/path/to/my/boost/1.68.0/lib/libboost_program_options-mt.so
...
Unfortunately success ends here. When I run make
I get linker errors. On one of the clusters we managed to convince the admins to remove system boost and the problem went away, but on another the problem persists. I run with make VERBOSE=2
and it seems that the -L
flag is missing?
/path/to/g++ -rdynamic CMakeFiles/test.dir/test.cpp.o -o test -lboost_program_options-mt
Please advise.