[CMake] linker default library path /usr/local/lib on OSX

Michael Jackson mike.jackson at bluequartz.net
Mon Sep 19 07:56:17 EDT 2011


My guess is that the audio library has an install path of /usr/local/lib
encoded in it. Try posting tue output of otool for the actual audio
library.

-----
Mike Jackson                     www.bluequartz.net
Principal Software Engineer       mike.jackson at bluequartz.net
BlueQuartz Software               Dayton, Ohio
Sent from my mobile device.

On Sep 18, 2011, at 23:38, Cristobal Navarro <axischire at gmail.com> wrote:

ok i get your point.
mmm. In others words you need something equivalent to rpath command, im
pretty sure cmake can handle this easily let me know if the following helps.

have you tried adding more options to the find_library command ??
for example have you tried this (also, with the PATHS command just to be
sure):

find_library(IrrKlang_LIBRARIES irrKlang
PATHS
${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/IrrKLangAudioEngine/bin/macosx-gcc
 NO_DEFAULT_PATH
 )

And what is your "target_link_libraries" command?



On Sun, Sep 18, 2011 at 12:33 PM, amine bezzarga <abezzarg at gmail.com> wrote:

> The issue is not about finding the library at built time, event if my
> library is found in
> ${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/IrrKLangAudioEngine/bin/macosx-gcc 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.
>
> I want to find a way to tell the linker to link the library from where it
> find it.
> Does it make sense ?
>
> On Sun, Sep 18, 2011 at 4:29 PM, Cristobal Navarro <axischire at gmail.com>wrote:
>
>> yes
>>
>> you have to provide another option
>> find_library( IrrKlang_LIBRARIES irrKlang PATHS <path1 to library> <path2
>> to library> ... )
>>
>> http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:find_library
>>
>> is this what you need?
>> best regards
>> Cristobal
>>
>>
>> On Sun, Sep 18, 2011 at 10:16 AM, amine bezzarga <abezzarg at gmail.com>wrote:
>>
>>> Hello guys,
>>>
>>> I added a sound library to my project, So I first created a cmake module
>>> to find it
>>>
>>> MESSAGE(STATUS "Looking for IrrKlang...")
>>>
>>> find_library(IrrKlang_LIBRARIES irrKlang
>>>
>>> ${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/IrrKLangAudioEngine/bin/macosx-gcc
>>>  )
>>>
>>> find_path(IrrKlang_INCLUDE_DIRS irrKlang.h
>>>  ${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/IrrKLangAudioEngine/include
>>> )
>>>
>>> IF (IrrKlang_INCLUDE_DIRS AND IrrKlang_LIBRARIES)
>>>    SET(IrrKlang_FOUND TRUE)
>>> ENDIF (IrrKlang_INCLUDE_DIRS AND IrrKlang_LIBRARIES)
>>>
>>>
>>> IF (IrrKlang_FOUND)
>>>    IF (NOT IrrKlang_FIND_QUIETLY)
>>>       MESSAGE(STATUS "Found IrrKlang: ${IrrKlang_LIBRARIES}")
>>>    ENDIF (NOT IrrKlang_FIND_QUIETLY)
>>> ELSE (IrrKlang_FOUND)
>>>    IF (IrrKlang_FIND_REQUIRED)
>>>       MESSAGE(FATAL_ERROR "Could not find IrrKlang")
>>>    ENDIF (IrrKlang_FIND_REQUIRED)
>>> ENDIF (IrrKlang_FOUND)
>>>
>>> Everything works fine exept I can't control from where the library is
>>> linked.
>>> Why after I build my project OSX is looking for that library in
>>> /usr/local/lib ?
>>> 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
>>> ?
>>>
>>> here is my otool output after building the project
>>> $ otool -L ./bin/MacOSX/OgreApp.app/Contents/MacOS/OgreApp
>>> ./bin/MacOSX/OgreApp.app/Contents/MacOS/OgreApp:
>>> @executable_path/../Frameworks/Ogre.framework/Versions/1.7.1/Ogre
>>> (compatibility version 0.0.0, current version 1.7.1)
>>>  @executable_path/../Components/libOgreRTShaderSystem.dylib
>>> (compatibility version 0.0.0, current version 1.7.1)
>>>  @executable_path/../Frameworks/OIS.framework/Versions/A/OIS
>>> (compatibility version 1.0.0, current version 1.0.0)
>>>  /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.
>>>  /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current
>>> version 7.9.0)
>>> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
>>> 123.0.0)
>>>
>>> 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.
>>>
>>> Do you have any ideas ?
>>> Mino
>>>
>>>
>>> _______________________________________________
>>> 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
>>>
>>
>
>
>
_______________________________________________
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110919/3d0525ec/attachment-0001.htm>


More information about the CMake mailing list