summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-09-24 14:33:13 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-09-24 14:34:38 (GMT)
commitdcc117b9446cfc3d6c8bf191545aac8d1519abca (patch)
tree436930fc3ada20879f69b6c2661a8bb77e432a68 /Tests/RunCMake
parent908fc3605b7029126c24b5c5f581758bd00905c6 (diff)
parentacb9511044a230126289c1e99cfed134c3be3c52 (diff)
downloadCMake-dcc117b9446cfc3d6c8bf191545aac8d1519abca.zip
CMake-dcc117b9446cfc3d6c8bf191545aac8d1519abca.tar.gz
CMake-dcc117b9446cfc3d6c8bf191545aac8d1519abca.tar.bz2
Merge topic 'pch-relative-includes'
acb9511044 Precompile headers: Treat headers as relative to current source directory Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3840
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/PrecompileHeaders/DisabledPch.cmake2
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchInterface-check.cmake13
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchInterface.cmake5
-rw-r--r--Tests/RunCMake/PrecompileHeaders/foo.c6
-rw-r--r--Tests/RunCMake/PrecompileHeaders/foobar.c3
-rw-r--r--Tests/RunCMake/PrecompileHeaders/include/foo2.h6
6 files changed, 22 insertions, 13 deletions
diff --git a/Tests/RunCMake/PrecompileHeaders/DisabledPch.cmake b/Tests/RunCMake/PrecompileHeaders/DisabledPch.cmake
index ee47980..59ee14b 100644
--- a/Tests/RunCMake/PrecompileHeaders/DisabledPch.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/DisabledPch.cmake
@@ -4,7 +4,7 @@ project(DisabledPch C)
add_library(foo foo.c)
target_include_directories(foo PUBLIC include)
target_precompile_headers(foo PUBLIC
- foo.h
+ include/foo.h
<stdio.h>
\"string.h\"
)
diff --git a/Tests/RunCMake/PrecompileHeaders/PchInterface-check.cmake b/Tests/RunCMake/PrecompileHeaders/PchInterface-check.cmake
index cbd6ede..caeb22b 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchInterface-check.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchInterface-check.cmake
@@ -18,19 +18,14 @@ endif()
file(STRINGS ${foo_pch_header} foo_pch_header_strings)
-if (NOT "#include \"foo.h\"" IN_LIST foo_pch_header_strings OR
- NOT "#include <stdio.h>" IN_LIST foo_pch_header_strings OR
- NOT "#include \"string.h\"" IN_LIST foo_pch_header_strings)
- set(RunCMake_TEST_FAILED "Generated foo pch header ${foo_pch_header} has bad content")
+if (NOT foo_pch_header_strings MATCHES ";#include \"[^\"]*PrecompileHeaders/include/foo.h\";#include \"foo2.h\";#include <stdio.h>;#include \"string.h\"(;|$)")
+ set(RunCMake_TEST_FAILED "Generated foo pch header\n ${foo_pch_header}\nhas bad content:\n ${foo_pch_header_strings}")
return()
endif()
file(STRINGS ${foobar_pch_header} foobar_pch_header_strings)
-if (NOT "#include \"foo.h\"" IN_LIST foobar_pch_header_strings OR
- NOT "#include <stdio.h>" IN_LIST foobar_pch_header_strings OR
- NOT "#include \"string.h\"" IN_LIST foobar_pch_header_strings OR
- NOT "#include \"bar.h\"" IN_LIST foobar_pch_header_strings)
- set(RunCMake_TEST_FAILED "Generated foobar pch header ${foobar_pch_header} has bad content")
+if (NOT foobar_pch_header_strings MATCHES ";#include \"[^\"]*PrecompileHeaders/include/foo.h\";#include \"foo2.h\";#include <stdio.h>;#include \"string.h\";#include \"[^\"]*PrecompileHeaders/include/bar.h\"(;|$)")
+ set(RunCMake_TEST_FAILED "Generated foobar pch header\n ${foobar_pch_header}\nhas bad content:\n ${foobar_pch_header_strings}")
return()
endif()
diff --git a/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake b/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake
index 9041b09..a1e0792 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake
@@ -4,14 +4,15 @@ project(PchInterface C)
add_library(foo foo.c)
target_include_directories(foo PUBLIC include)
target_precompile_headers(foo PUBLIC
- foo.h
+ include/foo.h
+ \"foo2.h\"
<stdio.h>
\"string.h\"
)
add_library(bar INTERFACE)
target_include_directories(bar INTERFACE include)
-target_precompile_headers(bar INTERFACE bar.h)
+target_precompile_headers(bar INTERFACE include/bar.h)
add_executable(foobar foobar.c)
target_link_libraries(foobar foo bar)
diff --git a/Tests/RunCMake/PrecompileHeaders/foo.c b/Tests/RunCMake/PrecompileHeaders/foo.c
index 974a248..85ea230 100644
--- a/Tests/RunCMake/PrecompileHeaders/foo.c
+++ b/Tests/RunCMake/PrecompileHeaders/foo.c
@@ -1,6 +1,12 @@
#include "foo.h"
+#include "foo2.h"
int foo()
{
return 0;
}
+
+int foo2()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/PrecompileHeaders/foobar.c b/Tests/RunCMake/PrecompileHeaders/foobar.c
index 6dbf8ce..7a135ea 100644
--- a/Tests/RunCMake/PrecompileHeaders/foobar.c
+++ b/Tests/RunCMake/PrecompileHeaders/foobar.c
@@ -1,7 +1,8 @@
#include "bar.h"
#include "foo.h"
+#include "foo2.h"
int main()
{
- return foo() + bar();
+ return foo() + foo2() + bar();
}
diff --git a/Tests/RunCMake/PrecompileHeaders/include/foo2.h b/Tests/RunCMake/PrecompileHeaders/include/foo2.h
new file mode 100644
index 0000000..4bf9c81
--- /dev/null
+++ b/Tests/RunCMake/PrecompileHeaders/include/foo2.h
@@ -0,0 +1,6 @@
+#ifndef foo2_h
+#define foo2_h
+
+int foo2(void);
+
+#endif