File tree Expand file tree Collapse file tree 3 files changed +33
-5
lines changed
compiler-rt/cmake/Modules Expand file tree Collapse file tree 3 files changed +33
-5
lines changed Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ if(WIN32 OR LLVM_WINSYSROOT)
141
141
set (RUNTIMES_${target}_CMAKE_MODULE_LINKER_FLAGS ${WINDOWS_LINK_FLAGS} CACHE STRING "" )
142
142
endif ()
143
143
144
- foreach (target aarch64-unknown- linux-gnu;armv7-unknown- linux-gnueabihf;i386-unknown- linux-gnu;riscv64-unknown- linux-gnu;x86_64-unknown -linux-gnu )
144
+ foreach (target aarch64-linux-gnu;armv7-linux-gnueabihf;i386-linux-gnu;riscv64-linux-gnu;x86_64-linux-gnu )
145
145
if (LINUX_${target}_SYSROOT )
146
146
# Set the per-target builtins options.
147
147
list (APPEND BUILTIN_TARGETS "${target} " )
Original file line number Diff line number Diff line change @@ -368,14 +368,23 @@ macro(construct_compiler_rt_default_triple)
368
368
"Default triple for which compiler-rt runtimes will be built." )
369
369
endif ()
370
370
371
- if ( " ${ CMAKE_C_COMPILER_ID} " MATCHES "Clang" )
371
+ if ( CMAKE_C_COMPILER_ID MATCHES "Clang" )
372
372
set (option_prefix "" )
373
373
if (CMAKE_C_SIMULATE_ID MATCHES "MSVC" )
374
374
set (option_prefix "/clang:" )
375
375
endif ()
376
- execute_process (COMMAND ${CMAKE_C_COMPILER} ${option_prefix} --target=${COMPILER_RT_DEFAULT_TARGET_TRIPLE} ${option_prefix} -print-target-triple
377
- OUTPUT_VARIABLE COMPILER_RT_DEFAULT_TARGET_TRIPLE
378
- OUTPUT_STRIP_TRAILING_WHITESPACE )
376
+ set (print_target_triple ${CMAKE_C_COMPILER} ${option_prefix} --target=${COMPILER_RT_DEFAULT_TARGET_TRIPLE} ${option_prefix} -print-target-triple )
377
+ execute_process (COMMAND ${print_target_triple}
378
+ RESULT_VARIABLE result
379
+ OUTPUT_VARIABLE output
380
+ OUTPUT_STRIP_TRAILING_WHITESPACE )
381
+ if (result EQUAL 0 )
382
+ set (COMPILER_RT_DEFAULT_TARGET_TRIPLE ${output} )
383
+ else ()
384
+ string (REPLACE ";" " " print_target_triple "${print_target_triple} " )
385
+ # TODO(#97876): Report an error.
386
+ message (WARNING "Failed to execute `${print_target_triple} ` to normalize target triple." )
387
+ endif ()
379
388
endif ()
380
389
381
390
string (REPLACE "-" ";" LLVM_TARGET_TRIPLE_LIST ${COMPILER_RT_DEFAULT_TARGET_TRIPLE} )
Original file line number Diff line number Diff line change @@ -183,6 +183,25 @@ message(STATUS "LLVM default target triple: ${LLVM_DEFAULT_TARGET_TRIPLE}")
183
183
184
184
set (LLVM_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE} " )
185
185
186
+ if (CMAKE_C_COMPILER_ID MATCHES "Clang" )
187
+ set (option_prefix "" )
188
+ if (CMAKE_C_SIMULATE_ID MATCHES "MSVC" )
189
+ set (option_prefix "/clang:" )
190
+ endif ()
191
+ set (print_target_triple ${CMAKE_C_COMPILER} ${option_prefix} --target=${LLVM_DEFAULT_TARGET_TRIPLE} ${option_prefix} -print-target-triple )
192
+ execute_process (COMMAND ${print_target_triple}
193
+ RESULT_VARIABLE result
194
+ OUTPUT_VARIABLE output
195
+ OUTPUT_STRIP_TRAILING_WHITESPACE )
196
+ if (result EQUAL 0 )
197
+ set (LLVM_DEFAULT_TARGET_TRIPLE ${output} )
198
+ else ()
199
+ string (REPLACE ";" " " print_target_triple "${print_target_triple} " )
200
+ # TODO(#97876): Report an error.
201
+ message (WARNING "Failed to execute `${print_target_triple} ` to normalize target triple." )
202
+ endif ()
203
+ endif ()
204
+
186
205
option (LLVM_INCLUDE_TESTS "Generate build targets for the runtimes unit tests." ON )
187
206
option (LLVM_INCLUDE_DOCS "Generate build targets for the runtimes documentation." ON )
188
207
option (LLVM_ENABLE_SPHINX "Use Sphinx to generate the runtimes documentation." OFF )
You can’t perform that action at this time.
0 commit comments