CMake (macOS): force dlopen searching for /usr/local/lib

This commit is contained in:
李通洲
2024-02-26 13:35:11 +08:00
parent 609caad02f
commit 743eebaa6b
+2 -2
View File
@@ -724,8 +724,8 @@ if(yyjson_FOUND)
else()
# Used for dlopen finding dylibs installed by homebrew
# `/opt/homebrew/lib` is not on in dlopen search path by default
if(APPLE AND DEFINED ENV{HOMEBREW_PREFIX})
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,$ENV{HOMEBREW_PREFIX}/lib")
if(APPLE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,/opt/homebrew/lib -Wl,-rpath,/usr/local/lib")
endif()
endif()