summaryrefslogtreecommitdiffstats
path: root/Tests/ObjectLibrary/CMakeLists.txt
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-03-12 18:41:34 (GMT)
committerBrad King <brad.king@kitware.com>2012-03-16 14:12:30 (GMT)
commit69d3d1835c5f4bdf9fbe5e920517a74d82482455 (patch)
tree3b20f13c838fa2cdfc3af0a0b4041b9359800d94 /Tests/ObjectLibrary/CMakeLists.txt
parentc403f27a2de2327f5c895972e16a81d80968c40c (diff)
downloadCMake-69d3d1835c5f4bdf9fbe5e920517a74d82482455.zip
CMake-69d3d1835c5f4bdf9fbe5e920517a74d82482455.tar.gz
CMake-69d3d1835c5f4bdf9fbe5e920517a74d82482455.tar.bz2
Test OBJECT library success cases
Add "ObjectLibrary" test to build and use OBJECT libraries. Build multiple object libraries in separate directories with different flags. Use a custom command to generate a source file in one OBJECT library. Reference the OBJECT libraries for inclusion in 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. Verify that object library symbols are exported from the shared library.
Diffstat (limited to 'Tests/ObjectLibrary/CMakeLists.txt')
-rw-r--r--Tests/ObjectLibrary/CMakeLists.txt16
1 files changed, 16 insertions, 0 deletions
diff --git a/Tests/ObjectLibrary/CMakeLists.txt b/Tests/ObjectLibrary/CMakeLists.txt
new file mode 100644
index 0000000..1a07d1d
--- /dev/null
+++ b/Tests/ObjectLibrary/CMakeLists.txt
@@ -0,0 +1,16 @@
+cmake_minimum_required(VERSION 2.8)
+project(ObjectLibrary C)
+
+add_subdirectory(A)
+add_subdirectory(B)
+
+add_library(Cstatic STATIC c.c $<TARGET_OBJECTS:A> $<TARGET_OBJECTS:B>)
+add_executable(UseCstatic main.c)
+target_link_libraries(UseCstatic Cstatic)
+
+add_library(Cshared SHARED c.c $<TARGET_OBJECTS:A> $<TARGET_OBJECTS:Bexport>)
+add_executable(UseCshared main.c)
+set_property(TARGET UseCshared PROPERTY COMPILE_DEFINITIONS SHARED_C)
+target_link_libraries(UseCshared Cshared)
+
+add_executable(UseCinternal main.c c.c $<TARGET_OBJECTS:A> $<TARGET_OBJECTS:B>)