diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt --- a/libcxxabi/CMakeLists.txt +++ b/libcxxabi/CMakeLists.txt @@ -270,6 +270,12 @@ if (LIBCXXABI_HAS_NOSTDINCXX_FLAG) list(APPEND LIBCXXABI_COMPILE_FLAGS -nostdinc++) + # Recent versions of cmake have a behaviour where system include paths are + # detected and removed from user flags. Here we build with -nostdinc++ and + # explictly add libcxx (system) include paths with -I on the command line. + # Setting CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES effecticly prevents cmake + # from removing these. + 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}")