I built my own GCC and libraries and put the libraries in /opt/gcc-4.6.2/lib
so generically-named libraries like libstdc++
do not interfere with other parts of the system. This means I have to specify the library search path manually:
$> g++-4.6.2 -L/opt/gcc-4.6.2/lib input.cpp
When trying to get my project to build with CMake, I can't seem to figure out how to tell CMake to search that library. The documentation says to use CMAKE_LIBRARY_PATH
, which I set on the line used to generate my Makefiles:
$> cmake .. -DCMAKE_CXX_COMPILER=g++-4.6.2 \
-DCMAKE_LIBRARY_PATH=/opt/gcc-4.6.2/lib
This, however, fails on the simple program compilation test:
# blah blah blah...
/usr/local/bin/g++-4.6.2
CMakeFiles/cmTryCompileExec.dir/testCXXCompiler.cxx.o -o cmTryCompileExec
-rdynamic
/usr/bin/ld: cannot find -lstdc++
# blah blah blah...
I can't seem to find the voodoo magic needed to make CMake emit -L/opt/gcc-4.6.2/lib
for the test compilation (I know CMAKE_LIBRARY_PATH
works after the project is built). How can I force CMake to use an alternative library path to link the test executables?