Hi,
no, I haven't. I assume the ".dylib" extension on Mac is pure convention, isn't
it? And this convention is not used for instance by ROOT libraries installed
via macports
(https://trac.macports.org/browser/trunk/dports/science/root/Portfile). This is
not a problem for cmake when used with make on OS X but it is when used with
Xcode.  No "not a valid library name" warning shows up when used with make and
linking is successful. 
To give a minimal example, I use a directory with the following content:
- empty directory build
- file CMakeLists.txt:
CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)PROJECT(test CXX)add_executable(
myexe helloworld.cpp)target_link_libraries(my exe /fullpath/mylib.so)
- file helloworld.cpp :
#include <iostream>
int main(){
  std::cout<<"Hello world"<<std::endl;
}
- file mylib.cpp:

void foo(){
}
Than I create the library with:clang++ -dynamiclib -o mylib.so mylib.cppAfter
that the following works fine without any warning:cd buildcmake ..make
But the following gives the warning:cd buildcmake -G Xcode ..
And the build in Xcode fails. :(
Cheers,Bjoern            
  
Original Message processed by David.fx12   Subject: Re: [CMake] .so libraries
and Xcode (03-Mar-2014 19:04)From:    Lucas Soltic
<[email protected]>To:      [email protected] Le 3 mars 2014 à
18:25, Bjoern Sarrazin <[email protected]> a écrit :




                        Hi!
I'm trying to link shared libraries with filename extension ".so"  (like the
ROOT libraries from root.cern.ch). This works fine using Makefiles, also on Mac
OS. Using option -G Xcode however it does not work:
I use something like
target_link_libraries(myexe /full/path/to/somelib.so)
Running cake with -G Xcode prints a warning:
  "Target "myexe" links to item /full/path/to/somelib.so which is a full-path
but not a valid library file name."
When I run the build step in Xcode the linking step fails with ld: library not
found for -lsomelib.so.
What's going wrong here? I have this problem whenever I try to link a shared
library with .so filename extension and option -G Xcode.
 As a work around everything works fine when I use
LINK_DIRECTORIES( /full/path/to )
and add -lsomelib to the link flags of my exe. But this is an annoying
workaround because I'd like to use FIND_LIBRARY to search for the library and
FIND_LIBRARY returns /full/path/to/somelib.so. 
Cheers,Bjorn



    

Hi,
Mac OS X libraries have a ".dylib" extension, not ".so". Thus somelib.so is
"not a valid library file name".Maybe your workaround works because you have
somelib.dylib in your link directory?
Lucas   
      




-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to