install(IMPORTED_RUNTIME_ARTIFACTS...) does not work on Darwin (OSX)

with this CMake snipped:

install(TARGETS ${PROJECT_NAME} notifier consumer supplier RUNTIME COMPONENT ${PROJECT_NAME})

install(IMPORTED_RUNTIME_ARTIFACTS notifier RUNTIME_DEPENDENCY_SET _dependency_set)

# FIXME:  not supported? CONFLICTING_DEPENDENCIES_PREFIX  _conflicts
# cmake-format: off
install(
  RUNTIME_DEPENDENCY_SET _dependency_set
  POST_EXCLUDE_REGEXES ${CMAKE_SOURCE_DIR}/lib
  POST_EXCLUDE_REGEXES ${CMAKE_SOURCE_DIR}/ACE/ACE/lib
  POST_EXCLUDE_REGEXES ${CMAKE_STAGING_PREFIX}/lib
  RUNTIME DESTINATION lib
)
# cmake-format: on

On Linux I get this result:

klein_cl:~/Workspace/cpp/axcioma$ ldd ${STAGE_DIR}/bin/consumer || objdump --dylibs-used --macho ${STAGE_DIR}/bin/consumer
        linux-vdso.so.1 (0x00007fffc068a000)
        libtaox11_portable_server.so.1.9.0 => /home/klein_cl/Workspace/cpp/axcioma/install/lib/libtaox11_portable_server.so.1.9.0 (0x00007f4b70a54000)
        libtaox11_cosnaming_stub.so.1.9.0 => /home/klein_cl/Workspace/cpp/axcioma/install/lib/libtaox11_cosnaming_stub.so.1.9.0 (0x00007f4b70a2b000)
        libtaox11_anytypecode.so.1.9.0 => /home/klein_cl/Workspace/cpp/axcioma/install/lib/libtaox11_anytypecode.so.1.9.0 (0x00007f4b7091d000)
        libTAO_PortableServer.so.3.1.1 => /home/klein_cl/Workspace/cpp/axcioma/install/lib/libTAO_PortableServer.so.3.1.1 (0x00007f4b70837000)
        libTAO_AnyTypeCode.so.3.1.1 => /home/klein_cl/Workspace/cpp/axcioma/install/lib/libTAO_AnyTypeCode.so.3.1.1 (0x00007f4b70774000)
        libtaox11.so.1.9.0 => /home/klein_cl/Workspace/cpp/axcioma/install/lib/libtaox11.so.1.9.0 (0x00007f4b7070e000)
        libTAO.so.3.1.1 => /home/klein_cl/Workspace/cpp/axcioma/install/lib/libTAO.so.3.1.1 (0x00007f4b70584000)
        libx11_logger.so.1.9.0 => /home/klein_cl/Workspace/cpp/axcioma/install/lib/libx11_logger.so.1.9.0 (0x00007f4b70562000)
        libACE.so.7.1.1 => /home/klein_cl/Workspace/cpp/axcioma/install/lib/libACE.so.7.1.1 (0x00007f4b703aa000)
        libstdc++.so.6 => /home/klein_cl/Workspace/cpp/axcioma/install/lib/libstdc++.so.6 (0x00007f4b70130000)
        libgcc_s.so.1 => /home/klein_cl/Workspace/cpp/axcioma/install/lib/libgcc_s.so.1 (0x00007f4b70100000)
        libc.so.6 => /home/klein_cl/Workspace/cpp/axcioma/install/lib/libc.so.6 (0x00007f4b6ff00000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f4b6fecb000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f4b70b70000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f4b6fec0000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f4b6feb0000)
        libm.so.6 => /home/klein_cl/Workspace/cpp/axcioma/install/lib/libm.so.6 (0x00007f4b6fd61000)
klein_cl:~/Workspace/cpp/axcioma$ find ${STAGE_DIR}/lib -name 'lib*.so*' | egrep -v '(taox11|TAO|ACE)' | xargs ls -l
-rw-r--r-- 1 klein_cl klein_cl 2029592 Apr  7  2022 /home/klein_cl/Workspace/cpp/axcioma/install/lib/libc-2.31.so
lrwxrwxrwx 1 klein_cl klein_cl      12 Sep 20 11:16 /home/klein_cl/Workspace/cpp/axcioma/install/lib/libc.so.6 -> libc-2.31.so
-rw-r--r-- 1 klein_cl klein_cl  146000 Jul 11 10:50 /home/klein_cl/Workspace/cpp/axcioma/install/lib/libgcc_s.so.1
-rw-r--r-- 1 klein_cl klein_cl 1369384 Apr  7  2022 /home/klein_cl/Workspace/cpp/axcioma/install/lib/libm-2.31.so
lrwxrwxrwx 1 klein_cl klein_cl      12 Sep 20 11:16 /home/klein_cl/Workspace/cpp/axcioma/install/lib/libm.so.6 -> libm-2.31.so
lrwxrwxrwx 1 klein_cl klein_cl      19 Sep 20 11:16 /home/klein_cl/Workspace/cpp/axcioma/install/lib/libstdc++.so.6 -> libstdc++.so.6.0.32
-rw-r--r-- 1 klein_cl klein_cl 2526680 Jul 11 10:50 /home/klein_cl/Workspace/cpp/axcioma/install/lib/libstdc++.so.6.0.32
lrwxrwxrwx 1 klein_cl klein_cl      22 Sep 20 11:16 /home/klein_cl/Workspace/cpp/axcioma/install/lib/libx11_logger.so -> libx11_logger.so.1.9.0
-rw-r--r-- 1 klein_cl klein_cl  162160 Sep 15 12:57 /home/klein_cl/Workspace/cpp/axcioma/install/lib/libx11_logger.so.1.9.0
klein_cl:~/Workspace/cpp/axcioma$

