[CMake] Linker trouble - no -L added from target_link_libraries

terje loe terjeloe at hotmail.com
Tue Dec 4 05:29:56 EST 2012


Sorry for double posting.

My workaround for now is to add -L/usr/lib64 with target_link_libraries(<other libs here> -L/usr/lib64).

But this seems to be a bug or am I doing it wrong?

T.



From: terjeloe at hotmail.com
To: cmake at cmake.org
Date: Mon, 3 Dec 2012 23:56:07 +0100
Subject: [CMake] Linker trouble - no -L added from target_link_libraries





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. 		 	   		   		 	   		  

--

Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20121204/9cef207d/attachment.htm>


More information about the CMake mailing list