From f4f1ccb7f72fbfc3b8cdbc4fc8bf65d7b3a8388e Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Thu, 5 Dec 2024 14:57:06 +0800 Subject: [PATCH 1/2] Use clang-only -fobjc-arc flag only with clang --- ext/clip/CMakeLists.txt | 4 +++- lib/tgchat/ext/td/tdnet/CMakeLists.txt | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ext/clip/CMakeLists.txt b/ext/clip/CMakeLists.txt index f9d9ff34..3624d3e2 100644 --- a/ext/clip/CMakeLists.txt +++ b/ext/clip/CMakeLists.txt @@ -24,7 +24,9 @@ if(WIN32) endif() list(APPEND CLIP_SOURCES clip_win.cpp) elseif(APPLE) - add_definitions(-fobjc-arc) + if(CMAKE_C_COMPILER_ID MATCHES "Clang") + add_definitions(-fobjc-arc) + endif() execute_process(COMMAND sw_vers -productVersion OUTPUT_VARIABLE OS_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) if(OS_VERSION VERSION_GREATER_EQUAL "10.10.0") diff --git a/lib/tgchat/ext/td/tdnet/CMakeLists.txt b/lib/tgchat/ext/td/tdnet/CMakeLists.txt index f39c91fa..b2232ed7 100644 --- a/lib/tgchat/ext/td/tdnet/CMakeLists.txt +++ b/lib/tgchat/ext/td/tdnet/CMakeLists.txt @@ -57,7 +57,9 @@ if (APPLE_WATCH) td/net/DarwinHttp.mm td/net/DarwinHttp.h ) - set_source_files_properties(td/net/DarwinHttp.mm PROPERTIES COMPILE_FLAGS -fobjc-arc) + if(CMAKE_C_COMPILER_ID MATCHES "Clang") + set_source_files_properties(td/net/DarwinHttp.mm PROPERTIES COMPILE_FLAGS -fobjc-arc) + endif() endif() add_library(tdnet STATIC ${TDNET_SOURCE}) From c8ddab082c72b525ebc6a36ba48383692a0f082f Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Thu, 5 Dec 2024 15:02:41 +0800 Subject: [PATCH 2/2] fileutil.h: add missing header for ssize_t --- lib/ncutil/src/fileutil.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ncutil/src/fileutil.h b/lib/ncutil/src/fileutil.h index 88e8afd0..b494bbd0 100644 --- a/lib/ncutil/src/fileutil.h +++ b/lib/ncutil/src/fileutil.h @@ -10,6 +10,10 @@ #include #include +#ifdef __APPLE__ +#include // ssize_t +#endif + struct DirEntry { DirEntry()