[libcxx-commits] [libcxx] 10343c9 - [libc++][C++20 modules] Fixes CMake include paths. (#65079)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Sep 4 11:35:51 PDT 2023
Author: Mark de Wever
Date: 2023-09-04T20:35:46+02:00
New Revision: 10343c910b1d3090edd4810ee36402b5b8242fcf
URL: https://github.com/llvm/llvm-project/commit/10343c910b1d3090edd4810ee36402b5b8242fcf
DIFF: https://github.com/llvm/llvm-project/commit/10343c910b1d3090edd4810ee36402b5b8242fcf.diff
LOG: [libc++][C++20 modules] Fixes CMake include paths. (#65079)
When the modules are used in a bootstrap build the paths
${LIBCXX_GENERATED_INCLUDE_DIR} and
${LIBCXX_GENERATED_INCLUDE_TARGET_DIR} have a different value and both
are needed to build modules.
This issue has been reported on Slack.
Added:
Modified:
libcxx/modules/CMakeLists.txt
libcxx/modules/CMakeLists.txt.in
Removed:
################################################################################
diff --git a/libcxx/modules/CMakeLists.txt b/libcxx/modules/CMakeLists.txt
index 572ee2d3fe2bdd3..338769d64fd40e3 100644
--- a/libcxx/modules/CMakeLists.txt
+++ b/libcxx/modules/CMakeLists.txt
@@ -122,7 +122,16 @@ set(LIBCXX_MODULE_STD_SOURCES
# When that is removed the configured file can use the substitution
# LIBCXX_GENERATED_INCLUDE_TARGET_DIR avoiding this set.
# Also clean up the parts needed to generate the install version.
-set(LIBCXX_CONFIGURED_INCLUDE_DIR ${LIBCXX_GENERATED_INCLUDE_TARGET_DIR})
+# - LIBCXX_GENERATED_INCLUDE_DIR contains the libc++ headers
+# - LIBCXX_GENERATED_INCLUDE_TARGET_DIR contains the libc++ site config
+if ("${LIBCXX_GENERATED_INCLUDE_DIR}" STREQUAL "${LIBCXX_GENERATED_INCLUDE_TARGET_DIR}")
+ # This typically happens when the target is not installed.
+ set(LIBCXX_CONFIGURED_INCLUDE_DIRS "${LIBCXX_GENERATED_INCLUDE_DIR}")
+else()
+ set(LIBCXX_CONFIGURED_INCLUDE_DIRS
+ "${LIBCXX_GENERATED_INCLUDE_DIR};${LIBCXX_GENERATED_INCLUDE_TARGET_DIR}"
+ )
+endif()
configure_file(
"CMakeLists.txt.in"
"${LIBCXX_GENERATED_MODULE_DIR}/CMakeLists.txt"
diff --git a/libcxx/modules/CMakeLists.txt.in b/libcxx/modules/CMakeLists.txt.in
index 1e4b3f9e0d6780b..53b0d7f5f8df50c 100644
--- a/libcxx/modules/CMakeLists.txt.in
+++ b/libcxx/modules/CMakeLists.txt.in
@@ -40,7 +40,7 @@ target_sources(std
)
target_compile_definitions(std PRIVATE _LIBCPP_ENABLE_EXPERIMENTAL)
-target_include_directories(std SYSTEM PRIVATE @LIBCXX_CONFIGURED_INCLUDE_DIR@)
+target_include_directories(std SYSTEM PRIVATE @LIBCXX_CONFIGURED_INCLUDE_DIRS@)
target_compile_options(std
PUBLIC
More information about the libcxx-commits
mailing list