[libcxx-commits] [libcxxabi] 4230fa9 - [libcxxabi] Prevent cmake from removing our explicit system C++ include paths
Sam Clegg via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Nov 12 10:08:56 PST 2019
Author: Sam Clegg
Date: 2019-11-12T10:08:40-08:00
New Revision: 4230fa939021e7a85f3ec06a4b1d8c661dfe329b
URL: https://github.com/llvm/llvm-project/commit/4230fa939021e7a85f3ec06a4b1d8c661dfe329b
DIFF: https://github.com/llvm/llvm-project/commit/4230fa939021e7a85f3ec06a4b1d8c661dfe329b.diff
LOG: [libcxxabi] Prevent cmake from removing our explicit system C++ include paths
We build with `-nostdinc++` and add our own header path via
`LIBCXXABI_LIBCXX_INCLUDES`. However cmake tried to be clever and if
`LIBCXXABI_LIBCXX_INCLUDES` happens to match the compilers system path
it will remove the `-I` flag meaning we can't access any C++ headers.
Ideally cmake would be able see that we are using `-nostdinc++` and
disable this behaviour.
Differential Revision: https://reviews.llvm.org/D69973
Added:
Modified:
libcxxabi/CMakeLists.txt
Removed:
################################################################################
diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
index fafb77749364..d914b6e02905 100644
--- a/libcxxabi/CMakeLists.txt
+++ b/libcxxabi/CMakeLists.txt
@@ -270,6 +270,13 @@ include(config-ix)
if (LIBCXXABI_HAS_NOSTDINCXX_FLAG)
list(APPEND LIBCXXABI_COMPILE_FLAGS -nostdinc++)
+ # cmake 3.14 and above remove system include paths that are explicitly
+ # passed on the command line. We build with -nostdinc++ and explicitly add
+ # just the libcxx system include paths with -I on the command line.
+ # Setting CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES effectively prevents cmake
+ # from removing these.
+ # See: https://gitlab.kitware.com/cmake/cmake/issues/19227
+ set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "")
# Remove -stdlib flags to prevent them from causing an unused flag warning.
string(REPLACE "-stdlib=libc++" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REPLACE "-stdlib=libstdc++" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
More information about the libcxx-commits
mailing list