Skip to content

Commit ab87ffe

Browse files
committed
KhronosGroup#2861: If compiling with macOS and GCC, default ENABLE_PCH to false since CMake will generate incompatible Xarch flags for the precompiled headers
1 parent 66ac0df commit ab87ffe

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

CMakeLists.txt

Lines changed: 8 additions & 1 deletion
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)

0 commit comments

Comments
 (0)