Skip to content

Commit 61570a2

Browse files
committed
cmake: avoid Apple ranlib flags when not using AppleClang
On macOS, `-no_warning_for_no_symbols -c` options are specific to the Apple `ranlib` tool. When using other toolchains (e.g. Homebrew clang), these flags cause errors since `llvm-ranlib` does not recognize them. The patch ensures these flags are only passed when using AppleClang.
1 parent 355ab24 commit 61570a2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,11 @@ endif()
209209
if("${PLATFORM}" STREQUAL "DARWIN")
210210
jerry_add_link_flags(-lSystem)
211211
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Sqc <TARGET> <LINK_FLAGS> <OBJECTS>")
212-
set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
212+
if("${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang")
213+
set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
214+
else()
215+
set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
216+
endif()
213217
set(CMAKE_SHARED_LINKER_FLAGS "-undefined dynamic_lookup")
214218
elseif((NOT CYGWIN AND NOT MINGW AND NOT MSYS) AND (USING_GCC OR USING_CLANG))
215219
jerry_add_link_flags(-Wl,-z,noexecstack)

0 commit comments

Comments
 (0)