Skip to content

Commit ff7e9f4

Browse files
authored
fix: compile with correct flags with AppleClang (alibaba#412)
1 parent 2a61bdd commit ff7e9f4

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

cmake_modules/BuildUtils.cmake

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ function(add_paimon_lib LIB_NAME)
9191
add_library(${LIB_NAME}_objlib OBJECT ${ARG_SOURCES})
9292
target_link_libraries(${LIB_NAME}_objlib
9393
PRIVATE "$<BUILD_INTERFACE:paimon_sanitizer_flags>")
94-
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
94+
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL
95+
"Clang")
9596
target_compile_options(${LIB_NAME}_objlib PRIVATE -Wno-global-constructors)
9697
endif()
9798
# Necessary to make static linking into other shared libraries work properly
@@ -337,7 +338,8 @@ function(add_test_case REL_TEST_NAME)
337338
add_dependencies(${TEST_NAME} ${ARG_EXTRA_DEPENDENCIES})
338339
endif()
339340

340-
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
341+
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL
342+
"Clang")
341343
target_compile_options(${TEST_NAME} PRIVATE -Wno-global-constructors)
342344
endif()
343345
target_compile_options(${TEST_NAME} PRIVATE -fno-access-control)
@@ -469,7 +471,8 @@ function(add_benchmark_case REL_BENCHMARK_NAME)
469471
target_include_directories(${BENCHMARK_NAME} SYSTEM PUBLIC ${ARG_EXTRA_INCLUDES})
470472
endif()
471473

472-
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
474+
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL
475+
"Clang")
473476
target_compile_options(${BENCHMARK_NAME} PRIVATE -Wno-global-constructors)
474477
endif()
475478
target_compile_options(${BENCHMARK_NAME} PRIVATE -fno-access-control)

0 commit comments

Comments
 (0)