Skip to content

Commit c992215

Browse files
committed
[CMake] Deal with CMAKE_SYSTEM_PROCESSOR not matching module triple arch
1 parent 0071efe commit c992215

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,19 @@ if (NOT SWIFT_SUPPORTS_DISABLE_IMPLICIT_STRING_PROCESSING_MODULE_IMPORT)
4545
endif()
4646

4747
# Determine the module triple.
48-
# FIXME: This is a hack. It's all a hack.
48+
# FIXME: This is a hack. It's all a hack. Windows isn't setting
49+
# CMAKE_Swift_COMPILER_TARGET.
4950
if(CMAKE_Swift_COMPILER_TARGET)
5051
string(REGEX REPLACE "macosx[0-9]+([.][0-9]+)?" "macos" SWIFT_MODULE_TRIPLE
5152
${CMAKE_Swift_COMPILER_TARGET})
5253
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
53-
set(SWIFT_MODULE_TRIPLE "${CMAKE_SYSTEM_PROCESSOR}-unknown-windows-msvc")
54+
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")
55+
set(SWIFT_MODULE_TRIPLE "x86_64-unknown-windows-msvc")
56+
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|ARM64|arm64")
57+
set(SWIFT_MODULE_TRIPLE "aarch64-unknown-windows-msvc")
58+
else()
59+
message(FATAL_ERROR "Unrecognized architecture for Windows host")
60+
endif()
5461
endif()
5562

5663
message(STATUS "Module triple: ${SWIFT_MODULE_TRIPLE}")

0 commit comments

Comments
 (0)