diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt --- a/libcxx/include/CMakeLists.txt +++ b/libcxx/include/CMakeLists.txt @@ -577,14 +577,8 @@ add_library(cxx-headers INTERFACE) add_dependencies(cxx-headers generate-cxx-headers ${LIBCXX_CXX_ABI_HEADER_TARGET}) -# TODO: Use target_include_directories once we figure out why that breaks the runtimes build -if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC") - target_compile_options(cxx-headers INTERFACE /I${LIBCXX_GENERATED_INCLUDE_DIR} - INTERFACE /I${LIBCXX_GENERATED_INCLUDE_TARGET_DIR}) -else() - target_compile_options(cxx-headers INTERFACE -I${LIBCXX_GENERATED_INCLUDE_DIR} - INTERFACE -I${LIBCXX_GENERATED_INCLUDE_TARGET_DIR}) -endif() +target_include_directories(cxx-headers INTERFACE ${LIBCXX_GENERATED_INCLUDE_DIR} + ${LIBCXX_GENERATED_INCLUDE_TARGET_DIR}) if (LIBCXX_INSTALL_HEADERS) foreach(file ${files}) diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt --- a/runtimes/CMakeLists.txt +++ b/runtimes/CMakeLists.txt @@ -92,6 +92,10 @@ include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) +# See https://gitlab.kitware.com/cmake/cmake/-/issues/19227 to why this is needed. +set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "") +set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "") +set(CMAKE_ASM_IMPLICIT_INCLUDE_DIRECTORIES "") check_c_compiler_flag("" LLVM_RUNTIMES_LINKING_WORKS) if (NOT LLVM_RUNTIMES_LINKING_WORKS)