[libcxx-commits] [PATCH] D158924: [libc++][C++20 modules] Fixes CMake include paths.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Aug 26 03:03:57 PDT 2023


Mordante created this revision.
Herald added a project: All.
Mordante requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158924

Files:
  libcxx/modules/CMakeLists.txt
  libcxx/modules/CMakeLists.txt.in


Index: libcxx/modules/CMakeLists.txt.in
===================================================================
--- libcxx/modules/CMakeLists.txt.in
+++ libcxx/modules/CMakeLists.txt.in
@@ -40,7 +40,7 @@
 )
 
 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
Index: libcxx/modules/CMakeLists.txt
===================================================================
--- libcxx/modules/CMakeLists.txt
+++ libcxx/modules/CMakeLists.txt
@@ -122,7 +122,16 @@
 # 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"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158924.553713.patch
Type: text/x-patch
Size: 1527 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230826/0c95815a/attachment.bin>


More information about the libcxx-commits mailing list