[CMake] MinGW Link with -l instead of path?
J Decker
d3ck0r at gmail.com
Tue Mar 19 06:05:56 EDT 2013
I'm using MinGW Makefiles as a base and a toolchain file.
I made a (somewhat) simple cmakelists that makes a library, and an
executable that links against it.
Without specifying the toolchain, the link command looks something like
gcc test1.c.obj -o test1 -ltest2
(hmm no, that's what I want it to say)
what it does say is more like
gcc test1.c.obj -o test1 test2.dll.a
or
gcc test1.c.obj -o test1 libtest2.so
can I convince Cmake to generate references to libraries with -l instead of
the path to the library it linked?
; or, the warnings (potential errors?) I'm getting say like...
..../bin/ld.exe: warning: libbag.so, needed by ..\..\..\..\libbag.psi++.so,
not found (try using -rpath or -rpath-link)
.../bin/ld.exe: warning: libbag++.so, needed by
..\..\..\..\libbag.psi++.so, not found (try using -rpath or -rpath-link)
.../bin/ld.exe: warning: libbag.externals.so, needed by
..\..\..\..\libbag.psi++.so, not found (try using -rpath or -rpath-link)
these libraries appear in the actual link line several times, both before
and after the libraries in question...
so do I apply the rpath (or rpath-link to the executable or the component
library... (it's actually a program:lib:lib:lib dependency)
(I tried both, and it helped, but only for a little while; probably because
it didn't need to rebuilt, so it wasn't an error. THere aren't any
unresolved symbols (but could there be?)
----- a cmake to make a lib and executable -----------
cmake_minimum_required(VERSION 2.8)
FILE( WRITE ${CMAKE_CURRENT_SOURCE_DIR}/test1.c "int main() { return f(); }
" )
FILE( WRITE ${CMAKE_CURRENT_SOURCE_DIR}/test2.c "int f() { return 1; } " )
add_library( test2 SHARED test2.c )
add_executable( test1 test1.c )
target_link_libraries( test1 test2 )
----------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130319/e8e2ca26/attachment-0001.htm>
More information about the CMake
mailing list