[libunwind] r335169 - [CMake] Convert paths to the right form in standalone builds on Windows

Martin Storsjo via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 20 13:53:19 PDT 2018


Author: mstorsjo
Date: Wed Jun 20 13:53:19 2018
New Revision: 335169

URL: http://llvm.org/viewvc/llvm-project?rev=335169&view=rev
Log:
[CMake] Convert paths to the right form in standalone builds on Windows

The paths output from llvm-config --cmakedir and from clang
--print-libgcc-file-name can contain backslashes, while CMake
can't handle the paths in this form.

This matches what compiler-rt already does (since SVN r203789
and r293195).

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

Modified:
    libunwind/trunk/CMakeLists.txt
    libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake

Modified: libunwind/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=335169&r1=335168&r2=335169&view=diff
==============================================================================
--- libunwind/trunk/CMakeLists.txt (original)
+++ libunwind/trunk/CMakeLists.txt Wed Jun 20 13:53:19 2018
@@ -59,10 +59,11 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
       OUTPUT_VARIABLE CONFIG_OUTPUT
       ERROR_QUIET)
     if(NOT HAD_ERROR)
-      string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH)
+      string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG)
+      file(TO_CMAKE_PATH "${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG}" LLVM_CMAKE_PATH)
     else()
-      set(LLVM_CMAKE_PATH
-          "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+      file(TO_CMAKE_PATH "${LLVM_BINARY_DIR}" LLVM_BINARY_DIR_CMAKE_STYLE)
+      set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
     endif()
   else()
     message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not defined. "

Modified: libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake
URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake?rev=335169&r1=335168&r2=335169&view=diff
==============================================================================
--- libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake (original)
+++ libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake Wed Jun 20 13:53:19 2018
@@ -14,6 +14,7 @@ function(find_compiler_rt_library name d
       OUTPUT_VARIABLE LIBRARY_FILE
   )
   string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE)
+  file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE)
   string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}")
   if (NOT HAD_ERROR AND EXISTS "${LIBRARY_FILE}")
     message(STATUS "Found compiler-rt library: ${LIBRARY_FILE}")
@@ -37,6 +38,7 @@ function(find_compiler_rt_dir dest)
         OUTPUT_VARIABLE LIBRARY_DIR
     )
     string(STRIP "${LIBRARY_DIR}" LIBRARY_DIR)
+    file(TO_CMAKE_PATH "${LIBRARY_DIR}" LIBRARY_DIR)
     set(LIBRARY_DIR "${LIBRARY_DIR}/darwin")
   else()
     set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBUNWIND_COMPILE_FLAGS}
@@ -47,6 +49,7 @@ function(find_compiler_rt_dir dest)
         OUTPUT_VARIABLE LIBRARY_FILE
     )
     string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE)
+    file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE)
     get_filename_component(LIBRARY_DIR "${LIBRARY_FILE}" DIRECTORY)
   endif()
   if (NOT HAD_ERROR AND EXISTS "${LIBRARY_DIR}")




More information about the cfe-commits mailing list