summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-10-07 14:17:17 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-10-07 14:17:26 (GMT)
commit6d65e8a5ab11336cb614f3d428a8bfd288bb97d5 (patch)
tree2f6ff98374ce9baced5767c2c67f822a699ab9d9 /Tests
parenta546a19385f26cb39c8ada3c146498036765fad7 (diff)
parent681714ce205de10f8c5fb39baabed7b9486afcd9 (diff)
downloadCMake-6d65e8a5ab11336cb614f3d428a8bfd288bb97d5.zip
CMake-6d65e8a5ab11336cb614f3d428a8bfd288bb97d5.tar.gz
CMake-6d65e8a5ab11336cb614f3d428a8bfd288bb97d5.tar.bz2
Merge topic 'automoc-skip-pch'
681714ce20 AUTOMOC: Skip PCH when all sources files skip the PCH file too Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !7759
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/Ninja/QtAutoMocSkipPch.cmake17
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake16
2 files changed, 33 insertions, 0 deletions
diff --git a/Tests/RunCMake/Ninja/QtAutoMocSkipPch.cmake b/Tests/RunCMake/Ninja/QtAutoMocSkipPch.cmake
new file mode 100644
index 0000000..059b917
--- /dev/null
+++ b/Tests/RunCMake/Ninja/QtAutoMocSkipPch.cmake
@@ -0,0 +1,17 @@
+enable_language(CXX)
+
+set(QtX Qt${with_qt_version})
+
+find_package(${QtX} REQUIRED COMPONENTS Core)
+
+set(CMAKE_AUTOMOC ON)
+
+add_library(simple_lib SHARED simple_lib.cpp)
+add_executable(app_with_qt app.cpp app_qt.cpp)
+
+target_link_libraries(app_with_qt PRIVATE simple_lib ${QtX}::Core)
+
+set_source_files_properties(app.cpp app_qt.cpp
+ PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
+
+target_precompile_headers(app_with_qt PRIVATE [["QObject"]])
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index 2a5b556..9f078e6 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -357,6 +357,22 @@ function(run_QtAutoMocDeps)
run_ninja("${RunCMake_TEST_BINARY_DIR}")
endif()
endfunction()
+
+function(run_QtAutoMocSkipPch)
+ set(QtX Qt${CMake_TEST_Qt_version})
+ if(CMake_TEST_${QtX}Core_Version VERSION_GREATER_EQUAL 5.15.0)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/QtAutoMocSkipPch-build)
+ run_cmake_with_options(QtAutoMocSkipPch
+ "-Dwith_qt_version=${CMake_TEST_Qt_version}"
+ "-D${QtX}_DIR=${${QtX}_DIR}"
+ "-D${QtX}Core_DIR=${${QtX}Core_DIR}"
+ "-DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH}"
+ )
+ # Build the project.
+ run_ninja("${RunCMake_TEST_BINARY_DIR}")
+ endif()
+endfunction()
if(CMake_TEST_Qt_version)
run_QtAutoMocDeps()
+ run_QtAutoMocSkipPch()
endif()