summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/PrecompileHeaders/PchWarnInvalid-check.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake/PrecompileHeaders/PchWarnInvalid-check.cmake')
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchWarnInvalid-check.cmake22
1 files changed, 22 insertions, 0 deletions
diff --git a/Tests/RunCMake/PrecompileHeaders/PchWarnInvalid-check.cmake b/Tests/RunCMake/PrecompileHeaders/PchWarnInvalid-check.cmake
new file mode 100644
index 0000000..3e7fb30
--- /dev/null
+++ b/Tests/RunCMake/PrecompileHeaders/PchWarnInvalid-check.cmake
@@ -0,0 +1,22 @@
+if (NOT CMAKE_C_COMPILER_ID MATCHES "GNU|Intel" OR
+ (CMAKE_C_COMPILER_ID STREQUAL "Intel" AND CMAKE_HOST_WIN32))
+ return()
+endif()
+
+file(STRINGS ${RunCMake_TEST_BINARY_DIR}/compile_commands.json empty_dir_commands
+ REGEX "command.*-Winvalid-pch.*empty.dir/cmake_pch.h")
+file(STRINGS ${RunCMake_TEST_BINARY_DIR}/compile_commands.json foo_dir_commands
+ REGEX "command.*-Winvalid-pch.*foo.dir/cmake_pch.h")
+
+list(LENGTH empty_dir_commands empty_dir_commands_size)
+list(LENGTH foo_dir_commands foo_dir_commands_size)
+
+if (empty_dir_commands_size EQUAL 0)
+ set(RunCMake_TEST_FAILED "empty target should have -Winvalid-pch compile option present")
+ return()
+endif()
+
+if (foo_dir_commands_size GREATER 0)
+ set(RunCMake_TEST_FAILED "foo target should not have -Winvalid-pch compile option present")
+ return()
+endif()