diff --git a/Help/variable/CMAKE_LANG_COMPILER_ARCHITECTURE_ID.rst b/Help/variable/CMAKE_LANG_COMPILER_ARCHITECTURE_ID.rst index c6853e3654..0544e12631 100644 --- a/Help/variable/CMAKE_LANG_COMPILER_ARCHITECTURE_ID.rst +++ b/Help/variable/CMAKE_LANG_COMPILER_ARCHITECTURE_ID.rst @@ -6,8 +6,13 @@ CMAKE__COMPILER_ARCHITECTURE_ID :ref:`List ` of identifiers indicating the target architecture(s) of the compiler for language ````. -Typically the list has one entry unless :variable:`CMAKE_OSX_ARCHITECTURES` -lists multiple architectures. +Typically the list has one entry unless the compiler stores multiple +architectures in each object file. For example: + +* The build targets an Apple platform with + :variable:`CMAKE_OSX_ARCHITECTURES` listing multiple architectures. +* The build targets Windows ARM64 with the MSVC ABI using Clang with + the ``-marm64x`` flag. Possible values for each platform are documented in the following sections. diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index a23e8e3460..52dafb9788 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -1139,7 +1139,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) set(PLATFORM_ID "${CMAKE_MATCH_1}") endif() if("${info}" MATCHES "INFO:arch\\[([^]\"]*)\\]") - set(ARCHITECTURE_ID "${CMAKE_MATCH_1}") + list(APPEND ARCHITECTURE_ID "${CMAKE_MATCH_1}") endif() if("${info}" MATCHES "INFO:compiler_version\\[([^]\"]*)\\]") string(REGEX REPLACE "^0+([0-9]+)" "\\1" COMPILER_VERSION "${CMAKE_MATCH_1}") @@ -1225,6 +1225,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) if(COMPILER_ID AND NOT COMPILER_ID_TWICE) set(CMAKE_${lang}_COMPILER_ID "${COMPILER_ID}") set(CMAKE_${lang}_PLATFORM_ID "${PLATFORM_ID}") + list(SORT ARCHITECTURE_ID) set(CMAKE_${lang}_COMPILER_ARCHITECTURE_ID "${ARCHITECTURE_ID}") set(MSVC_${lang}_ARCHITECTURE_ID "${ARCHITECTURE_ID}") set(CMAKE_${lang}_COMPILER_VERSION "${COMPILER_VERSION}")