summaryrefslogtreecommitdiffstats
path: root/Tests/ObjectLibrary/mainAB.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-03-14 13:24:26 (GMT)
committerBrad King <brad.king@kitware.com>2012-03-16 14:12:30 (GMT)
commitc3242500b62c3f81af46e086cc2225b53c023167 (patch)
tree48775b5f5b7bf192b1486cbb336e6e8430921510 /Tests/ObjectLibrary/mainAB.c
parentdb7ef82402bed3d941bea73d266ac5919f4eee15 (diff)
downloadCMake-c3242500b62c3f81af46e086cc2225b53c023167.zip
CMake-c3242500b62c3f81af46e086cc2225b53c023167.tar.gz
CMake-c3242500b62c3f81af46e086cc2225b53c023167.tar.bz2
Test OBJECT library use without other sources
Reference OBJECT libraries for inclusion in targets that have no other sources to verify that the linker language propagates correctly from the object libraries. Test with 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. In VS 6, 7, and 7.1 add a dummy object file to convince the IDE to build the targets without sources. In Xcode add a dummy source file to convince it to build targets without sources.
Diffstat (limited to 'Tests/ObjectLibrary/mainAB.c')
-rw-r--r--Tests/ObjectLibrary/mainAB.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/Tests/ObjectLibrary/mainAB.c b/Tests/ObjectLibrary/mainAB.c
new file mode 100644
index 0000000..556898b
--- /dev/null
+++ b/Tests/ObjectLibrary/mainAB.c
@@ -0,0 +1,22 @@
+#if defined(_WIN32) && defined(SHARED_B)
+# define IMPORT_B __declspec(dllimport)
+#else
+# define IMPORT_B
+#endif
+extern IMPORT_B int b1(void);
+extern IMPORT_B int b2(void);
+#ifndef NO_A
+extern int a1(void);
+extern int a2(void);
+#endif
+int main(void)
+{
+ return 0
+#ifndef NO_A
+ + a1()
+ + a2()
+#endif
+ + b1()
+ + b2()
+ ;
+}