[compiler-rt] 7800310 - [CMake][compiler-rt] Replace Windows backslashes with CMake ones

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 4 22:36:18 PST 2020


Author: Petr Hosek
Date: 2020-02-04T22:35:31-08:00
New Revision: 7800310cb50408ba42f5321f7de956fb69a9efda

URL: https://github.com/llvm/llvm-project/commit/7800310cb50408ba42f5321f7de956fb69a9efda
DIFF: https://github.com/llvm/llvm-project/commit/7800310cb50408ba42f5321f7de956fb69a9efda.diff

LOG: [CMake][compiler-rt] Replace Windows backslashes with CMake ones

XRay builds uses llvm-config to obtain the ldflags and libs and then
passes those to CMake. Unfortunately, this breaks on Windows because
CMake tries to interpret backslashes followed by certain characters
as flags. We need to rewrite these into forward slashes that are used
by CMake (even on Windows).

Differential Revision: https://reviews.llvm.org/D73523

Added: 
    

Modified: 
    compiler-rt/cmake/Modules/CompilerRTUtils.cmake

Removed: 
    


################################################################################
diff  --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
index 6e672b1e1818..84f24676bd29 100644
--- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
@@ -248,6 +248,8 @@ macro(load_llvm_config)
       string(REGEX REPLACE "[ \t]*[\r\n]+[ \t]*" ";" CONFIG_OUTPUT ${CONFIG_OUTPUT})
       list(GET CONFIG_OUTPUT 0 LDFLAGS)
       list(GET CONFIG_OUTPUT 1 LIBLIST)
+      file(TO_CMAKE_PATH "${LDFLAGS}" LDFLAGS)
+      file(TO_CMAKE_PATH "${LIBLIST}" LIBLIST)
       set(LLVM_XRAY_LDFLAGS ${LDFLAGS} CACHE STRING "Linker flags for LLVMXRay library")
       set(LLVM_XRAY_LIBLIST ${LIBLIST} CACHE STRING "Library list for LLVMXRay")
       set(COMPILER_RT_HAS_LLVMXRAY TRUE)
@@ -268,6 +270,8 @@ macro(load_llvm_config)
       if (LIBLIST STREQUAL "")
         message(WARNING "testingsupport library not installed, some tests will be skipped")
       else()
+        file(TO_CMAKE_PATH "${LDFLAGS}" LDFLAGS)
+        file(TO_CMAKE_PATH "${LIBLIST}" LIBLIST)
         set(LLVM_TESTINGSUPPORT_LDFLAGS ${LDFLAGS} CACHE STRING "Linker flags for LLVMTestingSupport library")
         set(LLVM_TESTINGSUPPORT_LIBLIST ${LIBLIST} CACHE STRING "Library list for LLVMTestingSupport")
         set(COMPILER_RT_HAS_LLVMTESTINGSUPPORT TRUE)


        


More information about the llvm-commits mailing list