[cmake-commits] hoffman committed CMakeLists.txt NONE 1.1 bar.c NONE
1.1 bartest.cxx NONE 1.1 foo.cxx NONE 1.1
cmake-commits at cmake.org
cmake-commits at cmake.org
Fri Feb 16 16:12:19 EST 2007
Update of /cvsroot/CMake/CMake/Tests/ConvLibrary
In directory public:/mounts/ram/cvs-serv9088/Tests/ConvLibrary
Added Files:
CMakeLists.txt bar.c bartest.cxx foo.cxx
Log Message:
ENH: check in initial conv library stuff
--- NEW FILE: bartest.cxx ---
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;
}
--- NEW FILE: CMakeLists.txt ---
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)
--- NEW FILE: foo.cxx ---
int foo()
{
return 10;
}
--- NEW FILE: bar.c ---
int bar()
{
return 20;
}
More information about the Cmake-commits
mailing list