Skip to content

Commit 109b31a

Browse files
authored
Merge pull request KhronosGroup#2862 from n-morales/2861-macos-gcc-build-failures
KhronosGroup#2861 macos gcc build failures
2 parents 57e2519 + ab87ffe commit 109b31a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,14 @@ CMAKE_DEPENDENT_OPTION(ENABLE_HLSL
106106
option(ENABLE_RTTI "Enables RTTI" OFF)
107107
option(ENABLE_EXCEPTIONS "Enables Exceptions" OFF)
108108
option(ENABLE_OPT "Enables spirv-opt capability if present" ON)
109-
option(ENABLE_PCH "Enables Precompiled header" ON)
109+
110+
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND ${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
111+
# Workaround for CMake behavior on Mac OS with gcc, cmake generates -Xarch_* arguments
112+
# which gcc rejects
113+
option(ENABLE_PCH "Enables Precompiled header" OFF)
114+
else()
115+
option(ENABLE_PCH "Enables Precompiled header" ON)
116+
endif()
110117
option(ENABLE_CTEST "Enables testing" ON)
111118

112119
if(ENABLE_GLSLANG_INSTALL AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND WIN32)
@@ -163,7 +170,7 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
163170
add_compile_options(-Werror=deprecated-copy)
164171
endif()
165172

166-
if(NOT CMAKE_VERSION VERSION_LESS "3.13")
173+
if(NOT CMAKE_VERSION VERSION_LESS "3.13" AND NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
167174
# Error if there's symbols that are not found at link time.
168175
# add_link_options() was added in CMake 3.13 - if using an earlier
169176
# version don't set this - it should be caught by presubmits anyway.

0 commit comments

Comments
 (0)