[CMake] Linker trouble - no -L added from target_link_libraries
terje loe
terjeloe at hotmail.com
Mon Dec 3 18:10:41 EST 2012
Hi,
I'm having some linker trouble on linux with my cmake project.
I've installed a package (nvidias Cg toolkit) which puts the library files in /usr/lib64
I use the find script here: http://code.google.com/p/nvidia-texture-tools/source/browse/branches/2.0/cmake/FindCg.cmake?r=452
If I print out CG_LIBRARY and CG_GL_LIBRARY with message() after running the find script they are both set to the correct file and path:/usr/lib64/libCg.so-lpthread/usr/lib64/libCgGL.so
The find script adds -lpthread to CG_LIBRARY. I've also tried removing the line where it adds this and add it manually to the target project.
Then I add these variables to the target project with target_link_libraries().
When I run make it says:/usr/bin/ld: cannot find -lCg/usr/bin/ld: cannot find -lCgGLcollect2: error: ld returned 1 exit status
Now if I run make with VERBOSE=1 I can see that there is no -L/usr/lib64 entry. If I edit the CMakeFiles/MyProject.dir/link.txt and add the entry manually it links it fine. Shouldn't cmake add the -L entries automaticaly with target_link_libraries()?I've also tried using link_directories to add the -L manualy, but that doesn't do anything either..
T.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20121204/b0aa7f33/attachment.htm>
More information about the CMake
mailing list