summaryrefslogtreecommitdiffstats
path: root/Tests/ObjectLibrary/c.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-03-12 18:41:34 (GMT)
committerBrad King <brad.king@kitware.com>2012-03-16 14:12:30 (GMT)
commit69d3d1835c5f4bdf9fbe5e920517a74d82482455 (patch)
tree3b20f13c838fa2cdfc3af0a0b4041b9359800d94 /Tests/ObjectLibrary/c.c
parentc403f27a2de2327f5c895972e16a81d80968c40c (diff)
downloadCMake-69d3d1835c5f4bdf9fbe5e920517a74d82482455.zip
CMake-69d3d1835c5f4bdf9fbe5e920517a74d82482455.tar.gz
CMake-69d3d1835c5f4bdf9fbe5e920517a74d82482455.tar.bz2
Test OBJECT library success cases
Add "ObjectLibrary" test to build and use OBJECT libraries. Build multiple object libraries in separate directories with different flags. Use a custom command to generate a source file in one OBJECT library. Reference the OBJECT libraries for inclusion in a STATIC library, a SHARED library, and an EXECUTABLE target. Use the static and shared libraries each in executables that end up using the object library symbols. Verify that object library symbols are exported from the shared library.
Diffstat (limited to 'Tests/ObjectLibrary/c.c')
-rw-r--r--Tests/ObjectLibrary/c.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/Tests/ObjectLibrary/c.c b/Tests/ObjectLibrary/c.c
new file mode 100644
index 0000000..968095b
--- /dev/null
+++ b/Tests/ObjectLibrary/c.c
@@ -0,0 +1,19 @@
+#if defined(_WIN32) && defined(Cshared_EXPORTS)
+# define EXPORT_C __declspec(dllexport)
+#else
+# define EXPORT_C
+#endif
+
+extern int a1(void);
+extern int a2(void);
+extern int b1(void);
+extern int b2(void);
+EXPORT_C int c(void)
+{
+ return 0
+ + a1()
+ + a2()
+ + b1()
+ + b2()
+ ;
+}