On OSX, runtime libs i.e. libc++, ... are NOT installed?

objdump --dylibs-used --macho /Users/clausklein/Workspace/cpp/axcioma/install/bin/consumer
/Users/clausklein/Workspace/cpp/axcioma/install/bin/consumer:
	@rpath/libtaox11_portable_server.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libtaox11_cosnaming_stub.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libtaox11_anytypecode.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libTAO_PortableServer.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libTAO_AnyTypeCode.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libtaox11.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libTAO.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libx11_logger.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libACE.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1600.151.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1336.0.0)

if I set CMAKE_BUILD_WITH_INSTALL_RPATH=ON I get this:

-- Installing: /Users/clausklein/Workspace/cpp/axcioma/install/bin/notifier
-- Installing: /Users/clausklein/Workspace/cpp/axcioma/install/bin/consumer
-- Installing: /Users/clausklein/Workspace/cpp/axcioma/install/bin/supplier
-- Up-to-date: /Users/clausklein/Workspace/cpp/axcioma/install/bin/notifier
CMake Error at _deps/callback_quoter-build/cmake_install.cmake:83 (file):
  file Could not resolve runtime dependencies:

    @rpath/libACE.dylib
    @rpath/libTAO.dylib
    @rpath/libTAO_AnyTypeCode.dylib
    @rpath/libTAO_PortableServer.dylib
    @rpath/libtaox11.dylib
    @rpath/libtaox11_anytypecode.dylib
    @rpath/libtaox11_cosnaming_stub.dylib
    @rpath/libtaox11_portable_server.dylib
    @rpath/libx11_logger.dylib
Call Stack (most recent call first):
  cmake_install.cmake:109 (include)


FAILED: CMakeFiles/install.util 
cd /Users/clausklein/Workspace/cpp/axcioma/build && /usr/local/Cellar/cmake/3.27.5/bin/cmake -P cmake_install.cmake
ninja: build stopped: subcommand failed.
bash-5.2$ objdump --dylibs-used --macho bin/consumer 
bin/consumer:
        @rpath/libtaox11_portable_server.dylib (compatibility version 0.0.0, current version 0.0.0)
        @rpath/libtaox11_cosnaming_stub.dylib (compatibility version 0.0.0, current version 0.0.0)
        @rpath/libtaox11_anytypecode.dylib (compatibility version 0.0.0, current version 0.0.0)
        @rpath/libTAO_PortableServer.dylib (compatibility version 0.0.0, current version 0.0.0)
        @rpath/libTAO_AnyTypeCode.dylib (compatibility version 0.0.0, current version 0.0.0)
        @rpath/libtaox11.dylib (compatibility version 0.0.0, current version 0.0.0)
        @rpath/libTAO.dylib (compatibility version 0.0.0, current version 0.0.0)
        @rpath/libx11_logger.dylib (compatibility version 0.0.0, current version 0.0.0)
        @rpath/libACE.dylib (compatibility version 0.0.0, current version 0.0.0)
        /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1600.151.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1336.0.0)
bash-5.2$ objdump --dylibs-used --macho /Users/clausklein/Workspace/cpp/axcioma/install/bin/consumer
/Users/clausklein/Workspace/cpp/axcioma/install/bin/consumer:
        @rpath/libtaox11_portable_server.dylib (compatibility version 0.0.0, current version 0.0.0)
        @rpath/libtaox11_cosnaming_stub.dylib (compatibility version 0.0.0, current version 0.0.0)
        @rpath/libtaox11_anytypecode.dylib (compatibility version 0.0.0, current version 0.0.0)
        @rpath/libTAO_PortableServer.dylib (compatibility version 0.0.0, current version 0.0.0)
        @rpath/libTAO_AnyTypeCode.dylib (compatibility version 0.0.0, current version 0.0.0)
        @rpath/libtaox11.dylib (compatibility version 0.0.0, current version 0.0.0)
        @rpath/libTAO.dylib (compatibility version 0.0.0, current version 0.0.0)
        @rpath/libx11_logger.dylib (compatibility version 0.0.0, current version 0.0.0)
        @rpath/libACE.dylib (compatibility version 0.0.0, current version 0.0.0)
        /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1600.151.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1336.0.0)
bash-5.2$ 
``

Some notes about the context:

The taox11 libs are build without CMake.

The original Installation is not useable!

I create and install a CMake Interface Library to make them useable

But the libraries are build with rpath?

I’m not sure that the actual problem here is clear to me. What does

mean?

Note that rpaths on macOS do not work like they do on Linux. On Linux, rpath entries are additional directories to look for the libraries needed (typically via their DT_SONAME entry copied at link time) listed in the binary’s DT_NEEDED entries. On macOS, the linked library has a “library id” that is copied into the LC_LOAD_DYLIB load command. If this uses @rpath/, a suitable rpath entry must be used to load the library. Such rpath entries are ignored for those not using @rpath/. CMake does not model rpath usage requirements as of today and by setting CMAKE_BUILD_WITH_INSTALL_RPATH, you are saying “I have set the install rpath appropriately and it is suitable for the build tree as well”. Without this, CMake will generate a sensible rpath entry set for the build tree.

I was wondering on linux also the gcc and c++ libraries are installed , But not on OSX?

I still don’t understand. libc++ and libSystem are listed in the required libraries output you have there.