diff options
author | Brad King <brad.king@kitware.com> | 2023-05-31 13:34:04 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-05-31 13:34:23 (GMT) |
commit | 826825fe34df12e7e9b5d46a9df0011b0c70b1ba (patch) | |
tree | 4fa895c4ec10ac9f600f2f6902e61d283d480ea0 /Tests | |
parent | 5b063510f9a60bb775e9554866fce7edc286fb3c (diff) | |
parent | 2bb3d9b6448efd2aab4db3e33a16b22a1b1b097f (diff) | |
download | CMake-826825fe34df12e7e9b5d46a9df0011b0c70b1ba.zip CMake-826825fe34df12e7e9b5d46a9df0011b0c70b1ba.tar.gz CMake-826825fe34df12e7e9b5d46a9df0011b0c70b1ba.tar.bz2 |
Merge topic 'orkun_24848_19_05_2023'
2bb3d9b644 Autogen: Fix multi-config generated file issue
3bd605f3d0 Autogen: Optimize cmake_autogen execution for CROSS_CONFIG usage
f2f21c5752 Improve Const Correctness
Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8507
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/Autogen/MocGeneratedFile.cmake | 15 | ||||
-rw-r--r-- | Tests/RunCMake/Autogen/RunCMakeTest.cmake | 19 |
2 files changed, 34 insertions, 0 deletions
diff --git a/Tests/RunCMake/Autogen/MocGeneratedFile.cmake b/Tests/RunCMake/Autogen/MocGeneratedFile.cmake new file mode 100644 index 0000000..7bb55e9 --- /dev/null +++ b/Tests/RunCMake/Autogen/MocGeneratedFile.cmake @@ -0,0 +1,15 @@ +enable_language(CXX) + +find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core) + +set(CMAKE_AUTOMOC ON) + +set(GEN_SRC "class_$<CONFIG>.cpp") +add_custom_command( + OUTPUT "${GEN_SRC}" + COMMAND ${CMAKE_COMMAND} -E echo "// cpp src" > "${GEN_SRC}" + VERBATIM +) + +add_library(libgen STATIC ${GEN_SRC}) +target_link_libraries(libgen Qt${with_qt_version}::Core) diff --git a/Tests/RunCMake/Autogen/RunCMakeTest.cmake b/Tests/RunCMake/Autogen/RunCMakeTest.cmake index 97b64ed..4fe9406 100644 --- a/Tests/RunCMake/Autogen/RunCMakeTest.cmake +++ b/Tests/RunCMake/Autogen/RunCMakeTest.cmake @@ -103,4 +103,23 @@ if (DEFINED with_qt_version) 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() endif () |