summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-06-26 12:40:52 (GMT)
committerKitware Robot <kwrobot@kitware.com>2024-06-26 12:41:02 (GMT)
commit0ffdd6b50fb30e0e203dbfd278665f7cbde6d735 (patch)
treea0592317ef1bfa1ae799a3bd78f6856747db4414
parent1736e377404dcd3d111dbf0cf44d147c7886f94f (diff)
parent6ee5c431d5a7217b12268cc6ccc1ac62625abf4f (diff)
downloadCMake-0ffdd6b50fb30e0e203dbfd278665f7cbde6d735.zip
CMake-0ffdd6b50fb30e0e203dbfd278665f7cbde6d735.tar.gz
CMake-0ffdd6b50fb30e0e203dbfd278665f7cbde6d735.tar.bz2
Merge topic 'orkun_refactor_autogen_tests_21_06_2024'
6ee5c431d5 Autogen: Separate RunCMake.AutogenQtX tests Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Acked-by: alcroito <alexandru.croitor@qt.io> Merge-request: !9620
-rw-r--r--Tests/RunCMake/Autogen/RunCMakeTest.cmake487
-rw-r--r--Tests/RunCMake/Autogen/exe.cpp4
-rw-r--r--Tests/RunCMake/Autogen_1/AutogenSkipLinting-build-stderr.txt (renamed from Tests/RunCMake/Autogen/AutogenSkipLinting-build-stderr.txt)0
-rw-r--r--Tests/RunCMake/Autogen_1/AutogenSkipLinting.cmake (renamed from Tests/RunCMake/Autogen/AutogenSkipLinting.cmake)0
-rw-r--r--Tests/RunCMake/Autogen_1/AutogenUseSystemIncludeCommon.cmake (renamed from Tests/RunCMake/Autogen/AutogenUseSystemIncludeCommon.cmake)0
-rw-r--r--Tests/RunCMake/Autogen_1/AutogenUseSystemIncludeOff.cmake (renamed from Tests/RunCMake/Autogen/AutogenUseSystemIncludeOff.cmake)0
-rw-r--r--Tests/RunCMake/Autogen_1/AutogenUseSystemIncludeOn.cmake (renamed from Tests/RunCMake/Autogen/AutogenUseSystemIncludeOn.cmake)0
-rw-r--r--Tests/RunCMake/Autogen_1/CMP0111-imported-target-full.cmake (renamed from Tests/RunCMake/Autogen/CMP0111-imported-target-full.cmake)0
-rw-r--r--Tests/RunCMake/Autogen_1/CMP0111-imported-target-implib-only.cmake (renamed from Tests/RunCMake/Autogen/CMP0111-imported-target-implib-only.cmake)0
-rw-r--r--Tests/RunCMake/Autogen_1/CMP0111-imported-target-libname.cmake (renamed from Tests/RunCMake/Autogen/CMP0111-imported-target-libname.cmake)0
-rw-r--r--Tests/RunCMake/Autogen_1/CMP0111-imported-target-prelude.cmake (renamed from Tests/RunCMake/Autogen/CMP0111-imported-target-prelude.cmake)0
-rw-r--r--Tests/RunCMake/Autogen_1/CMP0151-common.cmake (renamed from Tests/RunCMake/Autogen/CMP0151-common.cmake)0
-rw-r--r--Tests/RunCMake/Autogen_1/CMP0151-new.cmake (renamed from Tests/RunCMake/Autogen/CMP0151-new.cmake)0
-rw-r--r--Tests/RunCMake/Autogen_1/CMP0151-old.cmake (renamed from Tests/RunCMake/Autogen/CMP0151-old.cmake)0
-rw-r--r--Tests/RunCMake/Autogen_1/CMakeLists.txt (renamed from Tests/RunCMake/Autogen/CMakeLists.txt)0
-rw-r--r--Tests/RunCMake/Autogen_1/Inspect.cmake (renamed from Tests/RunCMake/Autogen/Inspect.cmake)0
-rw-r--r--Tests/RunCMake/Autogen_1/MocGeneratedFile.cmake (renamed from Tests/RunCMake/Autogen/MocGeneratedFile.cmake)0
-rw-r--r--Tests/RunCMake/Autogen_1/MocPredefs-build-stderr.txt (renamed from Tests/RunCMake/Autogen/MocPredefs-build-stderr.txt)0
-rw-r--r--Tests/RunCMake/Autogen_1/MocPredefs-check.cxx (renamed from Tests/RunCMake/Autogen/MocPredefs-check.cxx)0
-rw-r--r--Tests/RunCMake/Autogen_1/MocPredefs-prefix.cmake (renamed from Tests/RunCMake/Autogen/MocPredefs-prefix.cmake)0
-rw-r--r--Tests/RunCMake/Autogen_1/MocPredefs.cmake (renamed from Tests/RunCMake/Autogen/MocPredefs.cmake)0
-rw-r--r--Tests/RunCMake/Autogen_1/MocPredefs.cxx (renamed from Tests/RunCMake/Autogen/MocPredefs.cxx)0
-rw-r--r--Tests/RunCMake/Autogen_1/NoQt-stderr.txt (renamed from Tests/RunCMake/Autogen/NoQt-stderr.txt)0
-rw-r--r--Tests/RunCMake/Autogen_1/NoQt.cmake (renamed from Tests/RunCMake/Autogen/NoQt.cmake)0
-rw-r--r--Tests/RunCMake/Autogen_1/QtInFunction.cmake (renamed from Tests/RunCMake/Autogen/QtInFunction.cmake)0
-rw-r--r--Tests/RunCMake/Autogen_1/QtInFunctionNested-stderr.txt (renamed from Tests/RunCMake/Autogen/QtInFunctionNested-stderr.txt)0
-rw-r--r--Tests/RunCMake/Autogen_1/QtInFunctionNested.cmake (renamed from Tests/RunCMake/Autogen/QtInFunctionNested.cmake)0
-rw-r--r--Tests/RunCMake/Autogen_1/QtInFunctionProperty.cmake (renamed from Tests/RunCMake/Autogen/QtInFunctionProperty.cmake)0
-rw-r--r--Tests/RunCMake/Autogen_1/RunCMakeTest.cmake125
-rw-r--r--Tests/RunCMake/Autogen_1/SkipLinting.cxx (renamed from Tests/RunCMake/Autogen/SkipLinting.cxx)0
-rw-r--r--Tests/RunCMake/Autogen_1/SkipLinting.h (renamed from Tests/RunCMake/Autogen/SkipLinting.h)0
-rw-r--r--Tests/RunCMake/Autogen_1/empty.cpp (renamed from Tests/RunCMake/Autogen/empty.cpp)0
-rw-r--r--Tests/RunCMake/Autogen_2/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/Autogen_2/MyWindow.cpp (renamed from Tests/RunCMake/Autogen/MyWindow.cpp)0
-rw-r--r--Tests/RunCMake/Autogen_2/MyWindow.h (renamed from Tests/RunCMake/Autogen/MyWindow.h)0
-rw-r--r--Tests/RunCMake/Autogen_2/MyWindow.ui (renamed from Tests/RunCMake/Autogen/MyWindow.ui)0
-rw-r--r--Tests/RunCMake/Autogen_2/QtAutoMocDeps-stderr.txt (renamed from Tests/RunCMake/Autogen/QtAutoMocDeps-stderr.txt)0
-rw-r--r--Tests/RunCMake/Autogen_2/QtAutoMocDeps.cmake (renamed from Tests/RunCMake/Autogen/QtAutoMocDeps.cmake)0
-rw-r--r--Tests/RunCMake/Autogen_2/QtSubDir1/CMakeLists.txt (renamed from Tests/RunCMake/Autogen/QtSubDir1/CMakeLists.txt)0
-rw-r--r--Tests/RunCMake/Autogen_2/QtSubDir2/CMakeLists.txt (renamed from Tests/RunCMake/Autogen/QtSubDir2/CMakeLists.txt)0
-rw-r--r--Tests/RunCMake/Autogen_2/QtSubDir3/CMakeLists.txt (renamed from Tests/RunCMake/Autogen/QtSubDir3/CMakeLists.txt)0
-rw-r--r--Tests/RunCMake/Autogen_2/RunCMakeTest.cmake87
-rw-r--r--Tests/RunCMake/Autogen_2/app.cpp (renamed from Tests/RunCMake/Autogen/app.cpp)0
-rw-r--r--Tests/RunCMake/Autogen_2/app_qt.cpp (renamed from Tests/RunCMake/Autogen/app_qt.cpp)0
-rw-r--r--Tests/RunCMake/Autogen_2/simple_lib.cpp (renamed from Tests/RunCMake/Autogen/simple_lib.cpp)0
-rw-r--r--Tests/RunCMake/Autogen_3/AutoMocExecutableConfig.cmake (renamed from Tests/RunCMake/Autogen/AutoMocExecutableConfig.cmake)6
-rw-r--r--Tests/RunCMake/Autogen_3/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/Autogen_3/MocExample.cmake (renamed from Tests/RunCMake/Autogen/MocExample.cmake)2
-rw-r--r--Tests/RunCMake/Autogen_3/RunCMakeTest.cmake11
-rw-r--r--Tests/RunCMake/Autogen_4/AutoUicExecutableConfig.cmake (renamed from Tests/RunCMake/Autogen/AutoUicExecutableConfig.cmake)6
-rw-r--r--Tests/RunCMake/Autogen_4/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/Autogen_4/RunCMakeTest.cmake11
-rw-r--r--Tests/RunCMake/Autogen_4/UicExample.cmake (renamed from Tests/RunCMake/Autogen/UicExample.cmake)0
-rw-r--r--Tests/RunCMake/Autogen_4/example_ui.cpp (renamed from Tests/RunCMake/Autogen/example_ui.cpp)0
-rw-r--r--Tests/RunCMake/Autogen_4/example_ui.h (renamed from Tests/RunCMake/Autogen/example_ui.h)0
-rw-r--r--Tests/RunCMake/Autogen_4/uiA.ui (renamed from Tests/RunCMake/Autogen/uiA.ui)0
-rw-r--r--Tests/RunCMake/Autogen_5/AutoRccExecutableConfig.cmake (renamed from Tests/RunCMake/Autogen/AutoRccExecutableConfig.cmake)6
-rw-r--r--Tests/RunCMake/Autogen_5/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/Autogen_5/RccExample.cmake (renamed from Tests/RunCMake/Autogen/RccExample.cmake)2
-rw-r--r--Tests/RunCMake/Autogen_5/RunCMakeTest.cmake31
-rw-r--r--Tests/RunCMake/Autogen_5/data.qrc (renamed from Tests/RunCMake/Autogen/data.qrc)0
-rw-r--r--Tests/RunCMake/Autogen_common/example.cpp (renamed from Tests/RunCMake/Autogen/example.cpp)0
-rw-r--r--Tests/RunCMake/Autogen_common/example.h (renamed from Tests/RunCMake/Autogen/example.h)0
-rw-r--r--Tests/RunCMake/Autogen_common/exe_common.h (renamed from Tests/RunCMake/Autogen/exe_common.h)0
-rw-r--r--Tests/RunCMake/Autogen_common/exe_debug.cpp (renamed from Tests/RunCMake/Autogen/exe_debug.cpp)0
-rw-r--r--Tests/RunCMake/Autogen_common/exe_release.cpp (renamed from Tests/RunCMake/Autogen/exe_release.cpp)0
-rw-r--r--Tests/RunCMake/Autogen_common/exe_relwithdebinfo.cpp (renamed from Tests/RunCMake/Autogen/exe_relwithdebinfo.cpp)0
-rw-r--r--Tests/RunCMake/Autogen_common/utils.cmake259
-rw-r--r--Tests/RunCMake/CMakeLists.txt39
69 files changed, 570 insertions, 518 deletions
diff --git a/Tests/RunCMake/Autogen/RunCMakeTest.cmake b/Tests/RunCMake/Autogen/RunCMakeTest.cmake
deleted file mode 100644
index 0036551..0000000
--- a/Tests/RunCMake/Autogen/RunCMakeTest.cmake
+++ /dev/null
@@ -1,487 +0,0 @@
-include(RunCMake)
-
-run_cmake(NoQt)
-if (DEFINED with_qt_version)
- set(RunCMake_TEST_OPTIONS
- -Dwith_qt_version=${with_qt_version}
- "-DQt${with_qt_version}_DIR:PATH=${Qt${with_qt_version}_DIR}"
- "-DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH}"
- )
-
- run_cmake(QtInFunction)
- run_cmake(QtInFunctionNested)
- run_cmake(QtInFunctionProperty)
-
- run_cmake(CMP0111-imported-target-full)
- run_cmake(CMP0111-imported-target-libname)
- run_cmake(CMP0111-imported-target-implib-only)
-
- block()
- set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/MocPredefs-build)
- run_cmake(MocPredefs)
- set(RunCMake_TEST_NO_CLEAN 1)
- run_cmake_command(MocPredefs-build ${CMAKE_COMMAND} --build . --config Debug)
- endblock()
-
- # Detect information from the toolchain:
- # - CMAKE_INCLUDE_FLAG_CXX
- # - CMAKE_INCLUDE_SYSTEM_FLAG_CXX
- run_cmake(Inspect)
- include("${RunCMake_BINARY_DIR}/Inspect-build/info.cmake")
-
- if(CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
- if(RunCMake_GENERATOR MATCHES "Visual Studio")
- string(REGEX REPLACE "^-" "/" test_expect_stdout "${CMAKE_INCLUDE_SYSTEM_FLAG_CXX}")
- else()
- set(test_expect_stdout "-*${CMAKE_INCLUDE_SYSTEM_FLAG_CXX}")
- endif()
- string(APPEND test_expect_stdout " *(\"[^\"]*|([^ ]|\\ )*)[\\/]dummy_autogen[\\/]include")
- if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
- string(APPEND test_expect_stdout "_Debug")
- endif()
-
- block()
- set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0151-new-build)
- run_cmake_with_options(CMP0151-new ${RunCMake_TEST_OPTIONS} -DCMAKE_POLICY_DEFAULT_CMP0151=NEW)
- set(RunCMake_TEST_NO_CLEAN 1)
- set(RunCMake_TEST_EXPECT_stdout "${test_expect_stdout}")
- message(STATUS "RunCMake_TEST_EXPECT_stdout: ${RunCMake_TEST_EXPECT_stdout}")
- run_cmake_command(CMP0151-new-build ${CMAKE_COMMAND} --build . --config Debug --verbose)
- endblock()
-
- block()
- set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AutogenUseSystemIncludeOn-build)
- run_cmake_with_options(AutogenUseSystemIncludeOn ${RunCMake_TEST_OPTIONS} -DCMAKE_POLICY_DEFAULT_CMP0151=NEW)
- set(RunCMake_TEST_NO_CLEAN 1)
- set(RunCMake_TEST_EXPECT_stdout "${test_expect_stdout}")
- message(STATUS "RunCMake_TEST_EXPECT_stdout: ${RunCMake_TEST_EXPECT_stdout}")
- run_cmake_command(AutogenUseSystemIncludeOn ${CMAKE_COMMAND} --build . --config Debug --verbose)
- endblock()
- endif()
-
- if(CMAKE_INCLUDE_FLAG_CXX)
- if(RunCMake_GENERATOR MATCHES "Visual Studio")
- string(REGEX REPLACE "^-" "/" test_expect_stdout "${CMAKE_INCLUDE_FLAG_CXX}")
- else()
- set(test_expect_stdout "-*${CMAKE_INCLUDE_FLAG_CXX}")
- endif()
- string(APPEND test_expect_stdout " *(\"[^\"]*|([^ ]|\\ )*)[\\/]dummy_autogen[\\/]include")
- if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
- string(APPEND test_expect_stdout "_Debug")
- endif()
-
- block()
- set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0151-old-build)
- run_cmake_with_options(CMP0151-old ${RunCMake_TEST_OPTIONS} -DCMAKE_POLICY_DEFAULT_CMP0151=OLD)
- set(RunCMake_TEST_NO_CLEAN 1)
- set(RunCMake_TEST_EXPECT_stdout "${test_expect_stdout}")
- message(STATUS "RunCMake_TEST_EXPECT_stdout: ${RunCMake_TEST_EXPECT_stdout}")
- run_cmake_command(CMP0151-old-build ${CMAKE_COMMAND} --build . --config Debug --verbose)
- endblock()
-
- block()
- set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AutogenUseSystemIncludeOff-build)
- run_cmake_with_options(AutogenUseSystemIncludeOff ${RunCMake_TEST_OPTIONS} -DCMAKE_POLICY_DEFAULT_CMP0151=NEW)
- set(RunCMake_TEST_NO_CLEAN 1)
- set(RunCMake_TEST_EXPECT_stdout "${test_expect_stdout}")
- message(STATUS "RunCMake_TEST_EXPECT_stdout: ${RunCMake_TEST_EXPECT_stdout}")
- run_cmake_command(AutogenUseSystemIncludeOff ${CMAKE_COMMAND} --build . --config Debug --verbose)
- endblock()
-
- if(RunCMake_GENERATOR MATCHES "Make|Ninja")
- block()
- set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AutogenSkipLinting-build)
- list(APPEND RunCMake_TEST_OPTIONS
- "-DPSEUDO_CPPCHECK=${PSEUDO_CPPCHECK}"
- "-DPSEUDO_CPPLINT=${PSEUDO_CPPLINT}"
- "-DPSEUDO_IWYU=${PSEUDO_IWYU}"
- "-DPSEUDO_TIDY=${PSEUDO_TIDY}")
-
- run_cmake(AutogenSkipLinting)
- set(RunCMake_TEST_NO_CLEAN 1)
- run_cmake_command(AutogenSkipLinting-build ${CMAKE_COMMAND} --build . --config Debug --verbose)
- endblock()
- endif()
- endif()
-
- if(RunCMake_GENERATOR_IS_MULTI_CONFIG AND NOT RunCMake_GENERATOR MATCHES "Xcode")
- block()
- set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/MocGeneratedFile-build)
- run_cmake(MocGeneratedFile)
- set(RunCMake_TEST_NO_CLEAN 1)
- run_cmake_command(MocGeneratedFile-build ${CMAKE_COMMAND} --build . --config Debug --verbose)
- endblock()
- if(RunCMake_GENERATOR MATCHES "Ninja Multi-Config")
- block()
- set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/MocGeneratedFile-cross-config-build)
- list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_CROSS_CONFIGS=all)
- run_cmake(MocGeneratedFile)
- set(RunCMake_TEST_NO_CLEAN 1)
- run_cmake_command(MocGeneratedFile-cross-config-build ${CMAKE_COMMAND} --build . --config Release --target libgen:Debug)
- run_cmake_command(MocGeneratedFile-cross-config-build ${CMAKE_COMMAND} --build . --config Debug --target libgen:Release)
- endblock()
- endif()
- endif()
-
- if(RunCMake_GENERATOR MATCHES "Make|Ninja")
- block()
- if(QtCore_VERSION VERSION_GREATER_EQUAL 5.15.0)
- if (RunCMake_GENERATOR MATCHES "Ninja Multi-Config")
- set(config_list Debug Release RelWithDebInfo)
- set(use_better_graph_list ON OFF)
- else()
- set(config_list single-config)
- set(use_better_graph_list OFF)
- endif()
-
- foreach(use_better_graph IN ITEMS ${use_better_graph_list})
- foreach(config IN ITEMS ${config_list})
- block()
- if (config STREQUAL "single-config")
- set(config_suffix "")
- else()
- set(config_path "_${config}")
- if (use_better_graph)
- set(config_suffix "_${config}")
- endif()
- endif()
-
- set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/QtAutoMocDeps${config_path}-build)
- run_cmake_with_options(QtAutoMocDeps ${RunCMake_TEST_OPTIONS} -DCMAKE_AUTOGEN_BETTER_GRAPH_MULTI_CONFIG=${use_better_graph})
- set(RunCMake_TEST_NO_CLEAN 1)
- # Build the project.
- if (config STREQUAL "single-config")
- set(config_param "")
- else()
- set(config_param "--config ${config}")
- endif()
- run_cmake_command(QtAutoMocDeps-build ${CMAKE_COMMAND} --build . --verbose ${config_param})
- # Touch just the library source file, which shouldn't cause a rerun of AUTOMOC
- # for app_with_qt target.
- file(TOUCH "${RunCMake_SOURCE_DIR}/simple_lib.cpp")
- set(RunCMake_TEST_NOT_EXPECT_stdout "Automatic MOC for target app_with_qt|\
-Automatic MOC for target sub_exe_1|\
-Automatic MOC for target sub_exe_2")
- set(RunCMake_TEST_VARIANT_DESCRIPTION "-Don't execute AUTOMOC for 'app_with_qt', 'sub_exe_1' and 'sub_exe_2'")
- # Build and assert that AUTOMOC was not run for app_with_qt, sub_exe_1 and sub_exe_2.
- run_cmake_command(QtAutoMocDeps-build ${CMAKE_COMMAND} --build . --verbose ${config_param})
- unset(RunCMake_TEST_VARIANT_DESCRIPTION)
- unset(RunCMake_TEST_NOT_EXPECT_stdout)
-
- macro(check_file_exists file)
- if (EXISTS "${file}")
- set(check_result "PASSED")
- set(message_type "STATUS")
- else()
- set(check_result "FAILED")
- set(message_type "FATAL_ERROR")
- endif()
-
- message(${message_type} "QtAutoMocDeps-build-\"${file}\" was generated - ${check_result}")
- endmacro()
-
- check_file_exists("${RunCMake_TEST_BINARY_DIR}/app_with_qt_autogen/deps${config_suffix}")
- check_file_exists("${RunCMake_TEST_BINARY_DIR}/QtSubDir1/sub_exe_1_autogen/deps${config_suffix}")
- check_file_exists("${RunCMake_TEST_BINARY_DIR}/QtSubDir2/sub_exe_2_autogen/deps${config_suffix}")
-
- check_file_exists("${RunCMake_TEST_BINARY_DIR}/app_with_qt_autogen/timestamp${config_suffix}")
- check_file_exists("${RunCMake_TEST_BINARY_DIR}/QtSubDir1/sub_exe_1_autogen/timestamp${config_suffix}")
- check_file_exists("${RunCMake_TEST_BINARY_DIR}/QtSubDir2/sub_exe_2_autogen/timestamp${config_suffix}")
-
- # Touch a header file to make sure an automoc dependency cycle is not introduced.
- file(TOUCH "${RunCMake_SOURCE_DIR}/MyWindow.h")
- set(RunCMake_TEST_VARIANT_DESCRIPTION "-First build after touch to detect dependency cycle")
- run_cmake_command(QtAutoMocDeps-build ${CMAKE_COMMAND} --build . --verbose)
- # Need to run a second time to hit the dependency cycle.
- set(RunCMake_TEST_VARIANT_DESCRIPTION "-Don't hit dependency cycle")
- run_cmake_command(QtAutoMocDeps-build ${CMAKE_COMMAND} --build . --verbose)
- endblock()
- endforeach()
- endforeach()
- endif()
- endblock()
- endif()
-
- function(run_make_program dir)
- execute_process(
- COMMAND "${RunCMake_MAKE_PROGRAM}" ${ARGN}
- WORKING_DIRECTORY "${dir}"
- OUTPUT_VARIABLE make_program_stdout
- ERROR_VARIABLE make_program_stderr
- RESULT_VARIABLE make_program_result
- )
- if (NOT DEFINED RunMakeProgram_expected_result)
- set(RunMakeProgram_expected_result 0)
- endif()
- if(NOT "${make_program_result}" MATCHES "${RunMakeProgram_expected_result}")
- message(STATUS "
-============ beginning of ${RunCMake_MAKE_PROGRAM}'s stdout ============
-${make_program_stdout}
-=============== end of ${RunCMake_MAKE_PROGRAM}'s stdout ===============
-")
- message(STATUS "
-============ beginning of ${RunCMake_MAKE_PROGRAM}'s stderr ============
-${make_program_stderr}
-=============== end of ${RunCMake_MAKE_PROGRAM}'s stderr ===============
-")
- message(FATAL_ERROR
- "top ${RunCMake_MAKE_PROGRAM} build failed exited with status ${make_program_result}")
- endif()
- set(make_program_stdout "${make_program_stdout}" PARENT_SCOPE)
- endfunction(run_make_program)
-
- function(count_substring STRING SUBSTRING COUNT_VAR)
- string(LENGTH "${STRING}" STRING_LENGTH)
- string(LENGTH "${SUBSTRING}" SUBSTRING_LENGTH)
- if (SUBSTRING_LENGTH EQUAL 0)
- message(FATAL_ERROR "SUBSTRING_LENGTH is 0")
- endif()
-
- if (STRING_LENGTH EQUAL 0)
- message(FATAL_ERROR "STRING_LENGTH is 0")
- endif()
-
- if (STRING_LENGTH LESS SUBSTRING_LENGTH)
- message(FATAL_ERROR "STRING_LENGTH is less than SUBSTRING_LENGTH")
- endif()
-
- set(COUNT 0)
- string(FIND "${STRING}" "${SUBSTRING}" SUBSTRING_START)
- while(SUBSTRING_START GREATER_EQUAL 0)
- math(EXPR COUNT "${COUNT} + 1")
- math(EXPR SUBSTRING_START "${SUBSTRING_START} + ${SUBSTRING_LENGTH}")
- string(SUBSTRING "${STRING}" ${SUBSTRING_START} -1 STRING)
- string(FIND "${STRING}" "${SUBSTRING}" SUBSTRING_START)
- endwhile()
-
- set(${COUNT_VAR} ${COUNT} PARENT_SCOPE)
- endfunction()
-
- function(expect_only_once make_program_stdout expected_output test_name)
- count_substring("${make_program_stdout}" "${expected_output}" count)
- if(NOT count EQUAL 1)
- message(STATUS "${test_name}-expect_only_once - FAILED")
- message(FATAL_ERROR "Expected to find ${expected_output} exactly once in ${make_program_stdout} but found ${count} occurrences of ${expected_output}")
- else()
- message(STATUS "${test_name}-expect_only_once - PASSED")
- endif()
- endfunction()
-
- function(expect_n_times string_to_check expected_output expected_count test_name)
- count_substring("${string_to_check}" "${expected_output}" count)
- if(NOT count EQUAL ${expected_count})
- message(STATUS "${test_name}-expect_${expected_count}_times - FAILED")
- message(FATAL_ERROR "Expected to find ${expected_output} exactly ${expected_count} times in ${string_to_check} but found ${count} occurrences of ${expected_output}")
- else()
- message(STATUS "${test_name}-expect_${expected_count}_times - PASSED")
- endif()
- endfunction()
-
- function(not_expect make_program_stdout unexpected_output test_name)
- count_substring("${make_program_stdout}" "${unexpected_output}" count)
- if(NOT count EQUAL 0)
- message(STATUS "${test_name}-not_expect - FAILED")
- message(FATAL_ERROR "Expected to find ${unexpected_output} exactly 0 times in ${make_program_stdout} but found ${count} occurrences of ${unexpected_output}")
- else()
- message(STATUS "${test_name}-not_expect - PASSED")
- endif()
- endfunction()
-
- if (QtCore_VERSION VERSION_GREATER_EQUAL 5.15.0)
- foreach(exe IN ITEMS Moc Uic Rcc)
- if(RunCMake_GENERATOR MATCHES "Ninja Multi-Config")
- block()
- set(RunCMake_TEST_VARIANT_DESCRIPTION "-CMake-configure")
- set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Auto${exe}ExecutableConfig-multi-config-build)
- run_cmake_with_options(Auto${exe}ExecutableConfig ${RunCMake_TEST_OPTIONS} -DCMAKE_AUTOGEN_VERBOSE=ON -DCMAKE_AUTOGEN_BETTER_GRAPH_MULTI_CONFIG=ON)
- unset(RunCMake_TEST_VARIANT_DESCRIPTION)
- set(RunCMake_TEST_NO_CLEAN 1)
- foreach(config IN ITEMS Debug Release RelWithDebInfo)
- block()
- set(RunCMake_TEST_EXPECT_stdout ".*running_exe_${config}*")
- set(RunCMake_TEST_VARIANT_DESCRIPTION "-${config}-expect_running_exe_${config}")
- run_cmake_command(Auto${exe}ExecutableConfig-multi-config-build ${CMAKE_COMMAND} --build . --config ${config})
- endblock()
- endforeach()
- set(RunCMake_TEST_EXPECT_stdout "ninja: no work to do")
- foreach(config IN ITEMS Debug Release RelWithDebInfo)
- block()
- set(RunCMake_TEST_VARIANT_DESCRIPTION "-${config}-expect_no_work_to_do")
- run_cmake_command(Auto${exe}ExecutableConfig-multi-config-build ${CMAKE_COMMAND} --build . --config ${config})
- endblock()
- endforeach()
- endblock()
- block()
- set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Auto${exe}ExecutableConfig-build)
- run_cmake_with_options(Auto${exe}ExecutableConfig ${RunCMake_TEST_OPTIONS} -DCMAKE_AUTOGEN_VERBOSE=ON -DCMAKE_AUTOGEN_BETTER_GRAPH_MULTI_CONFIG=ON)
- foreach(config IN ITEMS Debug Release RelWithDebInfo)
- block()
- run_make_program(${RunCMake_TEST_BINARY_DIR} --verbose -f build-${config}.ninja)
-
- set(expected_output "running_exe_${config}")
- expect_only_once("${make_program_stdout}" "${expected_output}" "Auto${exe}ExecutableConfig-${config}-${expected_output}")
-
- foreach(sub_config IN ITEMS Debug Release RelWithDebInfo)
- if(NOT sub_config STREQUAL config)
- set(unexpected_output "running_exe_${sub_config}")
- not_expect("${make_program_stdout}" "${unexpected_output}" "Auto${exe}ExecutableConfig-${config}-${unexpected_output}")
- endif()
- endforeach()
-
- if (exe STREQUAL "Moc" OR exe STREQUAL "Uic")
- set(expected_output "cmake_autogen")
- else()
- set(expected_output "cmake_autorcc")
- endif()
- expect_only_once("${make_program_stdout}" "${expected_output}" "Auto${exe}ExecutableConfig-${config}-${expected_output}")
- endblock()
- endforeach()
- endblock()
- block()
- foreach(ninja_config IN ITEMS Debug Release RelWithDebInfo)
- foreach(target_config IN ITEMS Debug Release RelWithDebInfo)
- block()
- set(TEST_SUFFIX "-CrossConfig-${ninja_config}-${target_config}")
- set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Auto${exe}ExecutableConfig${TEST_SUFFIX}-build)
- set(RunCMake_TEST_VARIANT_DESCRIPTION ${TEST_SUFFIX})
- run_cmake_with_options(Auto${exe}ExecutableConfig ${RunCMake_TEST_OPTIONS} -DCMAKE_CROSS_CONFIGS=all -DCMAKE_DEFAULT_BUILD_TYPE=${ninja_config} -DCMAKE_AUTOGEN_BETTER_GRAPH_MULTI_CONFIG=ON)
- unset(RunCMake_TEST_VARIANT_DESCRIPTION)
-
- run_make_program(${RunCMake_TEST_BINARY_DIR} --verbose -f build-${ninja_config}.ninja dummy:${target_config})
-
- set(expected_output "running_exe_${ninja_config}")
- expect_only_once("${make_program_stdout}" "${expected_output}" "Auto${exe}ExecutableConfig${TEST_SUFFIX}-${expected_output}")
-
- foreach(sub_config IN ITEMS Debug Release RelWithDebInfo)
- if(NOT sub_config STREQUAL ninja_config)
- set(unexpected_output "running_exe_${sub_config}")
- not_expect("${make_program_stdout}" "${unexpected_output}" "Auto${exe}ExecutableConfig${TEST_SUFFIX}-${unexpected_output}")
- endif()
- endforeach()
-
- if (exe STREQUAL "Moc" OR exe STREQUAL "Uic")
- set(expected_output "cmake_autogen")
- else()
- set(expected_output "cmake_autorcc")
- endif()
- expect_only_once("${make_program_stdout}" "${expected_output}" "Auto${exe}ExecutableConfig${TEST_SUFFIX}-${expected_output}")
- endblock()
- endforeach()
- endforeach()
- endblock()
- block()
- foreach(ninja_config IN ITEMS Debug Release RelWithDebInfo)
- set(TEST_SUFFIX "-CrossConfig-${ninja_config}-all-all")
- set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Auto${exe}ExecutableConfig${TEST_SUFFIX}-build)
- set(RunCMake_TEST_VARIANT_DESCRIPTION ${TEST_SUFFIX})
- run_cmake_with_options(Auto${exe}ExecutableConfig ${RunCMake_TEST_OPTIONS} -DCMAKE_CROSS_CONFIGS=all -DCMAKE_AUTOGEN_BETTER_GRAPH_MULTI_CONFIG=ON)
- unset(RunCMake_TEST_VARIANT_DESCRIPTION)
- run_make_program(${RunCMake_TEST_BINARY_DIR} --verbose -f build-${ninja_config}.ninja all:all)
- endforeach()
- endblock()
- elseif (RunCMake_GENERATOR MATCHES "Ninja|Make")
- block()
- set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Auto${exe}ExecutableConfig-build)
- foreach(config IN ITEMS Debug Release RelWithDebInfo)
- block()
- set(RunCMake_TEST_VARIANT_DESCRIPTION "-${config}")
- run_cmake_with_options(Auto${exe}ExecutableConfig ${RunCMake_TEST_OPTIONS} -DCMAKE_BUILD_TYPE=${config} -DCMAKE_AUTOGEN_VERBOSE=ON)
- unset(RunCMake_TEST_VARIANT_DESCRIPTION)
- set(RunCMake_TEST_NO_CLEAN 1)
- set(RunCMake_TEST_EXPECT_stdout ".*running_exe_${config}*")
- run_cmake_command(Auto${exe}ExecutableConfig-${config}-build ${CMAKE_COMMAND} --build .)
- endblock()
- endforeach()
- endblock()
- endif()
- endforeach()
- endif()
-
- # Visual Studio specific dependency tests
- if (RunCMake_GENERATOR MATCHES "Visual Studio")
- foreach(exe IN ITEMS Moc Uic Rcc)
- block()
- set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${exe}Example-build)
- set(RunCMake_TEST_VARIANT_DESCRIPTION "-CMake-configure")
- run_cmake_with_options(${exe}Example ${RunCMake_TEST_OPTIONS} -DCMAKE_AUTOGEN_VERBOSE=ON)
- unset(RunCMake_TEST_VARIANT_DESCRIPTION)
- set(RunCMake_TEST_NO_CLEAN 1)
- foreach(config IN ITEMS Debug Release RelWithDebInfo)
- block()
- set(RunCMake_TEST_VARIANT_DESCRIPTION "-${config}-first-build")
- run_cmake_command(${exe}Example-build ${CMAKE_COMMAND} --build . --config ${config})
- endblock()
- endforeach()
- foreach(config IN ITEMS Debug Release RelWithDebInfo)
- block()
- if (exe STREQUAL "Moc" OR exe STREQUAL "Uic")
- set(RunCMake_TEST_NOT_EXPECT_stdout "Auto${exe}")
- set(not_expect_descripton "Auto${exe}")
- else ()
- set(RunCMake_TEST_NOT_EXPECT_stdout "Auto${exe}")
- set(not_expect_descripton "Auto${exe}")
- endif()
- set(RunCMake_TEST_VARIANT_DESCRIPTION "-second-build-${config}_expect_no_${not_expect_descripton}")
- run_cmake_command(${exe}Example-build ${CMAKE_COMMAND} --build . --config ${config})
- endblock()
- endforeach()
- endblock()
- endforeach()
- endif()
-
- if (RunCMake_GENERATOR MATCHES "Xcode")
- foreach(exe IN ITEMS Moc Uic Rcc)
- block()
- set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${exe}Example-build)
- set(RunCMake_TEST_VARIANT_DESCRIPTION "-CMake-configure")
- set(RunCMake_TEST_EXPECT_stderr ".*")
- run_cmake_with_options(${exe}Example ${RunCMake_TEST_OPTIONS} -DCMAKE_AUTOGEN_VERBOSE=ON)
- set(RunCMake_TEST_NO_CLEAN 1)
- set(RunCMake_MAKE_PROGRAM ${CMAKE_COMMAND})
- run_make_program(${RunCMake_TEST_BINARY_DIR} --build . --config Debug)
- if (exe STREQUAL "Moc")
- set(expected_count 16)
- elseif (exe STREQUAL "Uic")
- set(expected_count 4)
- else()
- set(expected_count 12)
- endif()
- expect_n_times("${make_program_stdout}" "Auto${exe}:" ${expected_count} "${exe}Example-build-Auto${exe}")
- expect_n_times("${make_program_stdout}" "Auto${exe}:" ${expected_count} "${exe}Example-build-Auto${exe}")
-
- if (exe STREQUAL "Moc" OR exe STREQUAL "Uic")
- expect_n_times("${make_program_stdout}" "AutoGen:" 20 "${exe}Example-build-AutoGen:")
- endif()
-
- foreach(config IN ITEMS Debug Release RelWithDebInfo)
- block()
- run_make_program(${RunCMake_TEST_BINARY_DIR} --build . --config ${config})
- not_expect("${make_program_stdout}" "Auto${exe}" "${exe}Example-${config}_Auto${exe}")
- not_expect("${make_program_stdout}" "AutoGen:" "${exe}Example-${config}_AutoGen")
- endblock()
- endforeach()
- endblock()
- endforeach()
- endif()
-
- if (QtCore_VERSION VERSION_GREATER_EQUAL 6)
- if (RunCMake_GENERATOR MATCHES "Make|Ninja")
- foreach(value IN ITEMS ON OFF)
- block()
- set(RunCMake_TEST_BINARY_DIR
- ${RunCMake_BINARY_DIR}/RccNoZTSD-${value}-build)
- run_cmake_with_options(RccExample ${RunCMake_TEST_OPTIONS}
- -DCMAKE_AUTOGEN_VERBOSE=ON -DZSTD_VALUE=${value})
- if (value STREQUAL "OFF")
- set(RunCMake_TEST_EXPECT_stdout "--no-zstd")
- else()
- set(RunCMake_TEST_NOT_EXPECT_stdout "--no-zstd")
- endif()
- set(RunCMake_TEST_NO_CLEAN 1)
- run_cmake_command(RccNoZTSD-${value}-build ${CMAKE_COMMAND}
- --build . --config Debug)
- endblock()
- endforeach()
- endif()
- endif()
-endif ()
diff --git a/Tests/RunCMake/Autogen/exe.cpp b/Tests/RunCMake/Autogen/exe.cpp
deleted file mode 100644
index f8b643a..0000000
--- a/Tests/RunCMake/Autogen/exe.cpp
+++ /dev/null
@@ -1,4 +0,0 @@
-int main()
-{
- return 0;
-}
diff --git a/Tests/RunCMake/Autogen/AutogenSkipLinting-build-stderr.txt b/Tests/RunCMake/Autogen_1/AutogenSkipLinting-build-stderr.txt
index 8d98f9d..8d98f9d 100644
--- a/Tests/RunCMake/Autogen/AutogenSkipLinting-build-stderr.txt
+++ b/Tests/RunCMake/Autogen_1/AutogenSkipLinting-build-stderr.txt
diff --git a/Tests/RunCMake/Autogen/AutogenSkipLinting.cmake b/Tests/RunCMake/Autogen_1/AutogenSkipLinting.cmake
index 3ce2092..3ce2092 100644
--- a/Tests/RunCMake/Autogen/AutogenSkipLinting.cmake
+++ b/Tests/RunCMake/Autogen_1/AutogenSkipLinting.cmake
diff --git a/Tests/RunCMake/Autogen/AutogenUseSystemIncludeCommon.cmake b/Tests/RunCMake/Autogen_1/AutogenUseSystemIncludeCommon.cmake
index bbefd5f..bbefd5f 100644
--- a/Tests/RunCMake/Autogen/AutogenUseSystemIncludeCommon.cmake
+++ b/Tests/RunCMake/Autogen_1/AutogenUseSystemIncludeCommon.cmake
diff --git a/Tests/RunCMake/Autogen/AutogenUseSystemIncludeOff.cmake b/Tests/RunCMake/Autogen_1/AutogenUseSystemIncludeOff.cmake
index dfdbb98..dfdbb98 100644
--- a/Tests/RunCMake/Autogen/AutogenUseSystemIncludeOff.cmake
+++ b/Tests/RunCMake/Autogen_1/AutogenUseSystemIncludeOff.cmake
diff --git a/Tests/RunCMake/Autogen/AutogenUseSystemIncludeOn.cmake b/Tests/RunCMake/Autogen_1/AutogenUseSystemIncludeOn.cmake
index f556ed4..f556ed4 100644
--- a/Tests/RunCMake/Autogen/AutogenUseSystemIncludeOn.cmake
+++ b/Tests/RunCMake/Autogen_1/AutogenUseSystemIncludeOn.cmake
diff --git a/Tests/RunCMake/Autogen/CMP0111-imported-target-full.cmake b/Tests/RunCMake/Autogen_1/CMP0111-imported-target-full.cmake
index 331da64..331da64 100644
--- a/Tests/RunCMake/Autogen/CMP0111-imported-target-full.cmake
+++ b/Tests/RunCMake/Autogen_1/CMP0111-imported-target-full.cmake
diff --git a/Tests/RunCMake/Autogen/CMP0111-imported-target-implib-only.cmake b/Tests/RunCMake/Autogen_1/CMP0111-imported-target-implib-only.cmake
index 8640fdc..8640fdc 100644
--- a/Tests/RunCMake/Autogen/CMP0111-imported-target-implib-only.cmake
+++ b/Tests/RunCMake/Autogen_1/CMP0111-imported-target-implib-only.cmake
diff --git a/Tests/RunCMake/Autogen/CMP0111-imported-target-libname.cmake b/Tests/RunCMake/Autogen_1/CMP0111-imported-target-libname.cmake
index e1318c2..e1318c2 100644
--- a/Tests/RunCMake/Autogen/CMP0111-imported-target-libname.cmake
+++ b/Tests/RunCMake/Autogen_1/CMP0111-imported-target-libname.cmake
diff --git a/Tests/RunCMake/Autogen/CMP0111-imported-target-prelude.cmake b/Tests/RunCMake/Autogen_1/CMP0111-imported-target-prelude.cmake
index 6d26f99..6d26f99 100644
--- a/Tests/RunCMake/Autogen/CMP0111-imported-target-prelude.cmake
+++ b/Tests/RunCMake/Autogen_1/CMP0111-imported-target-prelude.cmake
diff --git a/Tests/RunCMake/Autogen/CMP0151-common.cmake b/Tests/RunCMake/Autogen_1/CMP0151-common.cmake
index bbefd5f..bbefd5f 100644
--- a/Tests/RunCMake/Autogen/CMP0151-common.cmake
+++ b/Tests/RunCMake/Autogen_1/CMP0151-common.cmake
diff --git a/Tests/RunCMake/Autogen/CMP0151-new.cmake b/Tests/RunCMake/Autogen_1/CMP0151-new.cmake
index 9c77e58..9c77e58 100644
--- a/Tests/RunCMake/Autogen/CMP0151-new.cmake
+++ b/Tests/RunCMake/Autogen_1/CMP0151-new.cmake
diff --git a/Tests/RunCMake/Autogen/CMP0151-old.cmake b/Tests/RunCMake/Autogen_1/CMP0151-old.cmake
index 9c77e58..9c77e58 100644
--- a/Tests/RunCMake/Autogen/CMP0151-old.cmake
+++ b/Tests/RunCMake/Autogen_1/CMP0151-old.cmake
diff --git a/Tests/RunCMake/Autogen/CMakeLists.txt b/Tests/RunCMake/Autogen_1/CMakeLists.txt
index 2632ffa..2632ffa 100644
--- a/Tests/RunCMake/Autogen/CMakeLists.txt
+++ b/Tests/RunCMake/Autogen_1/CMakeLists.txt
diff --git a/Tests/RunCMake/Autogen/Inspect.cmake b/Tests/RunCMake/Autogen_1/Inspect.cmake
index d5dc4b4..d5dc4b4 100644
--- a/Tests/RunCMake/Autogen/Inspect.cmake
+++ b/Tests/RunCMake/Autogen_1/Inspect.cmake
diff --git a/Tests/RunCMake/Autogen/MocGeneratedFile.cmake b/Tests/RunCMake/Autogen_1/MocGeneratedFile.cmake
index 7bb55e9..7bb55e9 100644
--- a/Tests/RunCMake/Autogen/MocGeneratedFile.cmake
+++ b/Tests/RunCMake/Autogen_1/MocGeneratedFile.cmake
diff --git a/Tests/RunCMake/Autogen/MocPredefs-build-stderr.txt b/Tests/RunCMake/Autogen_1/MocPredefs-build-stderr.txt
index 8d98f9d..8d98f9d 100644
--- a/Tests/RunCMake/Autogen/MocPredefs-build-stderr.txt
+++ b/Tests/RunCMake/Autogen_1/MocPredefs-build-stderr.txt
diff --git a/Tests/RunCMake/Autogen/MocPredefs-check.cxx b/Tests/RunCMake/Autogen_1/MocPredefs-check.cxx
index 2b4791f..2b4791f 100644
--- a/Tests/RunCMake/Autogen/MocPredefs-check.cxx
+++ b/Tests/RunCMake/Autogen_1/MocPredefs-check.cxx
diff --git a/Tests/RunCMake/Autogen/MocPredefs-prefix.cmake b/Tests/RunCMake/Autogen_1/MocPredefs-prefix.cmake
index 460a05d..460a05d 100644
--- a/Tests/RunCMake/Autogen/MocPredefs-prefix.cmake
+++ b/Tests/RunCMake/Autogen_1/MocPredefs-prefix.cmake
diff --git a/Tests/RunCMake/Autogen/MocPredefs.cmake b/Tests/RunCMake/Autogen_1/MocPredefs.cmake
index 8307e04..8307e04 100644
--- a/Tests/RunCMake/Autogen/MocPredefs.cmake
+++ b/Tests/RunCMake/Autogen_1/MocPredefs.cmake
diff --git a/Tests/RunCMake/Autogen/MocPredefs.cxx b/Tests/RunCMake/Autogen_1/MocPredefs.cxx
index b27cec5..b27cec5 100644
--- a/Tests/RunCMake/Autogen/MocPredefs.cxx
+++ b/Tests/RunCMake/Autogen_1/MocPredefs.cxx
diff --git a/Tests/RunCMake/Autogen/NoQt-stderr.txt b/Tests/RunCMake/Autogen_1/NoQt-stderr.txt
index 1c6660a..1c6660a 100644
--- a/Tests/RunCMake/Autogen/NoQt-stderr.txt
+++ b/Tests/RunCMake/Autogen_1/NoQt-stderr.txt
diff --git a/Tests/RunCMake/Autogen/NoQt.cmake b/Tests/RunCMake/Autogen_1/NoQt.cmake
index b2d375a..b2d375a 100644
--- a/Tests/RunCMake/Autogen/NoQt.cmake
+++ b/Tests/RunCMake/Autogen_1/NoQt.cmake
diff --git a/Tests/RunCMake/Autogen/QtInFunction.cmake b/Tests/RunCMake/Autogen_1/QtInFunction.cmake
index 6c42cc2..6c42cc2 100644
--- a/Tests/RunCMake/Autogen/QtInFunction.cmake
+++ b/Tests/RunCMake/Autogen_1/QtInFunction.cmake
diff --git a/Tests/RunCMake/Autogen/QtInFunctionNested-stderr.txt b/Tests/RunCMake/Autogen_1/QtInFunctionNested-stderr.txt
index 1c6660a..1c6660a 100644
--- a/Tests/RunCMake/Autogen/QtInFunctionNested-stderr.txt
+++ b/Tests/RunCMake/Autogen_1/QtInFunctionNested-stderr.txt
diff --git a/Tests/RunCMake/Autogen/QtInFunctionNested.cmake b/Tests/RunCMake/Autogen_1/QtInFunctionNested.cmake
index 2e7b8ad..2e7b8ad 100644
--- a/Tests/RunCMake/Autogen/QtInFunctionNested.cmake
+++ b/Tests/RunCMake/Autogen_1/QtInFunctionNested.cmake
diff --git a/Tests/RunCMake/Autogen/QtInFunctionProperty.cmake b/Tests/RunCMake/Autogen_1/QtInFunctionProperty.cmake
index d9296c4..d9296c4 100644
--- a/Tests/RunCMake/Autogen/QtInFunctionProperty.cmake
+++ b/Tests/RunCMake/Autogen_1/QtInFunctionProperty.cmake
diff --git a/Tests/RunCMake/Autogen_1/RunCMakeTest.cmake b/Tests/RunCMake/Autogen_1/RunCMakeTest.cmake
new file mode 100644
index 0000000..64add97
--- /dev/null
+++ b/Tests/RunCMake/Autogen_1/RunCMakeTest.cmake
@@ -0,0 +1,125 @@
+include(RunCMake)
+
+run_cmake(NoQt)
+if (DEFINED with_qt_version)
+ set(RunCMake_TEST_OPTIONS
+ -Dwith_qt_version=${with_qt_version}
+ "-DQt${with_qt_version}_DIR:PATH=${Qt${with_qt_version}_DIR}"
+ "-DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH}"
+ )
+
+ run_cmake(QtInFunction)
+ run_cmake(QtInFunctionNested)
+ run_cmake(QtInFunctionProperty)
+
+ run_cmake(CMP0111-imported-target-full)
+ run_cmake(CMP0111-imported-target-libname)
+ run_cmake(CMP0111-imported-target-implib-only)
+
+ block()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/MocPredefs-build)
+ run_cmake(MocPredefs)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(MocPredefs-build ${CMAKE_COMMAND} --build . --config Debug)
+ endblock()
+
+ # Detect information from the toolchain:
+ # - CMAKE_INCLUDE_FLAG_CXX
+ # - CMAKE_INCLUDE_SYSTEM_FLAG_CXX
+ run_cmake(Inspect)
+ include("${RunCMake_BINARY_DIR}/Inspect-build/info.cmake")
+
+ if(CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
+ if(RunCMake_GENERATOR MATCHES "Visual Studio")
+ string(REGEX REPLACE "^-" "/" test_expect_stdout "${CMAKE_INCLUDE_SYSTEM_FLAG_CXX}")
+ else()
+ set(test_expect_stdout "-*${CMAKE_INCLUDE_SYSTEM_FLAG_CXX}")
+ endif()
+ string(APPEND test_expect_stdout " *(\"[^\"]*|([^ ]|\\ )*)[\\/]dummy_autogen[\\/]include")
+ if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ string(APPEND test_expect_stdout "_Debug")
+ endif()
+
+ block()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0151-new-build)
+ run_cmake_with_options(CMP0151-new ${RunCMake_TEST_OPTIONS} -DCMAKE_POLICY_DEFAULT_CMP0151=NEW)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_EXPECT_stdout "${test_expect_stdout}")
+ run_cmake_command(CMP0151-new-build ${CMAKE_COMMAND} --build . --config Debug --verbose)
+ endblock()
+
+ block()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AutogenUseSystemIncludeOn-build)
+ run_cmake_with_options(AutogenUseSystemIncludeOn ${RunCMake_TEST_OPTIONS} -DCMAKE_POLICY_DEFAULT_CMP0151=NEW)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_EXPECT_stdout "${test_expect_stdout}")
+ run_cmake_command(AutogenUseSystemIncludeOn ${CMAKE_COMMAND} --build . --config Debug --verbose)
+ endblock()
+ endif()
+
+ if(CMAKE_INCLUDE_FLAG_CXX)
+ if(RunCMake_GENERATOR MATCHES "Visual Studio")
+ string(REGEX REPLACE "^-" "/" test_expect_stdout "${CMAKE_INCLUDE_FLAG_CXX}")
+ else()
+ set(test_expect_stdout "-*${CMAKE_INCLUDE_FLAG_CXX}")
+ endif()
+ string(APPEND test_expect_stdout " *(\"[^\"]*|([^ ]|\\ )*)[\\/]dummy_autogen[\\/]include")
+ if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ string(APPEND test_expect_stdout "_Debug")
+ endif()
+
+ block()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0151-old-build)
+ run_cmake_with_options(CMP0151-old ${RunCMake_TEST_OPTIONS} -DCMAKE_POLICY_DEFAULT_CMP0151=OLD)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_EXPECT_stdout "${test_expect_stdout}")
+ run_cmake_command(CMP0151-old-build ${CMAKE_COMMAND} --build . --config Debug --verbose)
+ endblock()
+
+ block()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AutogenUseSystemIncludeOff-build)
+ run_cmake_with_options(AutogenUseSystemIncludeOff ${RunCMake_TEST_OPTIONS} -DCMAKE_POLICY_DEFAULT_CMP0151=NEW)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_EXPECT_stdout "${test_expect_stdout}")
+ run_cmake_command(AutogenUseSystemIncludeOff ${CMAKE_COMMAND} --build . --config Debug --verbose)
+ endblock()
+
+ if(RunCMake_GENERATOR MATCHES "Make|Ninja")
+ block()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AutogenSkipLinting-build)
+ list(APPEND RunCMake_TEST_OPTIONS
+ "-DPSEUDO_CPPCHECK=${PSEUDO_CPPCHECK}"
+ "-DPSEUDO_CPPLINT=${PSEUDO_CPPLINT}"
+ "-DPSEUDO_IWYU=${PSEUDO_IWYU}"
+ "-DPSEUDO_TIDY=${PSEUDO_TIDY}")
+
+ run_cmake(AutogenSkipLinting)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(AutogenSkipLinting-build ${CMAKE_COMMAND} --build . --config Debug --verbose)
+ endblock()
+ endif()
+ endif()
+
+ if(RunCMake_GENERATOR_IS_MULTI_CONFIG AND NOT RunCMake_GENERATOR MATCHES "Xcode")
+ block()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/MocGeneratedFile-build)
+ run_cmake(MocGeneratedFile)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(MocGeneratedFile-build ${CMAKE_COMMAND} --build . --config Debug --verbose)
+ endblock()
+ if(RunCMake_GENERATOR MATCHES "Ninja Multi-Config")
+ block()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/MocGeneratedFile-cross-config-build)
+ list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_CROSS_CONFIGS=all)
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-CMAKE_CROSS_CONFIGS-all")
+ run_cmake(MocGeneratedFile)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-Release")
+ run_cmake_command(MocGeneratedFile-cross-config-build ${CMAKE_COMMAND} --build . --config Release --target libgen:Debug)
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-Debug")
+ run_cmake_command(MocGeneratedFile-cross-config-build ${CMAKE_COMMAND} --build . --config Debug --target libgen:Release)
+ unset(RunCMake_TEST_VARIANT_DESCRIPTION)
+ endblock()
+ endif()
+ endif()
+endif ()
diff --git a/Tests/RunCMake/Autogen/SkipLinting.cxx b/Tests/RunCMake/Autogen_1/SkipLinting.cxx
index 9e09b27..9e09b27 100644
--- a/Tests/RunCMake/Autogen/SkipLinting.cxx
+++ b/Tests/RunCMake/Autogen_1/SkipLinting.cxx
diff --git a/Tests/RunCMake/Autogen/SkipLinting.h b/Tests/RunCMake/Autogen_1/SkipLinting.h
index def56a0..def56a0 100644
--- a/Tests/RunCMake/Autogen/SkipLinting.h
+++ b/Tests/RunCMake/Autogen_1/SkipLinting.h
diff --git a/Tests/RunCMake/Autogen/empty.cpp b/Tests/RunCMake/Autogen_1/empty.cpp
index e69de29..e69de29 100644
--- a/Tests/RunCMake/Autogen/empty.cpp
+++ b/Tests/RunCMake/Autogen_1/empty.cpp
diff --git a/Tests/RunCMake/Autogen_2/CMakeLists.txt b/Tests/RunCMake/Autogen_2/CMakeLists.txt
new file mode 100644
index 0000000..2632ffa
--- /dev/null
+++ b/Tests/RunCMake/Autogen_2/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.16)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/Autogen/MyWindow.cpp b/Tests/RunCMake/Autogen_2/MyWindow.cpp
index d87c2e9..d87c2e9 100644
--- a/Tests/RunCMake/Autogen/MyWindow.cpp
+++ b/Tests/RunCMake/Autogen_2/MyWindow.cpp
diff --git a/Tests/RunCMake/Autogen/MyWindow.h b/Tests/RunCMake/Autogen_2/MyWindow.h
index c267610..c267610 100644
--- a/Tests/RunCMake/Autogen/MyWindow.h
+++ b/Tests/RunCMake/Autogen_2/MyWindow.h
diff --git a/Tests/RunCMake/Autogen/MyWindow.ui b/Tests/RunCMake/Autogen_2/MyWindow.ui
index fbf294c..fbf294c 100644
--- a/Tests/RunCMake/Autogen/MyWindow.ui
+++ b/Tests/RunCMake/Autogen_2/MyWindow.ui
diff --git a/Tests/RunCMake/Autogen/QtAutoMocDeps-stderr.txt b/Tests/RunCMake/Autogen_2/QtAutoMocDeps-stderr.txt
index 6024984..6024984 100644
--- a/Tests/RunCMake/Autogen/QtAutoMocDeps-stderr.txt
+++ b/Tests/RunCMake/Autogen_2/QtAutoMocDeps-stderr.txt
diff --git a/Tests/RunCMake/Autogen/QtAutoMocDeps.cmake b/Tests/RunCMake/Autogen_2/QtAutoMocDeps.cmake
index fc3b2f2..fc3b2f2 100644
--- a/Tests/RunCMake/Autogen/QtAutoMocDeps.cmake
+++ b/Tests/RunCMake/Autogen_2/QtAutoMocDeps.cmake
diff --git a/Tests/RunCMake/Autogen/QtSubDir1/CMakeLists.txt b/Tests/RunCMake/Autogen_2/QtSubDir1/CMakeLists.txt
index f215b9e..f215b9e 100644
--- a/Tests/RunCMake/Autogen/QtSubDir1/CMakeLists.txt
+++ b/Tests/RunCMake/Autogen_2/QtSubDir1/CMakeLists.txt
diff --git a/Tests/RunCMake/Autogen/QtSubDir2/CMakeLists.txt b/Tests/RunCMake/Autogen_2/QtSubDir2/CMakeLists.txt
index cccb1e0..cccb1e0 100644
--- a/Tests/RunCMake/Autogen/QtSubDir2/CMakeLists.txt
+++ b/Tests/RunCMake/Autogen_2/QtSubDir2/CMakeLists.txt
diff --git a/Tests/RunCMake/Autogen/QtSubDir3/CMakeLists.txt b/Tests/RunCMake/Autogen_2/QtSubDir3/CMakeLists.txt
index d268bfe..d268bfe 100644
--- a/Tests/RunCMake/Autogen/QtSubDir3/CMakeLists.txt
+++ b/Tests/RunCMake/Autogen_2/QtSubDir3/CMakeLists.txt
diff --git a/Tests/RunCMake/Autogen_2/RunCMakeTest.cmake b/Tests/RunCMake/Autogen_2/RunCMakeTest.cmake
new file mode 100644
index 0000000..e97e896
--- /dev/null
+++ b/Tests/RunCMake/Autogen_2/RunCMakeTest.cmake
@@ -0,0 +1,87 @@
+include(RunCMake)
+
+if (DEFINED with_qt_version)
+ set(RunCMake_TEST_OPTIONS
+ -Dwith_qt_version=${with_qt_version}
+ "-DQt${with_qt_version}_DIR:PATH=${Qt${with_qt_version}_DIR}"
+ "-DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH}"
+ )
+ if(RunCMake_GENERATOR MATCHES "Make|Ninja")
+ block()
+ if(QtCore_VERSION VERSION_GREATER_EQUAL 5.15.0)
+ if (RunCMake_GENERATOR MATCHES "Ninja Multi-Config")
+ set(config_list Debug Release RelWithDebInfo)
+ set(use_better_graph_list ON OFF)
+ else()
+ set(config_list single-config)
+ set(use_better_graph_list OFF)
+ endif()
+
+ foreach(use_better_graph IN ITEMS ${use_better_graph_list})
+ foreach(config IN ITEMS ${config_list})
+ block()
+ if (config STREQUAL "single-config")
+ set(config_suffix "")
+ else()
+ set(config_path "_${config}")
+ if (use_better_graph)
+ set(config_suffix "_${config}")
+ endif()
+ endif()
+
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/QtAutoMocDeps${config_path}-build)
+ run_cmake_with_options(QtAutoMocDeps ${RunCMake_TEST_OPTIONS} -DCMAKE_AUTOGEN_BETTER_GRAPH_MULTI_CONFIG=${use_better_graph})
+ set(RunCMake_TEST_NO_CLEAN 1)
+ # Build the project.
+ if (config STREQUAL "single-config")
+ set(config_param "")
+ else()
+ set(config_param "--config ${config}")
+ endif()
+ run_cmake_command(QtAutoMocDeps-build ${CMAKE_COMMAND} --build . --verbose ${config_param})
+ # Touch just the library source file, which shouldn't cause a rerun of AUTOMOC
+ # for app_with_qt target.
+ file(TOUCH "${RunCMake_SOURCE_DIR}/simple_lib.cpp")
+ set(RunCMake_TEST_NOT_EXPECT_stdout "Automatic MOC for target app_with_qt|\
+Automatic MOC for target sub_exe_1|\
+Automatic MOC for target sub_exe_2")
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-Don't execute AUTOMOC for 'app_with_qt', 'sub_exe_1' and 'sub_exe_2'")
+ # Build and assert that AUTOMOC was not run for app_with_qt, sub_exe_1 and sub_exe_2.
+ run_cmake_command(QtAutoMocDeps-build ${CMAKE_COMMAND} --build . --verbose ${config_param})
+ unset(RunCMake_TEST_VARIANT_DESCRIPTION)
+ unset(RunCMake_TEST_NOT_EXPECT_stdout)
+
+ macro(check_file_exists file)
+ if (EXISTS "${file}")
+ set(check_result "PASSED")
+ set(message_type "STATUS")
+ else()
+ set(check_result "FAILED")
+ set(message_type "FATAL_ERROR")
+ endif()
+
+ message(${message_type} "QtAutoMocDeps-build-\"${file}\" was generated - ${check_result}")
+ endmacro()
+
+ check_file_exists("${RunCMake_TEST_BINARY_DIR}/app_with_qt_autogen/deps${config_suffix}")
+ check_file_exists("${RunCMake_TEST_BINARY_DIR}/QtSubDir1/sub_exe_1_autogen/deps${config_suffix}")
+ check_file_exists("${RunCMake_TEST_BINARY_DIR}/QtSubDir2/sub_exe_2_autogen/deps${config_suffix}")
+
+ check_file_exists("${RunCMake_TEST_BINARY_DIR}/app_with_qt_autogen/timestamp${config_suffix}")
+ check_file_exists("${RunCMake_TEST_BINARY_DIR}/QtSubDir1/sub_exe_1_autogen/timestamp${config_suffix}")
+ check_file_exists("${RunCMake_TEST_BINARY_DIR}/QtSubDir2/sub_exe_2_autogen/timestamp${config_suffix}")
+
+ # Touch a header file to make sure an automoc dependency cycle is not introduced.
+ file(TOUCH "${RunCMake_SOURCE_DIR}/MyWindow.h")
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-First build after touch to detect dependency cycle")
+ run_cmake_command(QtAutoMocDeps-build ${CMAKE_COMMAND} --build . --verbose)
+ # Need to run a second time to hit the dependency cycle.
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-Don't hit dependency cycle")
+ run_cmake_command(QtAutoMocDeps-build ${CMAKE_COMMAND} --build . --verbose)
+ endblock()
+ endforeach()
+ endforeach()
+ endif()
+ endblock()
+ endif()
+endif ()
diff --git a/Tests/RunCMake/Autogen/app.cpp b/Tests/RunCMake/Autogen_2/app.cpp
index 57380e4..57380e4 100644
--- a/Tests/RunCMake/Autogen/app.cpp
+++ b/Tests/RunCMake/Autogen_2/app.cpp
diff --git a/Tests/RunCMake/Autogen/app_qt.cpp b/Tests/RunCMake/Autogen_2/app_qt.cpp
index 302c672..302c672 100644
--- a/Tests/RunCMake/Autogen/app_qt.cpp
+++ b/Tests/RunCMake/Autogen_2/app_qt.cpp
diff --git a/Tests/RunCMake/Autogen/simple_lib.cpp b/Tests/RunCMake/Autogen_2/simple_lib.cpp
index cf8d689..cf8d689 100644
--- a/Tests/RunCMake/Autogen/simple_lib.cpp
+++ b/Tests/RunCMake/Autogen_2/simple_lib.cpp
diff --git a/Tests/RunCMake/Autogen/AutoMocExecutableConfig.cmake b/Tests/RunCMake/Autogen_3/AutoMocExecutableConfig.cmake
index 3ee9be9..fc6ed7f 100644
--- a/Tests/RunCMake/Autogen/AutoMocExecutableConfig.cmake
+++ b/Tests/RunCMake/Autogen_3/AutoMocExecutableConfig.cmake
@@ -7,9 +7,9 @@ endif()
get_target_property(moc_location Qt${with_qt_version}::moc IMPORTED_LOCATION)
set_target_properties(dummy PROPERTIES AUTOMOC_MOC_OPTIONS "EXE_PATH=${moc_location}")
-add_executable(mymoc $<$<CONFIG:Debug>:exe_debug.cpp>
- $<$<CONFIG:Release>:exe_release.cpp>
- $<$<CONFIG:RelWithDebInfo>:exe_relwithdebinfo.cpp>
+add_executable(mymoc $<$<CONFIG:Debug>:../Autogen_common/exe_debug.cpp>
+ $<$<CONFIG:Release>:../Autogen_common/exe_release.cpp>
+ $<$<CONFIG:RelWithDebInfo>:../Autogen_common/exe_relwithdebinfo.cpp>
)
set_target_properties(dummy PROPERTIES AUTOMOC_EXECUTABLE $<TARGET_FILE:mymoc>)
diff --git a/Tests/RunCMake/Autogen_3/CMakeLists.txt b/Tests/RunCMake/Autogen_3/CMakeLists.txt
new file mode 100644
index 0000000..2632ffa
--- /dev/null
+++ b/Tests/RunCMake/Autogen_3/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.16)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/Autogen/MocExample.cmake b/Tests/RunCMake/Autogen_3/MocExample.cmake
index f06f8f6..b4f4729 100644
--- a/Tests/RunCMake/Autogen/MocExample.cmake
+++ b/Tests/RunCMake/Autogen_3/MocExample.cmake
@@ -3,7 +3,7 @@ enable_language(CXX)
set(CMAKE_CXX_STANDARD 11)
find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core Widgets Gui)
-add_library(dummy STATIC example.cpp)
+add_library(dummy STATIC ../Autogen_common/example.cpp)
target_link_libraries(dummy Qt${with_qt_version}::Core
Qt${with_qt_version}::Widgets
Qt${with_qt_version}::Gui)
diff --git a/Tests/RunCMake/Autogen_3/RunCMakeTest.cmake b/Tests/RunCMake/Autogen_3/RunCMakeTest.cmake
new file mode 100644
index 0000000..a2fb3df
--- /dev/null
+++ b/Tests/RunCMake/Autogen_3/RunCMakeTest.cmake
@@ -0,0 +1,11 @@
+include(RunCMake)
+include(Autogen_common/utils)
+
+if (DEFINED with_qt_version)
+ set(RunCMake_TEST_OPTIONS
+ -Dwith_qt_version=${with_qt_version}
+ "-DQt${with_qt_version}_DIR:PATH=${Qt${with_qt_version}_DIR}"
+ "-DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH}"
+ )
+ autogen_executable_test(Moc)
+endif ()
diff --git a/Tests/RunCMake/Autogen/AutoUicExecutableConfig.cmake b/Tests/RunCMake/Autogen_4/AutoUicExecutableConfig.cmake
index 55b88b8..72a0d9f 100644
--- a/Tests/RunCMake/Autogen/AutoUicExecutableConfig.cmake
+++ b/Tests/RunCMake/Autogen_4/AutoUicExecutableConfig.cmake
@@ -7,9 +7,9 @@ endif()
get_target_property(uic_location Qt${with_qt_version}::uic IMPORTED_LOCATION)
set_target_properties(dummy PROPERTIES AUTOUIC_OPTIONS "EXE_PATH=${uic_location}")
-add_executable(myuic $<$<CONFIG:Debug>:exe_debug.cpp>
- $<$<CONFIG:Release>:exe_release.cpp>
- $<$<CONFIG:RelWithDebInfo>:exe_relwithdebinfo.cpp>
+add_executable(myuic $<$<CONFIG:Debug>:../Autogen_common/exe_debug.cpp>
+ $<$<CONFIG:Release>:../Autogen_common/exe_release.cpp>
+ $<$<CONFIG:RelWithDebInfo>:../Autogen_common/exe_relwithdebinfo.cpp>
)
set_target_properties(dummy PROPERTIES AUTOUIC_EXECUTABLE $<TARGET_FILE:myuic>)
diff --git a/Tests/RunCMake/Autogen_4/CMakeLists.txt b/Tests/RunCMake/Autogen_4/CMakeLists.txt
new file mode 100644
index 0000000..2632ffa
--- /dev/null
+++ b/Tests/RunCMake/Autogen_4/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.16)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/Autogen_4/RunCMakeTest.cmake b/Tests/RunCMake/Autogen_4/RunCMakeTest.cmake
new file mode 100644
index 0000000..ac8c5d4
--- /dev/null
+++ b/Tests/RunCMake/Autogen_4/RunCMakeTest.cmake
@@ -0,0 +1,11 @@
+include(RunCMake)
+include(Autogen_common/utils)
+
+if (DEFINED with_qt_version)
+ set(RunCMake_TEST_OPTIONS
+ -Dwith_qt_version=${with_qt_version}
+ "-DQt${with_qt_version}_DIR:PATH=${Qt${with_qt_version}_DIR}"
+ "-DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH}"
+ )
+ autogen_executable_test(Uic)
+endif ()
diff --git a/Tests/RunCMake/Autogen/UicExample.cmake b/Tests/RunCMake/Autogen_4/UicExample.cmake
index 4b1f8c1..4b1f8c1 100644
--- a/Tests/RunCMake/Autogen/UicExample.cmake
+++ b/Tests/RunCMake/Autogen_4/UicExample.cmake
diff --git a/Tests/RunCMake/Autogen/example_ui.cpp b/Tests/RunCMake/Autogen_4/example_ui.cpp
index fb97c32..fb97c32 100644
--- a/Tests/RunCMake/Autogen/example_ui.cpp
+++ b/Tests/RunCMake/Autogen_4/example_ui.cpp
diff --git a/Tests/RunCMake/Autogen/example_ui.h b/Tests/RunCMake/Autogen_4/example_ui.h
index d691133..d691133 100644
--- a/Tests/RunCMake/Autogen/example_ui.h
+++ b/Tests/RunCMake/Autogen_4/example_ui.h
diff --git a/Tests/RunCMake/Autogen/uiA.ui b/Tests/RunCMake/Autogen_4/uiA.ui
index 4c5762e..4c5762e 100644
--- a/Tests/RunCMake/Autogen/uiA.ui
+++ b/Tests/RunCMake/Autogen_4/uiA.ui
diff --git a/Tests/RunCMake/Autogen/AutoRccExecutableConfig.cmake b/Tests/RunCMake/Autogen_5/AutoRccExecutableConfig.cmake
index 0e46420..b15dd72 100644
--- a/Tests/RunCMake/Autogen/AutoRccExecutableConfig.cmake
+++ b/Tests/RunCMake/Autogen_5/AutoRccExecutableConfig.cmake
@@ -7,9 +7,9 @@ endif()
get_target_property(rcc_location Qt${with_qt_version}::rcc IMPORTED_LOCATION)
set_target_properties(dummy PROPERTIES AUTORCC_OPTIONS "EXE_PATH=${rcc_location}")
-add_executable(myrcc $<$<CONFIG:Debug>:exe_debug.cpp>
- $<$<CONFIG:Release>:exe_release.cpp>
- $<$<CONFIG:RelWithDebInfo>:exe_relwithdebinfo.cpp>
+add_executable(myrcc $<$<CONFIG:Debug>:../Autogen_common/exe_debug.cpp>
+ $<$<CONFIG:Release>:../Autogen_common/exe_release.cpp>
+ $<$<CONFIG:RelWithDebInfo>:../Autogen_common/exe_relwithdebinfo.cpp>
)
set_target_properties(dummy PROPERTIES AUTORCC_EXECUTABLE $<TARGET_FILE:myrcc>)
diff --git a/Tests/RunCMake/Autogen_5/CMakeLists.txt b/Tests/RunCMake/Autogen_5/CMakeLists.txt
new file mode 100644
index 0000000..2632ffa
--- /dev/null
+++ b/Tests/RunCMake/Autogen_5/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.16)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/Autogen/RccExample.cmake b/Tests/RunCMake/Autogen_5/RccExample.cmake
index ade0fef..9f8dc59 100644
--- a/Tests/RunCMake/Autogen/RccExample.cmake
+++ b/Tests/RunCMake/Autogen_5/RccExample.cmake
@@ -3,7 +3,7 @@ enable_language(CXX)
set(CMAKE_CXX_STANDARD 11)
find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core Widgets Gui)
-add_library(dummy STATIC example.cpp data.qrc)
+add_library(dummy STATIC ../Autogen_common/example.cpp data.qrc)
target_link_libraries(dummy Qt${with_qt_version}::Core
Qt${with_qt_version}::Widgets
Qt${with_qt_version}::Gui)
diff --git a/Tests/RunCMake/Autogen_5/RunCMakeTest.cmake b/Tests/RunCMake/Autogen_5/RunCMakeTest.cmake
new file mode 100644
index 0000000..8060ec4
--- /dev/null
+++ b/Tests/RunCMake/Autogen_5/RunCMakeTest.cmake
@@ -0,0 +1,31 @@
+include(RunCMake)
+include(Autogen_common/utils)
+
+if (DEFINED with_qt_version)
+ set(RunCMake_TEST_OPTIONS
+ -Dwith_qt_version=${with_qt_version}
+ "-DQt${with_qt_version}_DIR:PATH=${Qt${with_qt_version}_DIR}"
+ "-DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH}"
+ )
+ autogen_executable_test(Rcc)
+ if (QtCore_VERSION VERSION_GREATER_EQUAL 6)
+ if (RunCMake_GENERATOR MATCHES "Make|Ninja")
+ foreach(value IN ITEMS ON OFF)
+ block()
+ set(RunCMake_TEST_BINARY_DIR
+ ${RunCMake_BINARY_DIR}/RccNoZTSD-${value}-build)
+ run_cmake_with_options(RccExample ${RunCMake_TEST_OPTIONS}
+ -DCMAKE_AUTOGEN_VERBOSE=ON -DZSTD_VALUE=${value})
+ if (value STREQUAL "OFF")
+ set(RunCMake_TEST_EXPECT_stdout "--no-zstd")
+ else()
+ set(RunCMake_TEST_NOT_EXPECT_stdout "--no-zstd")
+ endif()
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(RccNoZTSD-${value}-build ${CMAKE_COMMAND}
+ --build . --config Debug)
+ endblock()
+ endforeach()
+ endif()
+ endif()
+endif ()
diff --git a/Tests/RunCMake/Autogen/data.qrc b/Tests/RunCMake/Autogen_5/data.qrc
index 9bd068c..9bd068c 100644
--- a/Tests/RunCMake/Autogen/data.qrc
+++ b/Tests/RunCMake/Autogen_5/data.qrc
diff --git a/Tests/RunCMake/Autogen/example.cpp b/Tests/RunCMake/Autogen_common/example.cpp
index 7f1a781..7f1a781 100644
--- a/Tests/RunCMake/Autogen/example.cpp
+++ b/Tests/RunCMake/Autogen_common/example.cpp
diff --git a/Tests/RunCMake/Autogen/example.h b/Tests/RunCMake/Autogen_common/example.h
index e8bfa42..e8bfa42 100644
--- a/Tests/RunCMake/Autogen/example.h
+++ b/Tests/RunCMake/Autogen_common/example.h
diff --git a/Tests/RunCMake/Autogen/exe_common.h b/Tests/RunCMake/Autogen_common/exe_common.h
index 15311c6..15311c6 100644
--- a/Tests/RunCMake/Autogen/exe_common.h
+++ b/Tests/RunCMake/Autogen_common/exe_common.h
diff --git a/Tests/RunCMake/Autogen/exe_debug.cpp b/Tests/RunCMake/Autogen_common/exe_debug.cpp
index ae5185b..ae5185b 100644
--- a/Tests/RunCMake/Autogen/exe_debug.cpp
+++ b/Tests/RunCMake/Autogen_common/exe_debug.cpp
diff --git a/Tests/RunCMake/Autogen/exe_release.cpp b/Tests/RunCMake/Autogen_common/exe_release.cpp
index 384c992..384c992 100644
--- a/Tests/RunCMake/Autogen/exe_release.cpp
+++ b/Tests/RunCMake/Autogen_common/exe_release.cpp
diff --git a/Tests/RunCMake/Autogen/exe_relwithdebinfo.cpp b/Tests/RunCMake/Autogen_common/exe_relwithdebinfo.cpp
index aa6c558..aa6c558 100644
--- a/Tests/RunCMake/Autogen/exe_relwithdebinfo.cpp
+++ b/Tests/RunCMake/Autogen_common/exe_relwithdebinfo.cpp
diff --git a/Tests/RunCMake/Autogen_common/utils.cmake b/Tests/RunCMake/Autogen_common/utils.cmake
new file mode 100644
index 0000000..86efa85
--- /dev/null
+++ b/Tests/RunCMake/Autogen_common/utils.cmake
@@ -0,0 +1,259 @@
+function(run_make_program dir)
+ execute_process(
+ COMMAND "${RunCMake_MAKE_PROGRAM}" ${ARGN}
+ WORKING_DIRECTORY "${dir}"
+ OUTPUT_VARIABLE make_program_stdout
+ ERROR_VARIABLE make_program_stderr
+ RESULT_VARIABLE make_program_result
+ )
+ if (NOT DEFINED RunMakeProgram_expected_result)
+ set(RunMakeProgram_expected_result 0)
+ endif()
+ if(NOT "${make_program_result}" MATCHES "${RunMakeProgram_expected_result}")
+ message(STATUS "
+============ beginning of ${RunCMake_MAKE_PROGRAM}'s stdout ============
+${make_program_stdout}
+=============== end of ${RunCMake_MAKE_PROGRAM}'s stdout ===============
+")
+ message(STATUS "
+============ beginning of ${RunCMake_MAKE_PROGRAM}'s stderr ============
+${make_program_stderr}
+=============== end of ${RunCMake_MAKE_PROGRAM}'s stderr ===============
+")
+ message(FATAL_ERROR
+ "top ${RunCMake_MAKE_PROGRAM} build failed exited with status ${make_program_result}")
+ endif()
+ set(make_program_stdout "${make_program_stdout}" PARENT_SCOPE)
+endfunction(run_make_program)
+
+function(count_substring STRING SUBSTRING COUNT_VAR)
+ string(LENGTH "${STRING}" STRING_LENGTH)
+ string(LENGTH "${SUBSTRING}" SUBSTRING_LENGTH)
+ if (SUBSTRING_LENGTH EQUAL 0)
+ message(FATAL_ERROR "SUBSTRING_LENGTH is 0")
+ endif()
+
+ if (STRING_LENGTH EQUAL 0)
+ message(FATAL_ERROR "STRING_LENGTH is 0")
+ endif()
+
+ if (STRING_LENGTH LESS SUBSTRING_LENGTH)
+ message(FATAL_ERROR "STRING_LENGTH is less than SUBSTRING_LENGTH")
+ endif()
+
+ set(COUNT 0)
+ string(FIND "${STRING}" "${SUBSTRING}" SUBSTRING_START)
+ while(SUBSTRING_START GREATER_EQUAL 0)
+ math(EXPR COUNT "${COUNT} + 1")
+ math(EXPR SUBSTRING_START "${SUBSTRING_START} + ${SUBSTRING_LENGTH}")
+ string(SUBSTRING "${STRING}" ${SUBSTRING_START} -1 STRING)
+ string(FIND "${STRING}" "${SUBSTRING}" SUBSTRING_START)
+ endwhile()
+
+ set(${COUNT_VAR} ${COUNT} PARENT_SCOPE)
+endfunction()
+
+function(not_expect make_program_stdout unexpected_output test_name)
+ count_substring("${make_program_stdout}" "${unexpected_output}" count)
+ if(NOT count EQUAL 0)
+ message(STATUS "${test_name}-not_expect - FAILED")
+ message(FATAL_ERROR "Expected to find ${unexpected_output} exactly 0 times in ${make_program_stdout} but found ${count} occurrences of ${unexpected_output}")
+ else()
+ message(STATUS "${test_name}-not_expect - PASSED")
+ endif()
+endfunction()
+
+function(expect_only_once make_program_stdout expected_output test_name)
+ count_substring("${make_program_stdout}" "${expected_output}" count)
+ if(NOT count EQUAL 1)
+ message(STATUS "${test_name}-expect_only_once - FAILED")
+ message(FATAL_ERROR "Expected to find ${expected_output} exactly once in ${make_program_stdout} but found ${count} occurrences of ${expected_output}")
+ else()
+ message(STATUS "${test_name}-expect_only_once - PASSED")
+ endif()
+endfunction()
+
+function(expect_n_times string_to_check expected_output expected_count test_name)
+ count_substring("${string_to_check}" "${expected_output}" count)
+ if(NOT count EQUAL ${expected_count})
+ message(STATUS "${test_name}-expect_${expected_count}_times - FAILED")
+ message(FATAL_ERROR "Expected to find ${expected_output} exactly ${expected_count} times in ${string_to_check} but found ${count} occurrences of ${expected_output}")
+ else()
+ message(STATUS "${test_name}-expect_${expected_count}_times - PASSED")
+ endif()
+endfunction()
+
+function(autogen_executable_test exe)
+ if (QtCore_VERSION VERSION_GREATER_EQUAL 5.15.0)
+ if(RunCMake_GENERATOR MATCHES "Ninja Multi-Config")
+ block()
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-CMake-configure")
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Auto${exe}ExecutableConfig-multi-config-build)
+ run_cmake_with_options(Auto${exe}ExecutableConfig ${RunCMake_TEST_OPTIONS} -DCMAKE_AUTOGEN_VERBOSE=ON -DCMAKE_AUTOGEN_BETTER_GRAPH_MULTI_CONFIG=ON)
+ unset(RunCMake_TEST_VARIANT_DESCRIPTION)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ foreach(config IN ITEMS Debug Release RelWithDebInfo)
+ block()
+ set(RunCMake_TEST_EXPECT_stdout ".*running_exe_${config}*")
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-${config}-expect_running_exe_${config}")
+ run_cmake_command(Auto${exe}ExecutableConfig-multi-config-build ${CMAKE_COMMAND} --build . --config ${config})
+ endblock()
+ endforeach()
+ set(RunCMake_TEST_EXPECT_stdout "ninja: no work to do")
+ foreach(config IN ITEMS Debug Release RelWithDebInfo)
+ block()
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-${config}-expect_no_work_to_do")
+ run_cmake_command(Auto${exe}ExecutableConfig-multi-config-build ${CMAKE_COMMAND} --build . --config ${config})
+ endblock()
+ endforeach()
+ endblock()
+ block()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Auto${exe}ExecutableConfig-build)
+ run_cmake_with_options(Auto${exe}ExecutableConfig ${RunCMake_TEST_OPTIONS} -DCMAKE_AUTOGEN_VERBOSE=ON -DCMAKE_AUTOGEN_BETTER_GRAPH_MULTI_CONFIG=ON)
+ foreach(config IN ITEMS Debug Release RelWithDebInfo)
+ block()
+ run_make_program(${RunCMake_TEST_BINARY_DIR} --verbose -f build-${config}.ninja)
+
+ set(expected_output "running_exe_${config}")
+ expect_only_once("${make_program_stdout}" "${expected_output}" "Auto${exe}ExecutableConfig-${config}-${expected_output}")
+
+ foreach(sub_config IN ITEMS Debug Release RelWithDebInfo)
+ if(NOT sub_config STREQUAL config)
+ set(unexpected_output "running_exe_${sub_config}")
+ not_expect("${make_program_stdout}" "${unexpected_output}" "Auto${exe}ExecutableConfig-${config}-${unexpected_output}")
+ endif()
+ endforeach()
+
+ if (exe STREQUAL "Moc" OR exe STREQUAL "Uic")
+ set(expected_output "cmake_autogen")
+ else()
+ set(expected_output "cmake_autorcc")
+ endif()
+ expect_only_once("${make_program_stdout}" "${expected_output}" "Auto${exe}ExecutableConfig-${config}-${expected_output}")
+ endblock()
+ endforeach()
+ endblock()
+ block()
+ foreach(ninja_config IN ITEMS Debug Release RelWithDebInfo)
+ foreach(target_config IN ITEMS Debug Release RelWithDebInfo)
+ block()
+ set(TEST_SUFFIX "-CrossConfig-${ninja_config}-${target_config}")
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Auto${exe}ExecutableConfig${TEST_SUFFIX}-build)
+ set(RunCMake_TEST_VARIANT_DESCRIPTION ${TEST_SUFFIX})
+ run_cmake_with_options(Auto${exe}ExecutableConfig ${RunCMake_TEST_OPTIONS} -DCMAKE_CROSS_CONFIGS=all -DCMAKE_DEFAULT_BUILD_TYPE=${ninja_config} -DCMAKE_AUTOGEN_BETTER_GRAPH_MULTI_CONFIG=ON)
+ unset(RunCMake_TEST_VARIANT_DESCRIPTION)
+
+ run_make_program(${RunCMake_TEST_BINARY_DIR} --verbose -f build-${ninja_config}.ninja dummy:${target_config})
+
+ set(expected_output "running_exe_${ninja_config}")
+ expect_only_once("${make_program_stdout}" "${expected_output}" "Auto${exe}ExecutableConfig${TEST_SUFFIX}-${expected_output}")
+
+ foreach(sub_config IN ITEMS Debug Release RelWithDebInfo)
+ if(NOT sub_config STREQUAL ninja_config)
+ set(unexpected_output "running_exe_${sub_config}")
+ not_expect("${make_program_stdout}" "${unexpected_output}" "Auto${exe}ExecutableConfig${TEST_SUFFIX}-${unexpected_output}")
+ endif()
+ endforeach()
+
+ if (exe STREQUAL "Moc" OR exe STREQUAL "Uic")
+ set(expected_output "cmake_autogen")
+ else()
+ set(expected_output "cmake_autorcc")
+ endif()
+ expect_only_once("${make_program_stdout}" "${expected_output}" "Auto${exe}ExecutableConfig${TEST_SUFFIX}-${expected_output}")
+ endblock()
+ endforeach()
+ endforeach()
+ endblock()
+ block()
+ foreach(ninja_config IN ITEMS Debug Release RelWithDebInfo)
+ set(TEST_SUFFIX "-CrossConfig-${ninja_config}-all-all")
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Auto${exe}ExecutableConfig${TEST_SUFFIX}-build)
+ set(RunCMake_TEST_VARIANT_DESCRIPTION ${TEST_SUFFIX})
+ run_cmake_with_options(Auto${exe}ExecutableConfig ${RunCMake_TEST_OPTIONS} -DCMAKE_CROSS_CONFIGS=all -DCMAKE_AUTOGEN_BETTER_GRAPH_MULTI_CONFIG=ON)
+ unset(RunCMake_TEST_VARIANT_DESCRIPTION)
+ run_make_program(${RunCMake_TEST_BINARY_DIR} --verbose -f build-${ninja_config}.ninja all:all)
+ endforeach()
+ endblock()
+ elseif (RunCMake_GENERATOR MATCHES "Ninja|Make")
+ block()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Auto${exe}ExecutableConfig-build)
+ foreach(config IN ITEMS Debug Release RelWithDebInfo)
+ block()
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-${config}")
+ run_cmake_with_options(Auto${exe}ExecutableConfig ${RunCMake_TEST_OPTIONS} -DCMAKE_BUILD_TYPE=${config} -DCMAKE_AUTOGEN_VERBOSE=ON)
+ unset(RunCMake_TEST_VARIANT_DESCRIPTION)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_EXPECT_stdout ".*running_exe_${config}*")
+ run_cmake_command(Auto${exe}ExecutableConfig-${config}-build ${CMAKE_COMMAND} --build .)
+ endblock()
+ endforeach()
+ endblock()
+ endif()
+ endif()
+
+ # Visual Studio specific dependency tests
+ if (RunCMake_GENERATOR MATCHES "Visual Studio")
+ block()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${exe}Example-build)
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-CMake-configure")
+ run_cmake_with_options(${exe}Example ${RunCMake_TEST_OPTIONS} -DCMAKE_AUTOGEN_VERBOSE=ON)
+ unset(RunCMake_TEST_VARIANT_DESCRIPTION)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ foreach(config IN ITEMS Debug Release RelWithDebInfo)
+ block()
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-${config}-first-build")
+ run_cmake_command(${exe}Example-build ${CMAKE_COMMAND} --build . --config ${config})
+ endblock()
+ endforeach()
+ foreach(config IN ITEMS Debug Release RelWithDebInfo)
+ block()
+ if (exe STREQUAL "Moc" OR exe STREQUAL "Uic")
+ set(RunCMake_TEST_NOT_EXPECT_stdout "Auto${exe}")
+ set(not_expect_descripton "Auto${exe}")
+ else ()
+ set(RunCMake_TEST_NOT_EXPECT_stdout "Auto${exe}")
+ set(not_expect_descripton "Auto${exe}")
+ endif()
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-second-build-${config}_expect_no_${not_expect_descripton}")
+ run_cmake_command(${exe}Example-build ${CMAKE_COMMAND} --build . --config ${config})
+ endblock()
+ endforeach()
+ endblock()
+ endif()
+
+ if (RunCMake_GENERATOR MATCHES "Xcode")
+ foreach(exe IN ITEMS Moc Uic Rcc)
+ block()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${exe}Example-build)
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-CMake-configure")
+ set(RunCMake_TEST_EXPECT_stderr ".*")
+ run_cmake_with_options(${exe}Example ${RunCMake_TEST_OPTIONS} -DCMAKE_AUTOGEN_VERBOSE=ON)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_MAKE_PROGRAM ${CMAKE_COMMAND})
+ run_make_program(${RunCMake_TEST_BINARY_DIR} --build . --config Debug)
+ if (exe STREQUAL "Moc")
+ set(expected_count 16)
+ elseif (exe STREQUAL "Uic")
+ set(expected_count 4)
+ else()
+ set(expected_count 12)
+ endif()
+ expect_n_times("${make_program_stdout}" "Auto${exe}:" ${expected_count} "${exe}Example-build-Auto${exe}")
+ expect_n_times("${make_program_stdout}" "Auto${exe}:" ${expected_count} "${exe}Example-build-Auto${exe}")
+
+ if (exe STREQUAL "Moc" OR exe STREQUAL "Uic")
+ expect_n_times("${make_program_stdout}" "AutoGen:" 20 "${exe}Example-build-AutoGen:")
+ endif()
+
+ foreach(config IN ITEMS Debug Release RelWithDebInfo)
+ block()
+ run_make_program(${RunCMake_TEST_BINARY_DIR} --build . --config ${config})
+ not_expect("${make_program_stdout}" "Auto${exe}" "${exe}Example-${config}_Auto${exe}")
+ not_expect("${make_program_stdout}" "AutoGen:" "${exe}Example-${config}_AutoGen")
+ endblock()
+ endforeach()
+ endblock()
+ endforeach()
+ endif()
+endfunction()
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 4977359..294beeb 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -288,28 +288,35 @@ if(CMake_TEST_Qt6 AND Qt6Widgets_FOUND)
cmake_path(GET Qt6_DIR PARENT_PATH base_dir) # <base>/lib/cmake
cmake_path(GET base_dir PARENT_PATH base_dir) # <base>/lib
cmake_path(GET base_dir PARENT_PATH base_dir) # <base>
- add_RunCMake_test(AutogenQt6 TEST_DIR Autogen
- -Dwith_qt_version=6
- -DQtCore_VERSION=${Qt6Core_VERSION}
- "-DQt6_DIR:PATH=${Qt6_DIR}"
- "-DCMAKE_PREFIX_PATH:STRING=${base_dir}"
- -DPSEUDO_TIDY=$<TARGET_FILE:pseudo_tidy>
- -DPSEUDO_IWYU=$<TARGET_FILE:pseudo_iwyu>
- -DPSEUDO_CPPLINT=$<TARGET_FILE:pseudo_cpplint>
- -DPSEUDO_CPPCHECK=$<TARGET_FILE:pseudo_cppcheck>
- )
+ # Note: Since RunCMake.Autogen tests cause time out on some CI,
+ # we split the tests.
+ set(autogen_test_number 1 2 3 4 5)
+ foreach(val IN ITEMS ${autogen_test_number})
+ add_RunCMake_test("Autogen_Qt6_${val}" TEST_DIR "Autogen_${val}"
+ -Dwith_qt_version=6
+ -DQtCore_VERSION=${Qt6Core_VERSION}
+ "-DQt6_DIR:PATH=${Qt6_DIR}"
+ "-DCMAKE_PREFIX_PATH:STRING=${base_dir}"
+ -DPSEUDO_TIDY=$<TARGET_FILE:pseudo_tidy>
+ -DPSEUDO_IWYU=$<TARGET_FILE:pseudo_iwyu>
+ -DPSEUDO_CPPLINT=$<TARGET_FILE:pseudo_cpplint>
+ -DPSEUDO_CPPCHECK=$<TARGET_FILE:pseudo_cppcheck>
+ )
+ endforeach()
set(want_NoQt_test FALSE)
endif ()
if(CMake_TEST_Qt5 AND Qt5Widgets_FOUND)
- add_RunCMake_test(AutogenQt5 TEST_DIR Autogen
- -Dwith_qt_version=5
- -DQtCore_VERSION=${Qt5Core_VERSION}
- "-DQt5_DIR:PATH=${Qt5_DIR}"
- )
+ foreach(val IN ITEMS ${autogen_test_number})
+ add_RunCMake_test("Autogen_Qt5_${val}" TEST_DIR "Autogen_${val}"
+ -Dwith_qt_version=5
+ -DQtCore_VERSION=${Qt5Core_VERSION}
+ "-DQt5_DIR:PATH=${Qt5_DIR}"
+ )
+ endforeach()
set(want_NoQt_test FALSE)
endif ()
if(want_NoQt_test)
- add_RunCMake_test(AutogenNoQt TEST_DIR Autogen)
+ add_RunCMake_test(AutogenNoQt TEST_DIR Autogen_1)
endif()
if(NOT DEFINED CMake_TEST_BuildDepends_GNU_AS