[libcxx-commits] [libcxx] 83e0791 - Revert "[CMake][libcxx] Use target_include_directories for libc++ headers"

Petr Hosek via libcxx-commits libcxx-commits at lists.llvm.org
Fri May 6 22:20:29 PDT 2022


Author: Petr Hosek
Date: 2022-05-06T22:20:06-07:00
New Revision: 83e07916ffc55dd85989726f991331c8ad1439d0

URL: https://github.com/llvm/llvm-project/commit/83e07916ffc55dd85989726f991331c8ad1439d0
DIFF: https://github.com/llvm/llvm-project/commit/83e07916ffc55dd85989726f991331c8ad1439d0.diff

LOG: Revert "[CMake][libcxx] Use target_include_directories for libc++ headers"

This reverts commit 203455c85ad03325ce2d77f067f6ac953f2a32ce since
it breaks the OpenMP builders for AMDGPU.

Added: 
    

Modified: 
    libcxx/include/CMakeLists.txt
    runtimes/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 5b04f013c052e..567de13745fac 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -613,8 +613,14 @@ add_custom_target(generate-cxx-headers ALL DEPENDS ${_all_includes})
 
 add_library(cxx-headers INTERFACE)
 add_dependencies(cxx-headers generate-cxx-headers ${LIBCXX_CXX_ABI_HEADER_TARGET})
-target_include_directories(cxx-headers INTERFACE ${LIBCXX_GENERATED_INCLUDE_DIR}
-                                                 ${LIBCXX_GENERATED_INCLUDE_TARGET_DIR})
+# 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()
 
 if (LIBCXX_INSTALL_HEADERS)
   foreach(file ${files})

diff  --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt
index 2d7f853a9ac2b..1783e01142915 100644
--- a/runtimes/CMakeLists.txt
+++ b/runtimes/CMakeLists.txt
@@ -92,17 +92,6 @@ include(LLVMCheckCompilerLinkerFlag)
 include(CheckCCompilerFlag)
 include(CheckCXXCompilerFlag)
 
-# CMake omits default compiler include paths, but in runtimes build, we use
-# -nostdinc and -nostdinc++ and control include paths manually so this behavior
-# is undesirable. Resetting CMAKE_{LANG}_IMPLICIT_INCLUDE_DIRECTORIES disables
-# this behavior. See https://gitlab.kitware.com/cmake/cmake/-/issues/19227 for
-# further details no this topic.
-#
-# TODO: We may want to consider filtering out only the paths that are within
-# the toolchain installation and leaving the system paths.
-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)


        


More information about the libcxx-commits mailing list