[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/D48356

llvm-svn: 335172
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 11b02759a342ea04709d509b6231d318d551f319
diff --git a/cmake/Modules/HandleCompilerRT.cmake b/cmake/Modules/HandleCompilerRT.cmake
index e9da3c4..2e0e69e 100644
--- a/cmake/Modules/HandleCompilerRT.cmake
+++ b/cmake/Modules/HandleCompilerRT.cmake
@@ -14,6 +14,7 @@
       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 @@
         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} ${LIBCXX_COMPILE_FLAGS}
@@ -47,6 +49,7 @@
         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}")