summaryrefslogtreecommitdiff
path: root/Tests/ForceInclude
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-01-03 10:02:16 -0500
committerBrad King <brad.king@kitware.com>2011-01-03 10:02:16 -0500
commitb29eadd8f38fcfd7b0635501f5e1429e7cb69865 (patch)
tree0c40f3a44304954cfe2a7f5d07fb3b0e09af86ef /Tests/ForceInclude
parentedff9207ed82d241077d66b20087657f74e8b5b9 (diff)
downloadcmake-b29eadd8f38fcfd7b0635501f5e1429e7cb69865.tar.gz
Map multiple /FI flags for VS < 10 (#11649)
The /FI flag may be repeated so the flag table entry needs to be marked with SemicolonAppendable. This was already the case for VS 10.
Diffstat (limited to 'Tests/ForceInclude')
-rw-r--r--Tests/ForceInclude/CMakeLists.txt10
-rw-r--r--Tests/ForceInclude/foo.c7
-rw-r--r--Tests/ForceInclude/foo1.h1
-rw-r--r--Tests/ForceInclude/foo2.h1
4 files changed, 19 insertions, 0 deletions
diff --git a/Tests/ForceInclude/CMakeLists.txt b/Tests/ForceInclude/CMakeLists.txt
new file mode 100644
index 0000000000..5c02ebbd09
--- /dev/null
+++ b/Tests/ForceInclude/CMakeLists.txt
@@ -0,0 +1,10 @@
+cmake_minimum_required(VERSION 2.8.3.20110103)
+project(ForceInclude C)
+
+# Make sure the proper compiler is in use.
+if(NOT MSVC AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$")
+ message(FATAL_ERROR "The ForceInclude test works only with MSVC or Intel")
+endif()
+
+add_executable(foo foo.c)
+set_property(SOURCE foo.c PROPERTY COMPILE_FLAGS "/FIfoo1.h /FIfoo2.h")
diff --git a/Tests/ForceInclude/foo.c b/Tests/ForceInclude/foo.c
new file mode 100644
index 0000000000..af898f4aa6
--- /dev/null
+++ b/Tests/ForceInclude/foo.c
@@ -0,0 +1,7 @@
+#ifndef FOO_1
+# error "foo1.h not included by /FI"
+#endif
+#ifndef FOO_2
+# error "foo2.h not included by /FI"
+#endif
+int main(void) { return 0; }
diff --git a/Tests/ForceInclude/foo1.h b/Tests/ForceInclude/foo1.h
new file mode 100644
index 0000000000..2c1cb7bb3c
--- /dev/null
+++ b/Tests/ForceInclude/foo1.h
@@ -0,0 +1 @@
+#define FOO_1
diff --git a/Tests/ForceInclude/foo2.h b/Tests/ForceInclude/foo2.h
new file mode 100644
index 0000000000..e47524dfae
--- /dev/null
+++ b/Tests/ForceInclude/foo2.h
@@ -0,0 +1 @@
+#define FOO_2