diff options
author | Dominik Holland <dominik.holland@qt.io> | 2024-02-14 16:30:53 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2024-02-15 10:56:32 +0000 |
commit | 04b8455df29eff0337ff1c601f22f1051ad94f7f (patch) | |
tree | c8225f5550af4780a5700d78b4aed7ff42ee1db7 | |
parent | e7b6fab4743cfec4734fa53207ef878906e11aee (diff) |
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.
Change-Id: I5743bfe540cf67d4df661f7f7a5324f30bed8c93
Reviewed-by: Robert Griebl <robert.griebl@qt.io>
(cherry picked from commit fbcf503b7872ac0ef5914f5e60fe3dcae5525d4f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
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 |