From fbcf503b7872ac0ef5914f5e60fe3dcae5525d4f Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Wed, 14 Feb 2024 16:30:53 +0100 Subject: CMake: Rewrite commands which are always executed Some commands were always executed and caused some things to be rebuild or copied, although there was no need for it. Pick-to: 6.7 Change-Id: I5743bfe540cf67d4df661f7f7a5324f30bed8c93 Reviewed-by: Robert Griebl --- src/tools/ifcodegen/CMakeLists.txt | 6 +++++- tests/auto/core/ifcodegen/flat-cmake-hierarchy-test/CMakeLists.txt | 4 +++- tests/auto/core/ifcodegen/include-test/test/CMakeLists.txt | 4 +++- .../auto/core/ifcodegen/org-example-echo-noanno/test/CMakeLists.txt | 4 +++- .../core/ifcodegen/org-example-echo-noprivate/test/CMakeLists.txt | 4 +++- tests/auto/core/ifcodegen/org-example-echo/test/CMakeLists.txt | 4 +++- 6 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/tools/ifcodegen/CMakeLists.txt b/src/tools/ifcodegen/CMakeLists.txt index c9a4b9c2..82fa7edb 100644 --- a/src/tools/ifcodegen/CMakeLists.txt +++ b/src/tools/ifcodegen/CMakeLists.txt @@ -255,10 +255,14 @@ elseif(QT_FEATURE_python3_virtualenv AND NOT QT_FEATURE_system_qface) DESTINATION "${ifcodegen_install_dir}" ) else() - add_custom_target(copy_virtualenv + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/.stamp-copy_virtualenv COMMAND ${CMAKE_COMMAND} -E copy_directory ${VIRTUALENV_PATH} "${ifcodegen_install_dir}/${VIRTUALENV_NAME}" + COMMAND ${CMAKE_COMMAND} -E touch .stamp-copy_virtualenv DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/.stamp-deploy_virtualenv ) + add_custom_target(copy_virtualenv ALL + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/.stamp-copy_virtualenv + ) add_dependencies(ifcodegen copy_virtualenv) endif() endif() diff --git a/tests/auto/core/ifcodegen/flat-cmake-hierarchy-test/CMakeLists.txt b/tests/auto/core/ifcodegen/flat-cmake-hierarchy-test/CMakeLists.txt index daeb1df6..64fbe818 100644 --- a/tests/auto/core/ifcodegen/flat-cmake-hierarchy-test/CMakeLists.txt +++ b/tests/auto/core/ifcodegen/flat-cmake-hierarchy-test/CMakeLists.txt @@ -33,7 +33,9 @@ target_link_libraries(echo_flat_simulator PUBLIC ####### TEST ####### -file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/cmake_dummy.cpp) +if (NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/cmake_dummy.cpp") + file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/cmake_dummy.cpp) +endif() qt_internal_add_test(tst_flat-cmake-hierarchy SOURCES ${CMAKE_CURRENT_BINARY_DIR}/cmake_dummy.cpp diff --git a/tests/auto/core/ifcodegen/include-test/test/CMakeLists.txt b/tests/auto/core/ifcodegen/include-test/test/CMakeLists.txt index b775d8a3..8019eeab 100644 --- a/tests/auto/core/ifcodegen/include-test/test/CMakeLists.txt +++ b/tests/auto/core/ifcodegen/include-test/test/CMakeLists.txt @@ -4,7 +4,9 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/cmake_dummy.cpp) +if (NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/cmake_dummy.cpp") + file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/cmake_dummy.cpp) +endif() qt_internal_add_test(tst_qface_include SOURCES ${CMAKE_CURRENT_BINARY_DIR}/cmake_dummy.cpp diff --git a/tests/auto/core/ifcodegen/org-example-echo-noanno/test/CMakeLists.txt b/tests/auto/core/ifcodegen/org-example-echo-noanno/test/CMakeLists.txt index 491ddd08..4d2d6771 100644 --- a/tests/auto/core/ifcodegen/org-example-echo-noanno/test/CMakeLists.txt +++ b/tests/auto/core/ifcodegen/org-example-echo-noanno/test/CMakeLists.txt @@ -4,7 +4,9 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/cmake_dummy.cpp) +if (NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/cmake_dummy.cpp") + file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/cmake_dummy.cpp) +endif() qt_internal_add_test(tst_org-example-echo-noanno SOURCES ${CMAKE_CURRENT_BINARY_DIR}/cmake_dummy.cpp diff --git a/tests/auto/core/ifcodegen/org-example-echo-noprivate/test/CMakeLists.txt b/tests/auto/core/ifcodegen/org-example-echo-noprivate/test/CMakeLists.txt index fc7fb80d..40e0df63 100644 --- a/tests/auto/core/ifcodegen/org-example-echo-noprivate/test/CMakeLists.txt +++ b/tests/auto/core/ifcodegen/org-example-echo-noprivate/test/CMakeLists.txt @@ -4,7 +4,9 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/cmake_dummy.cpp) +if (NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/cmake_dummy.cpp") + file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/cmake_dummy.cpp) +endif() qt_internal_add_test(tst_org-example-echo-noprivate SOURCES ${CMAKE_CURRENT_BINARY_DIR}/cmake_dummy.cpp diff --git a/tests/auto/core/ifcodegen/org-example-echo/test/CMakeLists.txt b/tests/auto/core/ifcodegen/org-example-echo/test/CMakeLists.txt index 8590b177..15beba55 100644 --- a/tests/auto/core/ifcodegen/org-example-echo/test/CMakeLists.txt +++ b/tests/auto/core/ifcodegen/org-example-echo/test/CMakeLists.txt @@ -4,7 +4,9 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/cmake_dummy.cpp) +if (NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/cmake_dummy.cpp") + file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/cmake_dummy.cpp) +endif() qt_internal_add_test(tst_org-example-echo SOURCES ${CMAKE_CURRENT_BINARY_DIR}/cmake_dummy.cpp -- cgit v1.2.3