Re: [CMake] Absolute Path linking library

2013-09-04 Thread Clinton Stimpson
On Tuesday, September 03, 2013 09:47:45 PM Laurent Chauvin wrote: Hello everyone, I'm working on a library, and I would like the users be able to create their own program and liking to my library (by specifying path in cmake). I created the library and an example to test it. Everything

Re: [CMake] Absolute Path linking library

2013-09-04 Thread Felipe Menezes Machado
I'm not an expert, but I think this wiki could help: http://www.cmake.org/Wiki/CMake_RPATH_handling On Tue, Sep 3, 2013 at 10:47 PM, Laurent Chauvin lchau...@bwh.harvard.eduwrote: Hello everyone, I'm working on a library, and I would like the users be able to create their own program and

Re: [CMake] Absolute Path linking library

2013-09-04 Thread Laurent Chauvin
Thank you for you help Clint. I actually relinked, but as you said I still had the LINK_DIRECTORIES. However, if I remove it, I have a linking error telling me it cannot find the library. Should I keep the library in Target_Link_Libraries, or with new flags, dependency will automatically find

Re: [CMake] Absolute Path linking library

2013-09-04 Thread Clinton Stimpson
On Wednesday, September 04, 2013 11:53:45 AM Laurent Chauvin wrote: Hello, I just tried to set the MACOSX_RPATH 1 in the top CMakeLists of MyLib, and when I now do otool -L libMyLib.dyld, I can indeed see @rpath/libMyLib.dyld. However, my executable MyExample is still not able to find the

Re: [CMake] Absolute Path linking library

2013-09-04 Thread Clinton Stimpson
On Wednesday, September 04, 2013 11:30:51 AM Laurent Chauvin wrote: Thank you very much for your answer. I will try to use the MACOSX_RPATH. However, I have some questions. As the flag suggests, it's only for mac. Is there anything similar for Linux (and eventually Windows systems) ? For

Re: [CMake] Absolute Path linking library

2013-09-04 Thread Clinton Stimpson
On Wednesday, September 04, 2013 12:02:55 PM Laurent Chauvin wrote: Thank you for you help Clint. I actually relinked, but as you said I still had the LINK_DIRECTORIES. However, if I remove it, I have a linking error telling me it cannot find the library. Should I keep the library in

Re: [CMake] Absolute Path linking library

2013-09-04 Thread Laurent Chauvin
Yes I'm using 2.8.12-rc2 for the library and the example. But my example is not in the same directory as my library. I can see in your example you specify the full path in target_link_libraries of your library, which I could probably do. The problem is, if later on my library I want to put the

Re: [CMake] Absolute Path linking library

2013-09-04 Thread Laurent Chauvin
Does your example still works if you replace this line: target_link_libraries(app ${CMAKE_CURRENT_LIST_DIR}/../lib/liblib.dylib) by this one: target_link_libraries(app lib) ? Thank you. -Laurent On Wed, Sep 4, 2013 at 1:18 PM, Clinton Stimpson clin...@elemtech.comwrote: On Wednesday,

Re: [CMake] Absolute Path linking library

2013-09-04 Thread Laurent Chauvin
Thank you for your help Clint. I identified the problem. When I compile my library with CMAKE_MACOSX_RPATH, the library created is linked with @rpath/libMyLib.dylib. When I was recompiling (make) it was updating the library in the build directory but it was not re-installing (copying in the

Re: [CMake] Absolute Path linking library

2013-09-04 Thread Clinton Stimpson
On Wednesday, September 04, 2013 03:01:06 PM Laurent Chauvin wrote: Thank you for your help Clint. I identified the problem. When I compile my library with CMAKE_MACOSX_RPATH, the library created is linked with @rpath/libMyLib.dylib. When I was recompiling (make) it was updating the library

[CMake] Absolute Path linking library

2013-09-03 Thread Laurent Chauvin
Hello everyone, I'm working on a library, and I would like the users be able to create their own program and liking to my library (by specifying path in cmake). I created the library and an example to test it. Everything compiles. However, when I try to run my example I have this error: