diff options
author | Brad King <brad.king@kitware.com> | 2018-03-01 14:25:50 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-03-01 14:28:00 (GMT) |
commit | 7776ce98c3fc1fc656c646ea783c23aee27261a2 (patch) | |
tree | 89664e3d07dddfacb10b7b624a2d8a2da7822b08 /Tests/ExportImport/Export | |
parent | bafe655b11c876b45a5ce1fbaf4643593bdd22a3 (diff) | |
download | CMake-7776ce98c3fc1fc656c646ea783c23aee27261a2.zip CMake-7776ce98c3fc1fc656c646ea783c23aee27261a2.tar.gz CMake-7776ce98c3fc1fc656c646ea783c23aee27261a2.tar.bz2 |
Tests: Add cases for usage requirements of linked object libs
Add tests to cover transitive usage requirements on installation and
export of targets that link to object libraries.
Issue: #14778
Diffstat (limited to 'Tests/ExportImport/Export')
-rw-r--r-- | Tests/ExportImport/Export/CMakeLists.txt | 17 | ||||
-rw-r--r-- | Tests/ExportImport/Export/testLib9.c | 15 | ||||
-rw-r--r-- | Tests/ExportImport/Export/testLib9Obj.c | 4 | ||||
-rw-r--r-- | Tests/ExportImport/Export/testLib9ObjIface.c | 11 | ||||
-rw-r--r-- | Tests/ExportImport/Export/testLib9ObjPriv.c | 4 | ||||
-rw-r--r-- | Tests/ExportImport/Export/testLib9ObjPub.c | 4 |
6 files changed, 48 insertions, 7 deletions
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index 4f663f6..cbc8c6b 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -88,7 +88,17 @@ else() set(maybe_OBJECTS_DESTINATION "") endif() -add_library(testLib9Obj OBJECT testLib9Obj.c) +cmake_policy(PUSH) +cmake_policy(SET CMP0022 NEW) +add_library(testLib9ObjPub OBJECT testLib9ObjPub.c) +target_compile_definitions(testLib9ObjPub INTERFACE testLib9ObjPub_USED) +add_library(testLib9ObjPriv OBJECT testLib9ObjPriv.c) +target_compile_definitions(testLib9ObjPriv INTERFACE testLib9ObjPriv_USED) +add_library(testLib9ObjIface OBJECT testLib9ObjIface.c) +target_compile_definitions(testLib9ObjIface INTERFACE testLib9ObjIface_USED) +add_library(testLib9 STATIC testLib9.c) +target_link_libraries(testLib9 INTERFACE testLib9ObjIface PUBLIC testLib9ObjPub PRIVATE testLib9ObjPriv) +cmake_policy(POP) # Test using the target_link_libraries command to set the # LINK_INTERFACE_LIBRARIES* properties. We construct two libraries @@ -486,6 +496,7 @@ install( testExe1 testLib1 testLib2 testExe2 testLib3 testLib4 testExe3 testExe4 testExe2lib testLib4lib testLib4libdbg testLib4libopt testLib6 testLib7 testLib8 + testLib9 testLibCycleA testLibCycleB testLibNoSONAME cmp0022NEW cmp0022OLD @@ -500,7 +511,7 @@ install( ) install( TARGETS - testLib9Obj + testLib9ObjPub testLib9ObjPriv testLib9ObjIface EXPORT exp ) if (APPLE) @@ -553,7 +564,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3 ) export(TARGETS testExe2 testLib4 testLib5 testLib6 testLib7 testExe3 testExe4 testExe2lib testLib8 - testLib9Obj + testLib9 testLib9ObjPub testLib9ObjPriv testLib9ObjIface testLib4lib testLib4libdbg testLib4libopt testLibCycleA testLibCycleB testLibNoSONAME diff --git a/Tests/ExportImport/Export/testLib9.c b/Tests/ExportImport/Export/testLib9.c new file mode 100644 index 0000000..fe8610b --- /dev/null +++ b/Tests/ExportImport/Export/testLib9.c @@ -0,0 +1,15 @@ +#ifndef testLib9ObjPub_USED +#error "testLib9ObjPub_USED not defined!" +#endif +#ifndef testLib9ObjPriv_USED +#error "testLib9ObjPriv_USED not defined!" +#endif +#ifdef testLib9ObjIface_USED +#error "testLib9ObjIface_USED defined but should not be!" +#endif +int testLib9ObjPub(void); +int testLib9ObjPriv(void); +int testLib9(void) +{ + return (testLib9ObjPub() + testLib9ObjPriv()); +} diff --git a/Tests/ExportImport/Export/testLib9Obj.c b/Tests/ExportImport/Export/testLib9Obj.c deleted file mode 100644 index 6a13e48..0000000 --- a/Tests/ExportImport/Export/testLib9Obj.c +++ /dev/null @@ -1,4 +0,0 @@ -int testLib9Obj(void) -{ - return 0; -} diff --git a/Tests/ExportImport/Export/testLib9ObjIface.c b/Tests/ExportImport/Export/testLib9ObjIface.c new file mode 100644 index 0000000..e75440a --- /dev/null +++ b/Tests/ExportImport/Export/testLib9ObjIface.c @@ -0,0 +1,11 @@ +/* Duplicate symbols from other sources to verify that this source + is not included when the object library is used. */ +int testLib9ObjMissing(void); +int testLib9ObjPub(void) +{ + return testLib9ObjMissing(); +} +int testLib9ObjPriv(void) +{ + return testLib9ObjMissing(); +} diff --git a/Tests/ExportImport/Export/testLib9ObjPriv.c b/Tests/ExportImport/Export/testLib9ObjPriv.c new file mode 100644 index 0000000..6fa63cc --- /dev/null +++ b/Tests/ExportImport/Export/testLib9ObjPriv.c @@ -0,0 +1,4 @@ +int testLib9ObjPriv(void) +{ + return 0; +} diff --git a/Tests/ExportImport/Export/testLib9ObjPub.c b/Tests/ExportImport/Export/testLib9ObjPub.c new file mode 100644 index 0000000..66e2624 --- /dev/null +++ b/Tests/ExportImport/Export/testLib9ObjPub.c @@ -0,0 +1,4 @@ +int testLib9ObjPub(void) +{ + return 0; +} |