diff options
Diffstat (limited to 'Tests/ExportImport')
-rw-r--r-- | Tests/ExportImport/Export/CMakeLists.txt | 33 | ||||
-rw-r--r-- | Tests/ExportImport/Export/testSharedLibDepends.cpp | 8 | ||||
-rw-r--r-- | Tests/ExportImport/Export/testSharedLibDepends.h | 14 | ||||
-rw-r--r-- | Tests/ExportImport/Export/testSharedLibRequired.cpp | 7 | ||||
-rw-r--r-- | Tests/ExportImport/Export/testSharedLibRequired.h | 12 | ||||
-rw-r--r-- | Tests/ExportImport/Import/A/CMakeLists.txt | 11 | ||||
-rw-r--r-- | Tests/ExportImport/Import/A/deps_shared_iface.cpp | 11 |
7 files changed, 95 insertions, 1 deletions
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index 569845a..779d889 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -158,6 +158,36 @@ set_property(TARGET testLibRequired APPEND PROPERTY $<INSTALL_INTERFACE:InstallOnly_DEFINE> ) +include(GenerateExportHeader) + +add_library(testSharedLibRequired SHARED testSharedLibRequired.cpp) +generate_export_header(testSharedLibRequired) +set_property(TARGET testSharedLibRequired APPEND PROPERTY + INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}" +) +set_property(TARGET testSharedLibRequired APPEND PROPERTY + INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}" + "${CMAKE_CURRENT_SOURCE_DIR}" +) + +add_library(testSharedLibDepends SHARED testSharedLibDepends.cpp) +set_property(TARGET testSharedLibDepends APPEND PROPERTY + INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}" +) +generate_export_header(testSharedLibDepends) + +set_property(TARGET testSharedLibDepends APPEND PROPERTY + INTERFACE_INCLUDE_DIRECTORIES + $<TARGET_PROPERTY:testSharedLibRequired,INTERFACE_INCLUDE_DIRECTORIES> +) +set_property(TARGET testSharedLibDepends APPEND PROPERTY + LINK_INTERFACE_LIBRARIES + $<1:$<TARGET_NAME:testSharedLibRequired>> +) + +# LINK_PRIVATE because the LINK_INTERFACE_LIBRARIES is specified above. +target_link_libraries(testSharedLibDepends LINK_PRIVATE testSharedLibRequired) + install(TARGETS testLibRequired testLibIncludeRequired1 testLibIncludeRequired2 @@ -165,10 +195,11 @@ install(TARGETS testLibRequired testLibIncludeRequired4 testLibIncludeRequired5 testLibIncludeRequired6 + testSharedLibRequired EXPORT RequiredExp DESTINATION lib ) install(EXPORT RequiredExp NAMESPACE Req:: FILE testLibRequiredConfig.cmake DESTINATION lib/cmake/testLibRequired) -install(TARGETS testLibDepends EXPORT DependsExp DESTINATION lib ) +install(TARGETS testLibDepends testSharedLibDepends EXPORT DependsExp DESTINATION lib ) install(EXPORT DependsExp FILE testLibDependsConfig.cmake DESTINATION lib/cmake/testLibDepends) diff --git a/Tests/ExportImport/Export/testSharedLibDepends.cpp b/Tests/ExportImport/Export/testSharedLibDepends.cpp new file mode 100644 index 0000000..e279207 --- /dev/null +++ b/Tests/ExportImport/Export/testSharedLibDepends.cpp @@ -0,0 +1,8 @@ + +#include "testSharedLibDepends.h" + +int TestSharedLibDepends::foo() +{ + TestSharedLibRequired req; + return req.foo(); +} diff --git a/Tests/ExportImport/Export/testSharedLibDepends.h b/Tests/ExportImport/Export/testSharedLibDepends.h new file mode 100644 index 0000000..b93143a --- /dev/null +++ b/Tests/ExportImport/Export/testSharedLibDepends.h @@ -0,0 +1,14 @@ + +#ifndef TESTSHAREDLIBDEPENDS_H +#define TESTSHAREDLIBDEPENDS_H + +#include "testsharedlibdepends_export.h" + +#include "testSharedLibRequired.h" + +struct TESTSHAREDLIBDEPENDS_EXPORT TestSharedLibDepends +{ + int foo(); +}; + +#endif diff --git a/Tests/ExportImport/Export/testSharedLibRequired.cpp b/Tests/ExportImport/Export/testSharedLibRequired.cpp new file mode 100644 index 0000000..1ac34aa --- /dev/null +++ b/Tests/ExportImport/Export/testSharedLibRequired.cpp @@ -0,0 +1,7 @@ + +#include "testSharedLibRequired.h" + +int TestSharedLibRequired::foo() +{ + return 0; +} diff --git a/Tests/ExportImport/Export/testSharedLibRequired.h b/Tests/ExportImport/Export/testSharedLibRequired.h new file mode 100644 index 0000000..edaddd4 --- /dev/null +++ b/Tests/ExportImport/Export/testSharedLibRequired.h @@ -0,0 +1,12 @@ + +#ifndef TESTSHAREDLIBREQUIRED_H +#define TESTSHAREDLIBREQUIRED_H + +#include "testsharedlibrequired_export.h" + +struct TESTSHAREDLIBREQUIRED_EXPORT TestSharedLibRequired +{ + int foo(); +}; + +#endif diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index 56cfea0..abb2ab0 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -167,3 +167,14 @@ set_property(TARGET deps_iface APPEND PROPERTY INCLUDE_DIRECTORIES $<TARGET_PROPERTY:testLibDepends,INTERFACE_INCLUDE_DIRECTORIES> ) + +add_executable(deps_shared_iface deps_shared_iface.cpp) +target_link_libraries(deps_shared_iface testSharedLibDepends) +set_property(TARGET deps_shared_iface APPEND PROPERTY + COMPILE_DEFINITIONS + $<TARGET_PROPERTY:testSharedLibDepends,INTERFACE_COMPILE_DEFINITIONS> +) +set_property(TARGET deps_shared_iface APPEND PROPERTY + INCLUDE_DIRECTORIES + $<TARGET_PROPERTY:testSharedLibDepends,INTERFACE_INCLUDE_DIRECTORIES> +) diff --git a/Tests/ExportImport/Import/A/deps_shared_iface.cpp b/Tests/ExportImport/Import/A/deps_shared_iface.cpp new file mode 100644 index 0000000..4f7eb23 --- /dev/null +++ b/Tests/ExportImport/Import/A/deps_shared_iface.cpp @@ -0,0 +1,11 @@ + + +#include "testSharedLibDepends.h" + +int main(int,char **) +{ + TestSharedLibDepends dep; + TestSharedLibRequired req; + + return dep.foo() + req.foo(); +} |