diff options
author | Brad King <brad.king@kitware.com> | 2020-03-16 15:31:16 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-03-16 15:31:25 (GMT) |
commit | eea528fd92a9a448a473ac031f5e7ca3f3ba917f (patch) | |
tree | 8c21fe81db3a1c135518649d26ad64858556330d /Modules | |
parent | 9ad554a1fce78821358d61d8cd010f595b53c098 (diff) | |
parent | 9728839b9e0d9a12f3c70c6f221f3f6482894ce0 (diff) | |
download | CMake-eea528fd92a9a448a473ac031f5e7ca3f3ba917f.zip CMake-eea528fd92a9a448a473ac031f5e7ca3f3ba917f.tar.gz CMake-eea528fd92a9a448a473ac031f5e7ca3f3ba917f.tar.bz2 |
Merge topic 'gnu-as'
9728839b9e ASM: Fix executable link lines with GNU 'as' tool as CMAKE_ASM_COMPILER
5932f0be4f ASM: Fix depfile flags for GNU 'as' tool
0d0aa98c84 ASM: Record vendor-specific output matched to identify assembler
ee3ec27465 CMakeDetermineCompilerId: Set locale to C for vendor output match
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4460
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeASMCompiler.cmake.in | 1 | ||||
-rw-r--r-- | Modules/CMakeDetermineASMCompiler.cmake | 7 | ||||
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 14 | ||||
-rw-r--r-- | Modules/Compiler/GNU-ASM.cmake | 6 |
4 files changed, 28 insertions, 0 deletions
diff --git a/Modules/CMakeASMCompiler.cmake.in b/Modules/CMakeASMCompiler.cmake.in index b8e09fe..858c053 100644 --- a/Modules/CMakeASMCompiler.cmake.in +++ b/Modules/CMakeASMCompiler.cmake.in @@ -10,6 +10,7 @@ set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LOADED 1) set(CMAKE_ASM@ASM_DIALECT@_COMPILER_ID "@_CMAKE_ASM_COMPILER_ID@") set(CMAKE_ASM@ASM_DIALECT@_COMPILER_VERSION "@_CMAKE_ASM_COMPILER_VERSION@") set(CMAKE_ASM@ASM_DIALECT@_COMPILER_ENV_VAR "@_CMAKE_ASM_COMPILER_ENV_VAR@") +@_SET_CMAKE_ASM_COMPILER_ID_VENDOR_MATCH@ @_SET_CMAKE_ASM_COMPILER_ARCHITECTURE_ID@ set(CMAKE_ASM@ASM_DIALECT@_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake index e47f3a4..86fb057 100644 --- a/Modules/CMakeDetermineASMCompiler.cmake +++ b/Modules/CMakeDetermineASMCompiler.cmake @@ -211,6 +211,13 @@ foreach(_var set(_CMAKE_ASM_${_var} "${CMAKE_ASM${ASM_DIALECT}_${_var}}") endforeach() +if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_MATCH) + set(_SET_CMAKE_ASM_COMPILER_ID_VENDOR_MATCH + "set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_MATCH [==[${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_MATCH}]==])") +else() + set(_SET_CMAKE_ASM_COMPILER_ID_VENDOR_MATCH "") +endif() + if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID) set(_SET_CMAKE_ASM_COMPILER_ARCHITECTURE_ID "set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID})") diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index d125791..812f032 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -868,6 +868,14 @@ function(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang userflags) file(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}) endif() + # Save the current LC_ALL, LC_MESSAGES, and LANG environment variables + # and set them to "C" so we get the expected output to match. + set(_orig_lc_all $ENV{LC_ALL}) + set(_orig_lc_messages $ENV{LC_MESSAGES}) + set(_orig_lang $ENV{LANG}) + set(ENV{LC_ALL} C) + set(ENV{LC_MESSAGES} C) + set(ENV{LANG} C) foreach(vendor ${CMAKE_${lang}_COMPILER_ID_VENDORS}) set(flags ${CMAKE_${lang}_COMPILER_ID_VENDOR_FLAGS_${vendor}}) @@ -889,6 +897,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang userflags) "matched \"${regex}\":\n${output}") set(CMAKE_${lang}_COMPILER_ID "${vendor}" PARENT_SCOPE) set(CMAKE_${lang}_COMPILER_ID_OUTPUT "${output}" PARENT_SCOPE) + set(CMAKE_${lang}_COMPILER_ID_VENDOR_MATCH "${CMAKE_MATCH_1}" PARENT_SCOPE) break() else() if("${result}" MATCHES "timeout") @@ -902,6 +911,11 @@ function(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang userflags) endif() endif() endforeach() + + # Restore original LC_ALL, LC_MESSAGES, and LANG + set(ENV{LC_ALL} ${_orig_lc_all}) + set(ENV{LC_MESSAGES} ${_orig_lc_messages}) + set(ENV{LANG} ${_orig_lang}) endfunction() function(CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX lang userflags) diff --git a/Modules/Compiler/GNU-ASM.cmake b/Modules/Compiler/GNU-ASM.cmake index e07401d..4aa680f 100644 --- a/Modules/Compiler/GNU-ASM.cmake +++ b/Modules/Compiler/GNU-ASM.cmake @@ -4,3 +4,9 @@ include(Compiler/GNU) set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S;asm) __compiler_gnu(ASM) + +if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_MATCH STREQUAL "GNU assembler") + set(CMAKE_DEPFILE_FLAGS_ASM${ASM_DIALECT} "--MD <DEPFILE>") + set(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE + "<CMAKE_LINKER> <FLAGS> <CMAKE_ASM${ASM_DIALECT}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") +endif() |