[libcxx-commits] [libcxx] 62bec3d - [libcxx] Fix include directory order (#65859)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Sep 11 09:36:10 PDT 2023
Author: Alex Brachet
Date: 2023-09-11T12:36:06-04:00
New Revision: 62bec3de128d3dda3d400eaf20cfb3ac220e23d1
URL: https://github.com/llvm/llvm-project/commit/62bec3de128d3dda3d400eaf20cfb3ac220e23d1
DIFF: https://github.com/llvm/llvm-project/commit/62bec3de128d3dda3d400eaf20cfb3ac220e23d1.diff
LOG: [libcxx] Fix include directory order (#65859)
It's important that the arch directory be included first so that
its header files which interpose on the default include dir
be included instead of the default ones. The clang driver [1] does
this when not building with -nostdinc, the libcxx build should
do the same.
We found this after https://reviews.llvm.org/D154282 when cross
compiling from non Linux to Linux. If the host machine was not
Linux, _LIBCPP_HAS_NO_TIME_ZONE_DATABASE would be defined in
the default include dir __config_site, while it was undefined
in the arch specific one causing build failures.
Added:
Modified:
libcxx/include/CMakeLists.txt
libcxx/modules/CMakeLists.txt
Removed:
################################################################################
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index d9f6311d9b48eb6..dd00636fcf0b7c5 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -1029,8 +1029,10 @@ add_custom_target(generate-cxx-headers ALL DEPENDS ${_all_includes})
add_library(cxx-headers INTERFACE)
target_link_libraries(cxx-headers INTERFACE libcxx-abi-headers)
add_dependencies(cxx-headers generate-cxx-headers)
-target_include_directories(cxx-headers INTERFACE ${LIBCXX_GENERATED_INCLUDE_DIR}
- ${LIBCXX_GENERATED_INCLUDE_TARGET_DIR})
+# It's important that the arch directory be included first so that its header files
+# which interpose on the default include dir be included instead of the default ones.
+target_include_directories(cxx-headers INTERFACE ${LIBCXX_GENERATED_INCLUDE_TARGET_DIR}
+ ${LIBCXX_GENERATED_INCLUDE_DIR})
if (LIBCXX_INSTALL_HEADERS)
foreach(file ${files})
diff --git a/libcxx/modules/CMakeLists.txt b/libcxx/modules/CMakeLists.txt
index 338769d64fd40e3..395226fb3728700 100644
--- a/libcxx/modules/CMakeLists.txt
+++ b/libcxx/modules/CMakeLists.txt
@@ -128,8 +128,10 @@ if ("${LIBCXX_GENERATED_INCLUDE_DIR}" STREQUAL "${LIBCXX_GENERATED_INCLUDE_TARGE
# This typically happens when the target is not installed.
set(LIBCXX_CONFIGURED_INCLUDE_DIRS "${LIBCXX_GENERATED_INCLUDE_DIR}")
else()
+ # It's important that the arch directory be included first so that its header files
+ # which interpose on the default include dir be included instead of the default ones.
set(LIBCXX_CONFIGURED_INCLUDE_DIRS
- "${LIBCXX_GENERATED_INCLUDE_DIR};${LIBCXX_GENERATED_INCLUDE_TARGET_DIR}"
+ "${LIBCXX_GENERATED_INCLUDE_TARGET_DIR};${LIBCXX_GENERATED_INCLUDE_DIR}"
)
endif()
configure_file(
More information about the libcxx-commits
mailing list