From d25912889434de4eff7ec581374d656590fce5a7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 1 Sep 2009 10:38:36 -0400 Subject: Test link multiplicity export/import We test that LINK_INTERFACE_MULTIPLICITY propagates through export() and install(EXPORT) into dependent projects. A simple cycle of two archives that need to be scanned three times ensures that the importing project uses the multiplicity correctly. --- Tests/ExportImport/Export/CMakeLists.txt | 11 +++++++++++ Tests/ExportImport/Export/testLibCycleA1.c | 2 ++ Tests/ExportImport/Export/testLibCycleA2.c | 2 ++ Tests/ExportImport/Export/testLibCycleA3.c | 2 ++ Tests/ExportImport/Export/testLibCycleB1.c | 2 ++ Tests/ExportImport/Export/testLibCycleB2.c | 2 ++ Tests/ExportImport/Export/testLibCycleB3.c | 1 + Tests/ExportImport/Import/A/CMakeLists.txt | 2 ++ Tests/ExportImport/Import/A/imp_testExe1.c | 3 ++- 9 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 Tests/ExportImport/Export/testLibCycleA1.c create mode 100644 Tests/ExportImport/Export/testLibCycleA2.c create mode 100644 Tests/ExportImport/Export/testLibCycleA3.c create mode 100644 Tests/ExportImport/Export/testLibCycleB1.c create mode 100644 Tests/ExportImport/Export/testLibCycleB2.c create mode 100644 Tests/ExportImport/Export/testLibCycleB3.c diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index 0dd2550..235a1d2 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -73,12 +73,22 @@ target_link_libraries(testLib4 add_executable(testExe3 testExe3.c) set_property(TARGET testExe3 PROPERTY MACOSX_BUNDLE 1) +# Test cyclic dependencies. +add_library(testLibCycleA STATIC + testLibCycleA1.c testLibCycleA2.c testLibCycleA3.c) +add_library(testLibCycleB STATIC + testLibCycleB1.c testLibCycleB2.c testLibCycleB3.c) +target_link_libraries(testLibCycleA testLibCycleB) +target_link_libraries(testLibCycleB testLibCycleA) +set_property(TARGET testLibCycleA PROPERTY LINK_INTERFACE_MULTIPLICITY 3) + # Install and export from install tree. install( TARGETS testExe1 testLib1 testLib2 testExe2 testLib3 testLib4 testExe3 testExe2lib testLib4lib testLib4libdbg testLib4libopt testLib6 + testLibCycleA testLibCycleB EXPORT exp RUNTIME DESTINATION bin LIBRARY DESTINATION lib NAMELINK_SKIP @@ -116,6 +126,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3 ) export(TARGETS testExe2 testLib4 testLib5 testLib6 testExe3 testExe2lib testLib4lib testLib4libdbg testLib4libopt + testLibCycleA testLibCycleB NAMESPACE bld_ APPEND FILE ExportBuildTree.cmake ) diff --git a/Tests/ExportImport/Export/testLibCycleA1.c b/Tests/ExportImport/Export/testLibCycleA1.c new file mode 100644 index 0000000..3db9e53 --- /dev/null +++ b/Tests/ExportImport/Export/testLibCycleA1.c @@ -0,0 +1,2 @@ +extern int testLibCycleB1(void); +int testLibCycleA1(void) { return testLibCycleB1(); } diff --git a/Tests/ExportImport/Export/testLibCycleA2.c b/Tests/ExportImport/Export/testLibCycleA2.c new file mode 100644 index 0000000..29ad46d --- /dev/null +++ b/Tests/ExportImport/Export/testLibCycleA2.c @@ -0,0 +1,2 @@ +extern int testLibCycleB2(void); +int testLibCycleA2(void) { return testLibCycleB2(); } diff --git a/Tests/ExportImport/Export/testLibCycleA3.c b/Tests/ExportImport/Export/testLibCycleA3.c new file mode 100644 index 0000000..565447b --- /dev/null +++ b/Tests/ExportImport/Export/testLibCycleA3.c @@ -0,0 +1,2 @@ +extern int testLibCycleB3(void); +int testLibCycleA3(void) { return testLibCycleB3(); } diff --git a/Tests/ExportImport/Export/testLibCycleB1.c b/Tests/ExportImport/Export/testLibCycleB1.c new file mode 100644 index 0000000..36cb7b0 --- /dev/null +++ b/Tests/ExportImport/Export/testLibCycleB1.c @@ -0,0 +1,2 @@ +extern int testLibCycleA2(void); +int testLibCycleB1(void) { return testLibCycleA2(); } diff --git a/Tests/ExportImport/Export/testLibCycleB2.c b/Tests/ExportImport/Export/testLibCycleB2.c new file mode 100644 index 0000000..ff12093 --- /dev/null +++ b/Tests/ExportImport/Export/testLibCycleB2.c @@ -0,0 +1,2 @@ +extern int testLibCycleA3(void); +int testLibCycleB2(void) { return testLibCycleA3(); } diff --git a/Tests/ExportImport/Export/testLibCycleB3.c b/Tests/ExportImport/Export/testLibCycleB3.c new file mode 100644 index 0000000..ca8d470 --- /dev/null +++ b/Tests/ExportImport/Export/testLibCycleB3.c @@ -0,0 +1 @@ +int testLibCycleB3(void) { return 0; } diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index f6536df..34b8717 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -29,6 +29,7 @@ target_link_libraries(imp_testExe1 exp_testLib4 exp_testLib5 exp_testLib6 + exp_testLibCycleA ) # Try building a plugin to an executable imported from the install tree. @@ -60,6 +61,7 @@ target_link_libraries(imp_testExe1b bld_testLib4 bld_testLib5 bld_testLib6 + bld_testLibCycleA ) # Try building a plugin to an executable imported from the build tree. diff --git a/Tests/ExportImport/Import/A/imp_testExe1.c b/Tests/ExportImport/Import/A/imp_testExe1.c index b690d99..451998a 100644 --- a/Tests/ExportImport/Import/A/imp_testExe1.c +++ b/Tests/ExportImport/Import/A/imp_testExe1.c @@ -6,6 +6,7 @@ extern int testLib4(); extern int testLib4lib(); extern int testLib5(); extern int testLib6(); +extern int testLibCycleA1(); /* Switch a symbol between debug and optimized builds to make sure the proper library is found from the testLib4 link interface. */ @@ -19,6 +20,6 @@ extern testLib4libcfg(void); int main() { return (testLib2() + generated_by_testExe1() + testLib3() + testLib4() - + testLib5() + testLib6() + + testLib5() + testLib6() + testLibCycleA1() + generated_by_testExe3() + testLib4lib() + testLib4libcfg()); } -- cgit v0.12