[CMake] Re-2: Re-2: .so libraries and Xcode
Bjoern Sarrazin
bjoern at apoambach.de
Tue Mar 4 04:08:44 EST 2014
Hi,
unfortunately using FIND_LIBRARY does not help. In the minimal example I gave
above I'm now using this CMakeLists.txt:
CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
PROJECT(test CXX)
SET( CMAKE_FIND_LIBRARY_PREFIXES "lib" "" )
FIND_LIBRARY(SOME_LIBRARY NAMES mylib PATHS /Users/sarrazin/test )
ADD_EXECUTABLE( myexe helloworld.cpp )
target_link_libraries( myexe ${SOME_LIBRARY} )
Again, this works with make but not with Xcode. It works as soon as I copy
mylib.so to mylib.dylib. However both .so and .dylib are in
CMAKE_FIND_LIBRARY_SUFFIXES and the library mylib.so is found by FIND_LIBRARY,
so I don't understand why this makes any difference.
I'm using cmake 2.8.12.1 and Xcode 5.0.2.
Cheers,Bjoern
Original Message processed by David.fx12 Subject: Re: [CMake] Re-2: .so
libraries and Xcode (03-Mar-2014 22:24)From: Michael Jackson
<mike.jackson at bluequartz.net>To: bjoern at apoambach.de That part may
not be correct.
it should be target_link_libraries(myexe somelib)
CMake will look for variations of the name for the library. I think. At least I
have never had to put a full path like at and I use .plugin for my libraries in
my project and they work fine on OS X with Xcode.
You should be using the "find_library()" function to find your library which
gets assigned to a CMake variable. Then you end up with something like this:
FIND_LIBRARY(SOME_LIBRARY
NAMES somelib
PATHS /full/path/to/ )
target_link_libraries(myexe ${SOME_LIBRARY})
That really should work on Xcode without any issues.
Mike J.
On Mar 3, 2014, at 2:18 PM, Bjoern Sarrazin <bjoern at apoambach.de> wrote:
>> I use something like
>>
>> target_link_libraries(myexe /full/path/to/somelib.so)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140304/9473f47a/attachment.html>
More information about the CMake
mailing list