I am using CMake's link_libraries
code to specify a path to (the folder containing) a particular version of libstdc++.so
.
Initially, on a 32-bit machine, this worked fine: running ldd <target>
on a built-but-not-installed executable showed that libstdc++.so
was pointing to the desired version, and I was able to run ctest
to execute tests even though the system libstdc++.so
is older than what the tests require.
When I ported the code to a 64-bit machine, however, the desired libstdc++.so
path was no longer included in the linked executables. This forces me to (ab)use LD_LIBRARY_PATH
to run the project's tests.
I tried to replicate the issue with a small test-case, but I can't get it to include the desired paths on either platform, so it's possible that the issue is not related to the 32-bit to 64-bit porting activity. I have, however, commented out the link_libraries
line when building on the 32-bit platform and confirmed that without it, the desired library path is not included. I have also checked many times to ensure that I am specifying a valid path for the desired 64-bit library.
Any idea what else might be going on here?
You might want to read about the
RPATH
option: http://en.wikipedia.org/wiki/RpathYou can of course set it manually via
CMAKE_[EXE,SHARED,STATIC,MODULE]LINKER__FLAGS
e.g.but there is also a possibility to use CMake itself http://www.cmake.org/Wiki/CMake_RPATH_handling