From ac624427983e7e53d738970211597d0c54588016 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 28 Oct 2025 09:28:23 +0800 Subject: [PATCH] CMake: refines yyjson config and Apple rpath handling Fixes #1998 --- CMakeLists.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 930dd540d..e5eb82c23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1340,15 +1340,15 @@ add_library(libfastfetch OBJECT ) if(yyjson_FOUND) - target_compile_definitions(libfastfetch PUBLIC FF_USE_SYSTEM_YYJSON) + target_compile_definitions(libfastfetch PUBLIC FF_USE_SYSTEM_YYJSON=1) target_link_libraries(libfastfetch PUBLIC yyjson::yyjson) # `target_link_libraries(yyjson::yyjson)` sets rpath implicitly -else() - # Used for dlopen finding dylibs installed by homebrew - # `/opt/homebrew/lib` is not on in dlopen search path by default - if(APPLE) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,/opt/homebrew/lib -Wl,-rpath,/usr/local/lib") - endif() +endif() + +# Used for dlopen finding dylibs installed by homebrew +# `/opt/homebrew/lib` is not on in dlopen search path by default +if(APPLE AND NOT BINARY_LINK_TYPE STREQUAL "dlopen") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,/opt/homebrew/lib -Wl,-rpath,/usr/local/lib") endif() if(ANDROID)