summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2022-03-18 14:29:03 +0100
committerAlexey Edelev <alexey.edelev@qt.io>2022-03-21 12:39:49 +0100
commit68c0e932a5acb7e3fe6dc34540fe4c81770eba88 (patch)
tree5b98a6640435a4e2e13cf92923cdc2779c093598 /cmake
parent83e11b5fc42ef5bbb7d0226c672e83f58021869e (diff)
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>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtPublicCMakeHelpers.cmake14
1 files changed, 14 insertions, 0 deletions
diff --git a/cmake/QtPublicCMakeHelpers.cmake b/cmake/QtPublicCMakeHelpers.cmake
index 86b8edacd4..35cd4fe1f3 100644
--- a/cmake/QtPublicCMakeHelpers.cmake
+++ b/cmake/QtPublicCMakeHelpers.cmake
@@ -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()