[CMake] linker default library path /usr/local/lib on OSX
amine bezzarga
abezzarg at gmail.com
Sun Sep 18 09:16:24 EDT 2011
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110918/6f85282c/attachment-0001.htm>
More information about the CMake
mailing list