[libcxx-commits] [libcxx] Reapply [libcxx] [modules] Fix relative paths with absolute LIBCXX_INSTALL_MODULES_DIR (PR #86020)

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 21 05:20:21 PDT 2024


================
@@ -206,9 +206,18 @@ add_custom_target(generate-cxx-modules
 # Configure the modules manifest.
 # Use the relative path between the installation and the module in the json
 # file. This allows moving the entire installation to a different location.
+#
+# Using a trailing slash in BASE_DIRECTORY, to produce a seemingly valid
+# absolute path, even if CMAKE_INSTALL_PREFIX is empty.
+cmake_path(ABSOLUTE_PATH LIBCXX_INSTALL_LIBRARY_DIR
+  BASE_DIRECTORY "${CMAKE_INSTALL_PREFIX}/"
----------------
mstorsjo wrote:

The double slash path here is effectively harmless; after `cmake_path(ABSOLUTE_PATH)`, the output only has a single leading slash even in that case.

But you're right that it's probably nicer to be explicit about this.

https://github.com/llvm/llvm-project/pull/86020


More information about the libcxx-commits mailing list