blob: bf1ab837779a91134980641e90a1abd1c722e88d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
project(ConvLibrary)
# 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)
|