mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 02:39:48 -06:00
ASM: Fix depfile flags for GNU 'as' tool
The GNU `as --help` shows `--MD <file>` as an option to generate depfiles as needed by Ninja. There is no `-MT <target>` flag but fortunately the generated files automatically account for the `-o <obj>` flag. Issue: #20426
This commit is contained in:
@@ -4,3 +4,7 @@ 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>")
|
||||
endif()
|
||||
|
||||
4
Tests/RunCMake/BuildDepends/GNU-AS-stdout.txt
Normal file
4
Tests/RunCMake/BuildDepends/GNU-AS-stdout.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
-- The ASM compiler identification is GNU
|
||||
-- Found assembler: [^
|
||||
]*/as(\.exe)?
|
||||
-- CMAKE_ASM_COMPILER_ID_VENDOR_MATCH='GNU assembler'
|
||||
13
Tests/RunCMake/BuildDepends/GNU-AS.cmake
Normal file
13
Tests/RunCMake/BuildDepends/GNU-AS.cmake
Normal file
@@ -0,0 +1,13 @@
|
||||
enable_language(ASM)
|
||||
|
||||
# Validate undocumented implementation detail.
|
||||
message(STATUS "CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_MATCH='${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_MATCH}'")
|
||||
|
||||
add_library(gnu_as STATIC gnu_as.s)
|
||||
target_include_directories(gnu_as PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT "
|
||||
set(check_pairs
|
||||
\"$<TARGET_FILE:gnu_as>|${CMAKE_CURRENT_BINARY_DIR}/gnu_as.inc\"
|
||||
)
|
||||
")
|
||||
1
Tests/RunCMake/BuildDepends/GNU-AS.step1.cmake
Normal file
1
Tests/RunCMake/BuildDepends/GNU-AS.step1.cmake
Normal file
@@ -0,0 +1 @@
|
||||
file(WRITE "${RunCMake_TEST_BINARY_DIR}/gnu_as.inc" "")
|
||||
1
Tests/RunCMake/BuildDepends/GNU-AS.step2.cmake
Normal file
1
Tests/RunCMake/BuildDepends/GNU-AS.step2.cmake
Normal file
@@ -0,0 +1 @@
|
||||
file(WRITE "${RunCMake_TEST_BINARY_DIR}/gnu_as.inc" "")
|
||||
@@ -103,3 +103,8 @@ endfunction()
|
||||
if(RunCMake_GENERATOR STREQUAL "Xcode")
|
||||
run_ReGeneration(regenerate-project)
|
||||
endif()
|
||||
|
||||
if(CMake_TEST_BuildDepends_GNU_AS)
|
||||
set(ENV{ASM} "${CMake_TEST_BuildDepends_GNU_AS}")
|
||||
run_BuildDepends(GNU-AS)
|
||||
endif()
|
||||
|
||||
1
Tests/RunCMake/BuildDepends/gnu_as.s
Normal file
1
Tests/RunCMake/BuildDepends/gnu_as.s
Normal file
@@ -0,0 +1 @@
|
||||
.include "gnu_as.inc"
|
||||
@@ -169,7 +169,20 @@ if(CMake_TEST_Qt5 AND Qt5Widgets_FOUND)
|
||||
set(autogen_with_qt5 TRUE)
|
||||
endif ()
|
||||
add_RunCMake_test(Autogen -Dwith_qt5=${autogen_with_qt5})
|
||||
add_RunCMake_test(BuildDepends)
|
||||
if(NOT DEFINED CMake_TEST_BuildDepends_GNU_AS
|
||||
AND CMAKE_C_COMPILER_ID STREQUAL "GNU"
|
||||
AND CMAKE_GENERATOR MATCHES "^Ninja"
|
||||
)
|
||||
execute_process(COMMAND "${CMAKE_C_COMPILER}" -print-prog-name=as
|
||||
RESULT_VARIABLE _gnu_res
|
||||
OUTPUT_VARIABLE _gnu_as OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
|
||||
if(_gnu_res EQUAL 0 AND _gnu_as)
|
||||
set(CMake_TEST_BuildDepends_GNU_AS "${_gnu_as}")
|
||||
endif()
|
||||
endif()
|
||||
add_RunCMake_test(BuildDepends
|
||||
-DCMake_TEST_BuildDepends_GNU_AS=${CMake_TEST_BuildDepends_GNU_AS}
|
||||
)
|
||||
if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja")
|
||||
add_RunCMake_test(Byproducts)
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user