Unify DEPFILE support check
Add common function that unifies the check for the DEPFILE support. Update the check according to the recent CMake version. Task-number: QTBUG-99354 Change-Id: Ia2abf46fe3a9a3d17ea7a37eaf6c9c6a697c5b84 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
83e11b5fc4
commit
68c0e932a5
@ -18,3 +18,17 @@ function(_qt_internal_copy_file_if_different_command out_var src_file dst_file)
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# The function checks if add_custom_command has the support of the DEPFILE argument.
|
||||
function(_qt_internal_check_depfile_support out_var)
|
||||
if(CMAKE_GENERATOR MATCHES "Ninja" OR
|
||||
CMAKE_VERSION VERSION_GREATER_EQUAL 3.20 AND CMAKE_GENERATOR MATCHES "Makefiles"
|
||||
OR CMAKE_VERSION VERSION_GREATER_EQUAL 3.21
|
||||
AND (CMAKE_GENERATOR MATCHES "Xcode"
|
||||
OR CMAKE_GENERATOR MATCHES "Visual Studio ([0-9]+)" AND CMAKE_MATCH_1 GREATER_EQUAL 12))
|
||||
set(${out_var} TRUE)
|
||||
else()
|
||||
set(${out_var} FALSE)
|
||||
endif()
|
||||
set(${out_var} "${${out_var}}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
@ -388,13 +388,7 @@ function(qt6_android_add_apk_target target)
|
||||
list(APPEND extra_args "--verbose")
|
||||
endif()
|
||||
|
||||
# The DEPFILE argument to add_custom_command is only available with Ninja or CMake>=3.20 and
|
||||
# make.
|
||||
set(has_depfile_support FALSE)
|
||||
if(CMAKE_GENERATOR MATCHES "Ninja" OR
|
||||
(CMAKE_VERSION VERSION_GREATER_EQUAL 3.20 AND CMAKE_GENERATOR MATCHES "Makefiles"))
|
||||
set(has_depfile_support TRUE)
|
||||
endif()
|
||||
_qt_internal_check_depfile_support(has_depfile_support)
|
||||
|
||||
if(has_depfile_support)
|
||||
cmake_policy(PUSH)
|
||||
|
Loading…
x
Reference in New Issue
Block a user