summaryrefslogtreecommitdiff
path: root/Tests/ForceInclude
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2012-10-30 15:39:57 -0700
committerAnas Nashif <anas.nashif@intel.com>2012-10-30 15:39:57 -0700
commit035c7fabc3b82cbc9a346c11abe2e9462b4c0379 (patch)
tree7e40f5a790eae329a8c5d3e59f046451767956ff /Tests/ForceInclude
downloadcmake-035c7fabc3b82cbc9a346c11abe2e9462b4c0379.tar.gz
cmake-035c7fabc3b82cbc9a346c11abe2e9462b4c0379.tar.bz2
cmake-035c7fabc3b82cbc9a346c11abe2e9462b4c0379.zip
Imported Upstream version 2.8.9upstream/2.8.9
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 000000000..5c02ebbd0
--- /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 000000000..af898f4aa
--- /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 000000000..2c1cb7bb3
--- /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 000000000..e47524dfa
--- /dev/null
+++ b/Tests/ForceInclude/foo2.h
@@ -0,0 +1 @@
+#define FOO_2