From 7f0df0821e38e298f377c8f7fa7bbe90bc06ca9c Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 2 Oct 2018 18:17:14 +0100 Subject: [PATCH] On macOS work around broken compilers by disabling inheriting CC & CXX * Normally we want to inherit CC and CXX from the parent process to ensure that the user's choice of compiler is respected. Unfortunately macOS 10.14 starts shipping broken compilers, so inheriting CC & CXX causes the swig compilation to fail. * As a workaround, we just disable this on macOS assuming the user won't ever want to override CC & CXX because it's all locked into XCode anyway. --- qrenderdoc/CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/qrenderdoc/CMakeLists.txt b/qrenderdoc/CMakeLists.txt index 36afa729f..0bc0978a1 100644 --- a/qrenderdoc/CMakeLists.txt +++ b/qrenderdoc/CMakeLists.txt @@ -74,13 +74,22 @@ include(ExternalProject) # Need bison for swig find_package(BISON) +set(SWIG_CONFIGURE_CC ${CMAKE_C_COMPILER}) +set(SWIG_CONFIGURE_CXX ${CMAKE_CXX_COMPILER}) + +# macOS 10.14+ ships broken compilers, need to disable CC/CXX inheritance +if(APPLE) + set(SWIG_CONFIGURE_CC "") + set(SWIG_CONFIGURE_CXX "") +endif() + # Compile our custom SWIG that will do scoped/strong enum classes ExternalProject_Add(custom_swig # using an URL to a zip directly so we don't clone the history etc URL ${RENDERDOC_SWIG_PACKAGE} BUILD_IN_SOURCE 1 CONFIGURE_COMMAND ./autogen.sh > /dev/null 2>&1 - COMMAND CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} CFLAGS=-fPIC CXXFLAGS=-fPIC ./configure --with-pcre=yes --prefix=${CMAKE_BINARY_DIR} > /dev/null + COMMAND CC=${SWIG_CONFIGURE_CC} CXX=${SWIG_CONFIGURE_CXX} CFLAGS=-fPIC CXXFLAGS=-fPIC ./configure --with-pcre=yes --prefix=${CMAKE_BINARY_DIR} > /dev/null BUILD_COMMAND $(MAKE) > /dev/null 2>&1 INSTALL_COMMAND $(MAKE) install > /dev/null 2>&1)