Skip to content

Commit b10b515

Browse files
committed
Simplified clang detection in ruby for workaround in macos.
1 parent 5d6006c commit b10b515

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

source/loaders/rb_loader/CMakeLists.txt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,11 @@ target_compile_options(${target}
190190

191191
# Fix Ruby MacOSX LLVM bug
192192
# '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes
193-
194193
include(Portability)
195-
if("${PROJECT_OS_FAMILY}" STREQUAL "macos" )
196-
if("${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang*" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
197-
target_compile_options(${target} PRIVATE "-fdeclspec")
198-
endif()
199-
endif()
200194

195+
if("${PROJECT_OS_FAMILY}" STREQUAL "macos" AND CMAKE_C_COMPILER_ID MATCHES "Clang")
196+
target_compile_options(${target} PRIVATE "-fdeclspec")
197+
endif()
201198

202199
#
203200
# Linker options

source/ports/rb_port/CMakeLists.txt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,11 @@ target_compile_options(${SWIG_MODULE_${target}_REAL_NAME}
223223

224224
# Fix Ruby MacOSX LLVM bug
225225
# '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes
226-
227226
include(Portability)
228-
if("${PROJECT_OS_FAMILY}" STREQUAL "macos" )
229-
if("${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang*" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
230-
target_compile_options(${target} PRIVATE "-fdeclspec")
231-
endif()
232-
endif()
233227

228+
if("${PROJECT_OS_FAMILY}" STREQUAL "macos" AND CMAKE_C_COMPILER_ID MATCHES "Clang")
229+
target_compile_options(${target} PRIVATE "-fdeclspec")
230+
endif()
234231

235232
#
236233
# Linker options

0 commit comments

Comments
 (0)