summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2018-06-07 19:57:43 +0000
committerEric Fiselier <eric@efcs.ca>2018-06-07 19:57:43 +0000
commit14911e8464103ccc8520278933f4c0de60bf5911 (patch)
treed1672a0e9a74772a809a3209b95a7e4fb42bc216 /cmake
parent11fdf14cf25851a162314743777f500ec579ec65 (diff)
[CMake] Fix Libc++ Modules build.
When building the dylib, the C++ headers are fundamentally non-module. They require special versions of the headers in order to provide C++03 and legacy ABI definitions. This causes ODR issues when modules are enabled during both the build and the usage of the libc++ headers. This patch fixes the build error by disabling modules when building the libc++ sources. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334220 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/AddCompilerRT.cmake8
1 files changed, 8 insertions, 0 deletions
diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
index 8338eb340..380a4a372 100644
--- a/cmake/Modules/AddCompilerRT.cmake
+++ b/cmake/Modules/AddCompilerRT.cmake
@@ -537,6 +537,14 @@ macro(add_custom_libcxx name prefix)
string(REPLACE "-Wl,-z,defs" "" LIBCXX_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
string(REPLACE "-Wl,-z,defs" "" LIBCXX_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
+ # The libc++ sources are fundamentally non-modular. They need special
+ # versions of the headers in order to provide C++03 and legacy ABI definitions.
+ # NOTE: The public headers can be used with modules in all other contexts
+ if (LLVM_ENABLE_MODULES)
+ set(LIBCXX_CXX_FLAGS "${LIBCXX_CXX_FLAGS} -Wno-unused-command-line-argument")
+ set(LIBCXX_CXX_FLAGS "${LIBCXX_CXX_FLAGS} -fno-modules")
+ endif()
+
ExternalProject_Add(${name}
DEPENDS ${name}-clobber ${LIBCXX_DEPS}
PREFIX ${prefix}