From f9d83c47cc23435b5940ba485cf79ea24534ad08 Mon Sep 17 00:00:00 2001 From: Ed Silva Date: Mon, 4 May 2026 12:14:42 -0700 Subject: [PATCH] Set install RPATH on macOS so binaries find libopenscap After `make install`, oscap referenced @rpath/libopenscap..dylib but had no LC_RPATH entries, so dyld failed with "no LC_RPATH's found" unless DYLD_LIBRARY_PATH was set. Add CMAKE_INSTALL_RPATH (@loader_path/../lib plus the absolute install prefix) and CMAKE_INSTALL_NAME_DIR=@rpath so installed binaries resolve the dylib in-place and remain relocatable. Co-Authored-By: Claude Opus 4.7 --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 41b1bb065c..6b7d1288e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -564,6 +564,11 @@ endif() if(APPLE) #full Single Unix Standard v3 (SUSv3) conformance (the Unix API) add_definitions(-D_DARWIN_C_SOURCE) + + # So that installed binaries can find libopenscap.dylib without DYLD_LIBRARY_PATH. + set(CMAKE_MACOSX_RPATH ON) + set(CMAKE_INSTALL_NAME_DIR "@rpath") + set(CMAKE_INSTALL_RPATH "@loader_path/../lib;${CMAKE_INSTALL_PREFIX}/lib") endif() include_directories(