From 4e4e17fbd2d039adc2105a91d5e467419f83339b Mon Sep 17 00:00:00 2001 From: weedge Date: Mon, 7 Aug 2023 22:24:38 +0800 Subject: [PATCH] fix: support macOS compile Signed-off-by: weedge --- src/CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f6c6c3b..73bdd55 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,5 +6,14 @@ FILE(GLOB_RECURSE SRCS ) add_library(${TARGET} SHARED ${SRCS} ${USRC}) +# OS X 11.x doesn't have /usr/lib/libSystem.dylib and needs an explicit setting. +if ( APPLE AND NOT EXISTS /usr/lib/libSystem.dylib) + message(STATUS "apple...") + set(CMAKE_C_COMPILER /usr/bin/clang) + target_link_libraries(${TARGET} -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib) + target_link_libraries(${TARGET} -lsystem) +endif() + + set_target_properties(${TARGET} PROPERTIES SUFFIX ".so") set_target_properties(${TARGET} PROPERTIES PREFIX "") \ No newline at end of file