The issue is not about finding the library at built time, event if my library is found in <span style="border-collapse:collapse;color:rgb(102, 51, 255);font-family:arial, sans-serif;font-size:13px">${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/IrrKLangAudioEngine/bin/macosx-gcc</span> and after building is done, my app is still looking for the library in /usr/local/lib at runtime as you can see with the otools output in my first message.<div>
<br></div><div>I want to find a way to tell the linker to link the library from where it find it.</div><div>Does it make sense ?</div><div></div><br><div class="gmail_quote">On Sun, Sep 18, 2011 at 4:29 PM, Cristobal Navarro <span dir="ltr"><<a href="mailto:axischire@gmail.com" target="_blank">axischire@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">yes<div><br></div><div>you have to provide another option</div><div>find_library( <span style="color:rgb(102, 51, 255)">IrrKlang_LIBRARIES irrKlang </span>PATHS <path1 to library> <path2 to library> ... )</div>
<div><br></div><div><a href="http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:find_library" target="_blank">http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:find_library</a></div><div><br></div><div>
is this what you need?</div>
<div>best regards</div><div>Cristobal</div><div><br></div><div><br><div class="gmail_quote"><div><div></div><div>On Sun, Sep 18, 2011 at 10:16 AM, amine bezzarga <span dir="ltr"><<a href="mailto:abezzarg@gmail.com" target="_blank">abezzarg@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div>Hello guys,<div><br></div><div>I added a sound library to my project, So I first created a cmake module to find it</div>
<div><br></div><div><div><font color="#6633ff">MESSAGE(STATUS "Looking for IrrKlang...")</font></div>
<div><font color="#6633ff"><br></font></div><div><font color="#6633ff">find_library(IrrKlang_LIBRARIES irrKlang</font></div><div><font color="#6633ff"><span style="white-space:pre-wrap">                </span>${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/IrrKLangAudioEngine/bin/macosx-gcc</font></div>
<div><font color="#6633ff"><span style="white-space:pre-wrap">        </span>)</font></div><div><font color="#6633ff"><br></font></div><div><font color="#6633ff">find_path(IrrKlang_INCLUDE_DIRS irrKlang.h</font></div>
<div><font color="#6633ff"><span style="white-space:pre-wrap">                </span>${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/IrrKLangAudioEngine/include</font></div><div><font color="#6633ff"><span style="white-space:pre-wrap">        </span>)</font></div>
<div><font color="#6633ff"><br></font></div><div><font color="#6633ff">IF (IrrKlang_INCLUDE_DIRS AND IrrKlang_LIBRARIES)</font></div><div><font color="#6633ff"> SET(IrrKlang_FOUND TRUE)</font></div>
<div><font color="#6633ff">ENDIF (IrrKlang_INCLUDE_DIRS AND IrrKlang_LIBRARIES)</font></div><div><font color="#6633ff"><br></font></div><div><font color="#6633ff"><br>
</font></div><div><font color="#6633ff">IF (IrrKlang_FOUND)</font></div><div><font color="#6633ff"> IF (NOT IrrKlang_FIND_QUIETLY)</font></div><div><font color="#6633ff"> MESSAGE(STATUS "Found IrrKlang: ${IrrKlang_LIBRARIES}")</font></div>
<div><font color="#6633ff"> ENDIF (NOT IrrKlang_FIND_QUIETLY)</font></div><div><font color="#6633ff">ELSE (IrrKlang_FOUND)</font></div><div><font color="#6633ff"> IF (IrrKlang_FIND_REQUIRED)</font></div>
<div><font color="#6633ff"> MESSAGE(FATAL_ERROR "Could not find IrrKlang")</font></div><div><font color="#6633ff"> ENDIF (IrrKlang_FIND_REQUIRED)</font></div>
<div><font color="#6633ff">ENDIF (IrrKlang_FOUND)</font></div><div><font color="#6633ff"><br></font></div><div>Everything works fine exept I can't control from where the library is linked.</div>
<div>Why after I build my project OSX is looking for that library in /usr/local/lib ?</div><div>Is there a way to tell cmake to link the library from where it find it i.e ${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/IrrKLangAudioEngine/bin/macosx-gcc ?</div>
<div><br></div><div>here is my otool output after building the project </div><div><font color="#6633ff">$ otool -L ./bin/MacOSX/OgreApp.app/Contents/MacOS/OgreApp </font></div>
<div><font color="#6633ff">./bin/MacOSX/OgreApp.app/Contents/MacOS/OgreApp:</font></div><div><font color="#6633ff"><span style="white-space:pre-wrap">        </span>@executable_path/../Frameworks/Ogre.framework/Versions/1.7.1/Ogre (compatibility version 0.0.0, current version 1.7.1)</font></div>
<div><font color="#6633ff"><span style="white-space:pre-wrap">        </span>@executable_path/../Components/libOgreRTShaderSystem.dylib (compatibility version 0.0.0, current version 1.7.1)</font></div>
<div><font color="#6633ff"><span style="white-space:pre-wrap">        </span>@executable_path/../Frameworks/OIS.framework/Versions/A/OIS (compatibility version 1.0.0, current version 1.0.0)</font></div>
<div><span style="color:rgb(102, 51, 255);white-space:pre-wrap">        </span><font color="#ff0000">/usr/local/lib/libirrklang.dylib (compatibility version 1.0.0, current version 1.0.0) --> I want cmake to link that lib, because my lib is not there.</font></div>
<div><font color="#6633ff"><span style="white-space:pre-wrap">        </span>/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)</font></div><div><font color="#6633ff"><span style="white-space:pre-wrap">        </span>/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 123.0.0)</font></div>
<div><br></div><div>I know I can correct the path with bundleutilities, but the library still need to be copied in /usr/local/lib to be preccessed by bundleutilitities in that case. </div><div><br></div><div>Do you have any ideas ?</div>
<div>Mino</div><br>
</div>
<br></div></div>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div></div></blockquote></div><br><div><div>
</div></div><div><font color="#C0C0C0"><br></font></div><br>