llvm.org GIT mirror llvm / 2ec48fc
build: use clang-cl for runtimes when targeting Windows When targeting Windows and building a runtime (subproject) prefer to use `clang-cl` rather than the `clang` driver. This allows us to cross-compile runtimes for the Windows environment from Linux. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361072 91177308-0d34-0410-b5e6-96231b3b80d8 Saleem Abdulrasool 4 months ago
1 changed file(s) with 18 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
103103 endforeach()
104104 endforeach()
105105
106 foreach(arg ${ARG_CMAKE_ARGS})
107 if(arg MATCHES "^-DCMAKE_SYSTEM_NAME=")
108 string(REGEX REPLACE "^-DCMAKE_SYSTEM_NAME=(.*)$" "\\1" _cmake_system_name "${arg}")
109 endif()
110 endforeach()
111
106112 if(ARG_USE_TOOLCHAIN AND NOT CMAKE_CROSSCOMPILING)
107113 if(CLANG_IN_TOOLCHAIN)
108 set(compiler_args -DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
109 -DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++)
114 if(_cmake_system_name STREQUAL Windows)
115 set(compiler_args -DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang-cl
116 -DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang-cl)
117 else()
118 set(compiler_args -DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
119 -DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++)
120 endif()
110121 endif()
111122 if(lld IN_LIST TOOLCHAIN_TOOLS)
112 list(APPEND compiler_args -DCMAKE_LINKER=${LLVM_RUNTIME_OUTPUT_INTDIR}/ld.lld)
123 if(_cmake_system_name STREQUAL Windows)
124 list(APPEND compiler_args -DCMAKE_LINKER=${LLVM_RUNTIME_OUTPUT_INTDIR}/lld-link)
125 else()
126 list(APPEND compiler_args -DCMAKE_LINKER=${LLVM_RUNTIME_OUTPUT_INTDIR}/ld.lld)
127 endif()
113128 endif()
114129 if(llvm-ar IN_LIST TOOLCHAIN_TOOLS)
115130 list(APPEND compiler_args -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar)