Skip to content

Commit

Permalink
Simplified clang detection in ruby for workaround in macos.
Browse files Browse the repository at this point in the history
  • Loading branch information
viferga committed Aug 9, 2022
1 parent 5d6006c commit b10b515
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
9 changes: 3 additions & 6 deletions source/loaders/rb_loader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,11 @@ target_compile_options(${target}

# Fix Ruby MacOSX LLVM bug
# '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes

include(Portability)
if("${PROJECT_OS_FAMILY}" STREQUAL "macos" )
if("${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang*" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
target_compile_options(${target} PRIVATE "-fdeclspec")
endif()
endif()

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

#
# Linker options
Expand Down
9 changes: 3 additions & 6 deletions source/ports/rb_port/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,11 @@ target_compile_options(${SWIG_MODULE_${target}_REAL_NAME}

# Fix Ruby MacOSX LLVM bug
# '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes

include(Portability)
if("${PROJECT_OS_FAMILY}" STREQUAL "macos" )
if("${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang*" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
target_compile_options(${target} PRIVATE "-fdeclspec")
endif()
endif()

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

#
# Linker options
Expand Down

0 comments on commit b10b515

Please sign in to comment.