summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2007-02-16 21:12:17 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2007-02-16 21:12:17 (GMT)
commitca0230a33eea074a7beee74dd1ecc50134068359 (patch)
treef7daeb6c8c5d353f16c011976b841e116706336b /Tests
parent4d325a45977a00db6d0a8872d751b6cb41071b41 (diff)
downloadCMake-ca0230a33eea074a7beee74dd1ecc50134068359.zip
CMake-ca0230a33eea074a7beee74dd1ecc50134068359.tar.gz
CMake-ca0230a33eea074a7beee74dd1ecc50134068359.tar.bz2
ENH: check in initial conv library stuff
Diffstat (limited to 'Tests')
-rw-r--r--Tests/ConvLibrary/CMakeLists.txt19
-rw-r--r--Tests/ConvLibrary/bar.c4
-rw-r--r--Tests/ConvLibrary/bartest.cxx37
-rw-r--r--Tests/ConvLibrary/foo.cxx4
-rw-r--r--Tests/ConvLibrary/sub1/car.cxx4
5 files changed, 68 insertions, 0 deletions
diff --git a/Tests/ConvLibrary/CMakeLists.txt b/Tests/ConvLibrary/CMakeLists.txt
new file mode 100644
index 0000000..0f4eede
--- /dev/null
+++ b/Tests/ConvLibrary/CMakeLists.txt
@@ -0,0 +1,19 @@
+project(foo)
+
+# create a source list
+set(foo_sources foo.cxx bar.c sub1/car.cxx)
+# create a library foo from the sources
+add_library(foo ${foo_sources})
+# get the object files from the target
+get_target_property(OBJECT_FILES foo OBJECT_FILES)
+message("${OBJECT_FILES}")
+# set the object files as generated
+set_source_files_properties(${OBJECT_FILES} PROPERTIES GENERATED true)
+# create a library bar that contains the object files from foo
+add_library(bar ${OBJECT_FILES})
+# set the linker language since bar only has .obj
+set_target_properties(bar PROPERTIES LINKER_LANGUAGE CXX)
+# make sure foo is built before bar
+add_dependencies(bar foo)
+add_executable(bartest bartest.cxx)
+target_link_libraries(bartest bar)
diff --git a/Tests/ConvLibrary/bar.c b/Tests/ConvLibrary/bar.c
new file mode 100644
index 0000000..d063082
--- /dev/null
+++ b/Tests/ConvLibrary/bar.c
@@ -0,0 +1,4 @@
+int bar()
+{
+ return 20;
+}
diff --git a/Tests/ConvLibrary/bartest.cxx b/Tests/ConvLibrary/bartest.cxx
new file mode 100644
index 0000000..aa3afcb
--- /dev/null
+++ b/Tests/ConvLibrary/bartest.cxx
@@ -0,0 +1,37 @@
+extern "C" int bar();
+int foo();
+int car();
+
+#include <stdio.h>
+int main()
+{
+ if(foo() == 10)
+ {
+ printf("foo is 10!\n");
+ }
+ else
+ {
+ printf("foo is not 10 error!\n");
+ return -1;
+ }
+ if(bar() == 20)
+ {
+ printf("bar is 20!\n");
+ }
+ else
+ {
+ printf("bar is not 20 error!\n");
+ return -1;
+ }
+ if(car() == 30)
+ {
+ printf("bar is 30!\n");
+ }
+ else
+ {
+ printf("bar is not 30 error!\n");
+ return -1;
+ }
+ printf("Test past\n");
+ return 0;
+}
diff --git a/Tests/ConvLibrary/foo.cxx b/Tests/ConvLibrary/foo.cxx
new file mode 100644
index 0000000..1f46ef4
--- /dev/null
+++ b/Tests/ConvLibrary/foo.cxx
@@ -0,0 +1,4 @@
+int foo()
+{
+ return 10;
+}
diff --git a/Tests/ConvLibrary/sub1/car.cxx b/Tests/ConvLibrary/sub1/car.cxx
new file mode 100644
index 0000000..aa66726
--- /dev/null
+++ b/Tests/ConvLibrary/sub1/car.cxx
@@ -0,0 +1,4 @@
+int car()
+{
+ return 30;
+}