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

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 19 04:56:25 PDT 2024


================
@@ -203,12 +203,23 @@ add_custom_target(generate-cxx-modules
     ${_all_modules}
 )
 
+
+function(make_absolute OUT_VAR INPUT BASE)
+  if (IS_ABSOLUTE ${INPUT})
+    set(${OUT_VAR} "${INPUT}" PARENT_SCOPE)
+  else()
+    set(${OUT_VAR} "${BASE}/${INPUT}" PARENT_SCOPE)
+  endif()
+endfunction()
+
 # 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.
+make_absolute(ABS_LIBRARY_DIR "${LIBCXX_INSTALL_LIBRARY_DIR}" "${CMAKE_INSTALL_PREFIX}")
+make_absolute(ABS_MODULES_DIR "${LIBCXX_INSTALL_MODULES_DIR}" "${CMAKE_INSTALL_PREFIX}")
----------------
mstorsjo wrote:

I wasn't aware of this function, and it retained the old functionality as it was (just concatenating it manually) for non-absolute paths. But I can try to use this instead.

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


More information about the libcxx-commits mailing list