[CMake] Cmake appears to substitute -llibrary when a full path is given.
S'orlok Reaves
sorlok_reaves at yahoo.com
Mon Sep 23 04:01:32 EDT 2013
Good afternoon all,
This is my first post to this list, so please redirect me if I'm in the wrong place. So far cmake has been great, but I've run into an issue that I am having trouble understanding.
I'm searching for the Boost libs on a server that has two different versions installed. One is in my home directory; the other is a system-wide install (which is older).
In my CMakeLists.txt:
set(Boost_NO_SYSTEM_PATHS ON)
set(BOOST_ROOT "/home/me/opt")
find_package(Boost COMPONENTS system REQUIRED)
MESSAGE("${Boost_LIBRARIES}")
#later:
target_link_libraries (My_Program ${Boost_LIBRARIES})
This prints out the following, so I know the correct library is indeed found:
/home/me/opt/lib/libboost_system.so
Now, I "make" the project, and everything compiles, but fails to link, specifying several missing symbols in boost::system. The linker command includes the following:
#g++ ....etc., then:
-o ../My_Program -rdynamic /usr/local/lib64/libsoci_core.so -lboost_system -Wl,-rpath,/usr/local/lib64
If I change it to the following, it compiles, links, and runs fine:
-o ../My_Program -rdynamic /usr/local/lib64/libsoci_core.so /home/me/opt/lib/libboost_system.so -Wl,-rpath,/usr/local/lib64
Clearly the "-lboost_system" flag is catching the old libraries. From reading the cmake docs, I was under the impression that the full path (/home/me/opt/lib/libboost_system.so) would only be truncated to an "-lboost_system" if it was on the implicit path (e.g., /usr/lib). In that case, I have two questions:
1) Why is boost_system not being included via its complete path? Is this a bug, or am I doing something wrong?
2) Why is soci_core being included by the full path. Is it because "/usr/local" is not on the implicit path?
The second question is just out of curiosity; it is the first question that is causing me a lot of grief right now. Any suggestions?
The server I'm compiling on is running Debian Squeeze (6.0.7), with a locally-installed version of cmake (2.8.11.2).
Thanks,
Seth
More information about the CMake
mailing list