diff options
Diffstat (limited to 'Tests/ExportImport/Export')
5 files changed, 52 insertions, 0 deletions
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index 72ae78f..62aa86c 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -426,3 +426,5 @@ export(TARGETS testExe2 testLib4 testLib5 testLib6 testExe3 testExe2lib NAMESPACE bld_ APPEND FILE ExportBuildTree.cmake ) + +add_subdirectory(Interface) diff --git a/Tests/ExportImport/Export/Interface/CMakeLists.txt b/Tests/ExportImport/Export/Interface/CMakeLists.txt new file mode 100644 index 0000000..01e89ef --- /dev/null +++ b/Tests/ExportImport/Export/Interface/CMakeLists.txt @@ -0,0 +1,29 @@ + +add_library(headeronly INTERFACE) +set_property(TARGET headeronly PROPERTY INTERFACE_INCLUDE_DIRECTORIES + "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/headeronly>" + "$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include/headeronly>" +) +set_property(TARGET headeronly PROPERTY INTERFACE_COMPILE_DEFINITIONS "HEADERONLY_DEFINE") + +include(GenerateExportHeader) +add_library(sharedlib SHARED sharedlib.cpp) +generate_export_header(sharedlib) +set_property(TARGET sharedlib PROPERTY INCLUDE_DIRECTORIES + "${CMAKE_CURRENT_SOURCE_DIR}/sharedlib" + "${CMAKE_CURRENT_BINARY_DIR}" +) +set_property(TARGET sharedlib PROPERTY INTERFACE_INCLUDE_DIRECTORIES + "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/sharedlib;${CMAKE_CURRENT_BINARY_DIR}>" + "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/sharedlib>" +) + +set_property(TARGET sharedlib PROPERTY INTERFACE_COMPILE_DEFINITIONS "SHAREDLIB_DEFINE") + +add_library(sharediface INTERFACE) +target_link_libraries(sharediface INTERFACE sharedlib) + +export(TARGETS sharediface sharedlib headeronly + NAMESPACE bld_ + FILE ../ExportInterfaceBuildTree.cmake +) diff --git a/Tests/ExportImport/Export/Interface/headeronly/headeronly.h b/Tests/ExportImport/Export/Interface/headeronly/headeronly.h new file mode 100644 index 0000000..3673c21 --- /dev/null +++ b/Tests/ExportImport/Export/Interface/headeronly/headeronly.h @@ -0,0 +1,7 @@ + +enum { one }; + +struct HeaderOnly +{ + int foo() const { return 0; } +}; diff --git a/Tests/ExportImport/Export/Interface/sharedlib.cpp b/Tests/ExportImport/Export/Interface/sharedlib.cpp new file mode 100644 index 0000000..88ca713 --- /dev/null +++ b/Tests/ExportImport/Export/Interface/sharedlib.cpp @@ -0,0 +1,7 @@ + +#include "sharedlib.h" + +int SharedLibObject::foo() const +{ + return 0; +} diff --git a/Tests/ExportImport/Export/Interface/sharedlib/sharedlib.h b/Tests/ExportImport/Export/Interface/sharedlib/sharedlib.h new file mode 100644 index 0000000..aad9ef3 --- /dev/null +++ b/Tests/ExportImport/Export/Interface/sharedlib/sharedlib.h @@ -0,0 +1,7 @@ + +#include "sharedlib_export.h" + +struct SHAREDLIB_EXPORT SharedLibObject +{ + int foo() const; +}; |