Skip to content

Commit b4e5f01

Browse files
committedAug 7, 2019
Append an executable suffix to the toolchain tool paths on Windows platform.
Append a default CMake suffix (CMAKE_EXECUTABLE_SUFFIX) for the build host to the toolchain tool path when adding a LLVM external project. The tool binary files should contain .exe suffix to run them properly on Windows platform when building the projects. Patch by Vlad Vereschaka. Differential Revision: https://reviews.llvm.org/D65824 llvm-svn: 368121
1 parent f558950 commit b4e5f01

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed
 

Diff for: ‎llvm/cmake/modules/LLVMExternalProjectUtils.cmake

+12-12
Original file line numberDiff line numberDiff line change
@@ -113,37 +113,37 @@ function(llvm_ExternalProject_Add name source_dir)
113113
if(ARG_USE_TOOLCHAIN AND NOT CMAKE_CROSSCOMPILING)
114114
if(CLANG_IN_TOOLCHAIN)
115115
if(_cmake_system_name STREQUAL Windows)
116-
set(compiler_args -DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang-cl
117-
-DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang-cl)
116+
set(compiler_args -DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang-cl${CMAKE_EXECUTABLE_SUFFIX}
117+
-DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang-cl${CMAKE_EXECUTABLE_SUFFIX})
118118
else()
119-
set(compiler_args -DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
120-
-DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++)
119+
set(compiler_args -DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang${CMAKE_EXECUTABLE_SUFFIX}
120+
-DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++${CMAKE_EXECUTABLE_SUFFIX})
121121
endif()
122122
endif()
123123
if(lld IN_LIST TOOLCHAIN_TOOLS)
124124
if(_cmake_system_name STREQUAL Windows)
125-
list(APPEND compiler_args -DCMAKE_LINKER=${LLVM_RUNTIME_OUTPUT_INTDIR}/lld-link)
125+
list(APPEND compiler_args -DCMAKE_LINKER=${LLVM_RUNTIME_OUTPUT_INTDIR}/lld-link${CMAKE_EXECUTABLE_SUFFIX})
126126
else()
127-
list(APPEND compiler_args -DCMAKE_LINKER=${LLVM_RUNTIME_OUTPUT_INTDIR}/ld.lld)
127+
list(APPEND compiler_args -DCMAKE_LINKER=${LLVM_RUNTIME_OUTPUT_INTDIR}/ld.lld${CMAKE_EXECUTABLE_SUFFIX})
128128
endif()
129129
endif()
130130
if(llvm-ar IN_LIST TOOLCHAIN_TOOLS)
131-
list(APPEND compiler_args -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar)
131+
list(APPEND compiler_args -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar${CMAKE_EXECUTABLE_SUFFIX})
132132
endif()
133133
if(llvm-ranlib IN_LIST TOOLCHAIN_TOOLS)
134-
list(APPEND compiler_args -DCMAKE_RANLIB=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ranlib)
134+
list(APPEND compiler_args -DCMAKE_RANLIB=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ranlib${CMAKE_EXECUTABLE_SUFFIX})
135135
endif()
136136
if(llvm-nm IN_LIST TOOLCHAIN_TOOLS)
137-
list(APPEND compiler_args -DCMAKE_NM=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-nm)
137+
list(APPEND compiler_args -DCMAKE_NM=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-nm${CMAKE_EXECUTABLE_SUFFIX})
138138
endif()
139139
if(llvm-objdump IN_LIST TOOLCHAIN_TOOLS)
140-
list(APPEND compiler_args -DCMAKE_OBJDUMP=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-objdump)
140+
list(APPEND compiler_args -DCMAKE_OBJDUMP=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-objdump${CMAKE_EXECUTABLE_SUFFIX})
141141
endif()
142142
if(llvm-objcopy IN_LIST TOOLCHAIN_TOOLS)
143-
list(APPEND compiler_args -DCMAKE_OBJCOPY=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-objcopy)
143+
list(APPEND compiler_args -DCMAKE_OBJCOPY=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-objcopy${CMAKE_EXECUTABLE_SUFFIX})
144144
endif()
145145
if(llvm-strip IN_LIST TOOLCHAIN_TOOLS AND NOT ARG_STRIP_TOOL)
146-
list(APPEND compiler_args -DCMAKE_STRIP=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-strip)
146+
list(APPEND compiler_args -DCMAKE_STRIP=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-strip${CMAKE_EXECUTABLE_SUFFIX})
147147
endif()
148148
list(APPEND ARG_DEPENDS ${TOOLCHAIN_TOOLS})
149149
endif()

0 commit comments

Comments
 (0)