<div dir="ltr">I'm not an expert, but I think this wiki could help: <a href="http://www.cmake.org/Wiki/CMake_RPATH_handling">http://www.cmake.org/Wiki/CMake_RPATH_handling</a></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Tue, Sep 3, 2013 at 10:47 PM, Laurent Chauvin <span dir="ltr"><<a href="mailto:lchauvin@bwh.harvard.edu" target="_blank">lchauvin@bwh.harvard.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello everyone,<br>
<br>
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).<br>
<br>
I created the library and an example to test it.<br>
Everything compiles.<br>
<br>
However, when I try to run my example I have this error:<br>
MyExample:<br>
libMyLib.1.dylib (compatibility version 1.0.0, current version 1.0.0)<br>
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0)<br>
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)<br>
<br>
The problem is my example is not in the same directory as my library (not even in a subdirectory).<br>
And it seems it's linking to my library with a relative path.<br>
<br>
If I add the path of my library in DYLD_LIBRARY_PATH it works, but I would like the users to be able to compile and link straight forward.<br>
<br>
To link the library to my example I use find_package(MyLib REQUIRED) and include(${MyLib_USE_FILE}) which basically do a LINK_DIRECTORIES with the absolute path of the library.<br>
<br>
Then I do add_executable and target_link_libraries(MyExample ${MyLib_LIBRARIES})<br>
<br>
Compilation is working fine. There is these options:<br>
<br>
-L/Absolute/Path/To/MyLib -lMyLib<br>
<br>
But at runtime, library cannot be found.<br>
<br>
Would it be possible to put the full path of my library when linking in the CMakeLists ?<br>
<br>
Thank you.<br>
-Laurent<br>
<br>
<br>
<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>[]s<br><br>Relax, it's only ONES and ZEROS!!!!<br><br>Felipe Menezes Machado<br>Mestre em Ciência da Computação - DCC - UFMG
</div>