ENH: check in initial conv library stuff

This commit is contained in:
Bill Hoffman
2007-02-16 16:12:17 -05:00
parent 4d325a4597
commit ca0230a33e
23 changed files with 305 additions and 15 deletions
+19
View File
@@ -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)
+4
View File
@@ -0,0 +1,4 @@
int bar()
{
return 20;
}
+37
View File
@@ -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;
}
+4
View File
@@ -0,0 +1,4 @@
int foo()
{
return 10;
}
+4
View File
@@ -0,0 +1,4 @@
int car()
{
return 30;
}