c++ - CMake link behaviour depends on BOOST_ROOT -


i'm using cmake build project among other things link boost. use cmake 2.8.7, have

set(boost_no_system_paths true) 

and use

find_package(boost components system filesystem regex required) 

i link using

target_link_libraries(projectname ${boost_libraries}) 

i use environment variable boost_root specify location of boost, , question follows:

when set

boost_root=/opt/boost_1_47 

cmake passes full path libraries linker, whereas if set

boost_root=/usr 

it links using

-lboost_filesystem-mt 

etc. cmakelists.txt same in both cases, thing change environment varible boost_root. why doesn't cmake pass full path in both cases?

the linker able find libraries in standard paths /lib, /lib64, /usr/lib, /usr/lib64 etc. in case cmake not feel need tell linker library located. in case of /opt/boost_1_47, not standard path linker doesn't know library located.

just try setting link_directories in cmake path/to/boost/libraries notice different behavior.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -