<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
On 06/15/2010 09:54 AM, Jesse Perla wrote:
<blockquote
cite="mid:AANLkTimMTQcb4EEFMET1i78EeieZoSWElc7gbYI-Pfaj@mail.gmail.com"
type="cite">
<div>I am using CMake 2.8.1 on Windows 7. I have MinGW installed
with GCC 4.5</div>
<div><br>
</div>
I have successfully compiled a library with a MinGW and cmake. The
full path to the library is: c:\working\etk_binaries\libetk-mgw45.a
<div><br>
</div>
<div>However, when I want to link this file into an executable (no
need to have the CMake dependencies, etc. in projects) it can't seem to
find this file.</div>
<div>My cmakelists.txt is:</div>
<div>
<div>
<div> cmake_minimum_required(VERSION 2.6)</div>
<div> set(PROJECT_NAME "test" ) </div>
<div> set(SRCS <span class="Apple-tab-span" style="white-space: pre;">
</span>test.cpp )<span class="Apple-tab-span"
style="white-space: pre;"> </span></div>
<div> project(${PROJECT_NAME})</div>
<div> add_executable(${PROJECT_NAME} ${SRCS})</div>
<div><br>
</div>
<div> link_directories( "c:/working/etk_binaries")</div>
<div> target_link_libraries(${PROJECT_NAME} libetk-mgw45)</div>
</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>The error I get is:</div>
<div><br>
</div>
<div>
<div>c:\MinGW\bin/ld.exe: cannot find -llibetk-mgw45</div>
<div>collect2: ld returned 1 exit status</div>
<div>mingw32-make[2]: *** [test.exe] Error 1</div>
<div>mingw32-make[1]: *** [CMakeFiles/test.dir/all] Error 2</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Any ideas on what I have done wrong?</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Jesse</div>
<br>
</blockquote>
<br>
You should use or create a FindXXX.cmake module that locates the
desired library and include files. Then, you should do something like<br>
target_link_libraries(${PROJECT_NAME} ${ETK_LIBRARIES})<br>
<br>
(The issue you are having is because you aren't using the full path to
the library.)<br>
<br>
Ryan<br>
<br>
<br>
<pre class="moz-signature" cols="72">--
Ryan Pavlik
HCI Graduate Student
Virtual Reality Applications Center
Iowa State University
<a class="moz-txt-link-abbreviated" href="mailto:rpavlik@iastate.edu">rpavlik@iastate.edu</a>
<a class="moz-txt-link-freetext" href="http://academic.cleardefinition.com">http://academic.cleardefinition.com</a></pre>
</body>
</html>