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 )

----------------------
--

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

Reply via email to