I&#39;m using MinGW Makefiles as a base and a toolchain file.<div><br></div><div>I made a (somewhat) simple cmakelists that makes a library, and an executable that links against it.</div><div><br></div><div>Without specifying the toolchain, the link command looks something like</div>
<div><br></div><div>gcc test1.c.obj -o test1 -ltest2   </div><div>(hmm no, that&#39;s what I want it to say) </div><div><br></div><div>what it does say is more like</div><div><br></div><div>gcc test1.c.obj -o test1 test2.dll.a</div>
<div>or</div><div>gcc test1.c.obj -o test1 libtest2.so</div><div><br></div><div><br></div><div>can I convince Cmake to generate references to libraries with -l instead of the path to the library it linked?</div><div><br></div>
<div>; or, the warnings (potential errors?) I&#39;m getting say like...</div><div><div>..../bin/ld.exe: warning: libbag.so, needed by ..\..\..\..\libbag.psi++.so, not found (try using -rpath or -rpath-link)</div><div>.../bin/ld.exe: warning: libbag++.so, needed by ..\..\..\..\libbag.psi++.so, not found (try using -rpath or -rpath-link)</div>
<div>.../bin/ld.exe: warning: <a href="http://libbag.externals.so">libbag.externals.so</a>, needed by ..\..\..\..\libbag.psi++.so, not found (try using -rpath or -rpath-link)</div></div><div><br></div><div>these libraries appear in the actual link line several times, both before and after the libraries in question...</div>
<div><br></div><div>so do I apply the rpath (or rpath-link to the executable or the component library... (it&#39;s actually a program:lib:lib:lib dependency)</div><div>(I tried both, and it helped, but only for a little while; probably because it didn&#39;t need to rebuilt, so it wasn&#39;t an error. THere aren&#39;t any unresolved symbols (but could there be?)</div>
<div><br></div><div><br></div><div>----- a cmake to make a lib and executable -----------</div><div><br></div><div>cmake_minimum_required(VERSION 2.8)</div><div><div><br></div><div>FILE( WRITE ${CMAKE_CURRENT_SOURCE_DIR}/test1.c &quot;int main() { return f(); } &quot; )</div>
<div>FILE( WRITE ${CMAKE_CURRENT_SOURCE_DIR}/test2.c &quot;int f() { return 1; } &quot; )</div><div><br></div><div>add_library( test2 SHARED test2.c )</div><div>add_executable( test1 test1.c )</div><div>target_link_libraries( test1 test2 )</div>
<div><div><br></div><div>----------------------</div></div></div><div><br></div>