https://github.com/tambry created https://github.com/llvm/llvm-project/pull/138524
Some code paths normalize ".." and thus don't create the directory. But some execute in a shell thus requiring the directory to exist to be able to take the parent directory. Normalize all the `TARGET_SUBDIR` variables to avoid this issue. >From 1a2e201b3f4ae437852a83d926799617004b2728 Mon Sep 17 00:00:00 2001 From: Raul Tambre <r...@tambre.ee> Date: Mon, 5 May 2025 15:40:25 +0300 Subject: [PATCH] [cmake] Normalize TARGET_SUBDIR paths Some code paths normalize ".." and thus don't create the directory. But some execute in a shell thus requiring the directory to exist to be able to take the parent directory. Normalize all the `TARGET_SUBDIR` variables to avoid this issue. --- libc/CMakeLists.txt | 1 + libcxx/CMakeLists.txt | 1 + libcxxabi/CMakeLists.txt | 1 + libunwind/CMakeLists.txt | 1 + 4 files changed, 4 insertions(+) diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt index b264dcb4974c7..f21fc2fba7305 100644 --- a/libc/CMakeLists.txt +++ b/libc/CMakeLists.txt @@ -220,6 +220,7 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR) if(LIBC_LIBDIR_SUBDIR) string(APPEND LIBC_TARGET_SUBDIR /${LIBC_LIBDIR_SUBDIR}) endif() + cmake_path(NORMAL_PATH LIBC_TARGET_SUBDIR) endif() if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND (LIBC_ENABLE_USE_BY_CLANG OR LIBC_TARGET_OS_IS_GPU)) diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt index ebaa6e9fd0e97..da059ffef8034 100644 --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -419,6 +419,7 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) if(LIBCXX_LIBDIR_SUBDIR) string(APPEND LIBCXX_TARGET_SUBDIR /${LIBCXX_LIBDIR_SUBDIR}) endif() + cmake_path(NORMAL_PATH LIBCXX_TARGET_SUBDIR) set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LIBCXX_TARGET_SUBDIR}) set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1") set(LIBCXX_GENERATED_MODULE_DIR "${LLVM_BINARY_DIR}/modules/c++/v1") diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt index 6dcfc51e55321..3e2f80b818450 100644 --- a/libcxxabi/CMakeLists.txt +++ b/libcxxabi/CMakeLists.txt @@ -187,6 +187,7 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) if(LIBCXXABI_LIBDIR_SUBDIR) string(APPEND LIBCXXABI_TARGET_SUBDIR /${LIBCXXABI_LIBDIR_SUBDIR}) endif() + cmake_path(NORMAL_PATH LIBCXXABI_TARGET_SUBDIR) set(LIBCXXABI_HEADER_DIR ${LLVM_BINARY_DIR}) set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LIBCXXABI_TARGET_SUBDIR}) set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LIBCXXABI_TARGET_SUBDIR} CACHE STRING diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt index 3c8499fd33464..e27f3c2e2fc17 100644 --- a/libunwind/CMakeLists.txt +++ b/libunwind/CMakeLists.txt @@ -145,6 +145,7 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) if(LIBUNWIND_LIBDIR_SUBDIR) string(APPEND LIBUNWIND_TARGET_SUBDIR /${LIBUNWIND_LIBDIR_SUBDIR}) endif() + cmake_path(NORMAL_PATH LIBUNWIND_TARGET_SUBDIR) set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LIBUNWIND_TARGET_SUBDIR}) set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LIBUNWIND_TARGET_SUBDIR} CACHE STRING "Path where built libunwind libraries should be installed.") _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits