From 743eebaa6bf39117b0f9460c1f8844152125a173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 26 Feb 2024 13:35:11 +0800 Subject: [PATCH] CMake (macOS): force `dlopen` searching for `/usr/local/lib` --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 33292fb32..0706620cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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()