As far as I am aware, the macOS linker simply records the install name
of the dynamic library you link against in your executable (similar to
how the Linux linker records the Elf SONAME, if present). So, the first
step would be to check the install name of the external dynamic library
by running 'otool -L' on it (the install name should be at the top of
the output). You can change the install name using the install_name_tool
(but if you build the external dynamic library yourself I think it is
better to build the library with the correct install name in the first
place).
Am 24.09.19 um 18:02 schrieb Michael Welsh Duggan:
I have a project that links against an external dynamic library for
which I have written a Find module that creates an import target. I do
this, in part, by setting the IMPORTED_LOCATION property of the target
to the location of the dynamic library.
Unfortunately, on OSX the library shows up in the executable load
commands as an LC_LOAD_DYLIB of the raw filename (no directory) of the
shared library. I expected it to use the whole path. I tried setting
the INSTALL_NAME_DIR property to the directory containing the shared
library, but this changed nothing.
I will note that this is all still in the build location, as opposed to
post-install. I am using the following settings currently:
set(CMAKE_SKIP_BUILD_RPATH false)
set(CMAKE_BUILD_WITH_INSTALL_RPATH false)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH true)
set(CMAKE_MACOSX_RPATH true)
I'm not 100% confident with how these options interact, so I am more
than prepared for someone to tell me that I am doing something wrong.
Any hints would be appreciated.
--
*Dr. Eric Dönges*
Senior Software Engineer
MVTec Software GmbH | Arnulfstr. 205 | 80634 Munich | Germany
doen...@mvtec.com <mailto:musterm...@mvtec.com> | Tel: +49 89 457 695-0
| www.mvtec.com <http://www.mvtec.com>
Find our privacy policy here <https://www.mvtec.com/imprint>.
Sign up <https://www.mvtec.com/newsletter> for our MVTec Newsletter!
Geschäftsführer: Dr. Wolfgang Eckstein, Dr. Olaf Munkelt
Amtsgericht München HRB 114695
MVTec Software GmbH Logo
--
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:
https://cmake.org/mailman/listinfo/cmake