From 0e06788c0a5bd2a85db4b1559d13ead30ea5be0e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 30 Oct 2013 13:21:53 +0100 Subject: CMP0022: Add test for target_link_libraries plain signature --- .../target_link_libraries/cmp0022/CMakeLists.txt | 7 +++++++ .../target_link_libraries/cmp0022/onlyplainlib1.cpp | 13 +++++++++++++ .../target_link_libraries/cmp0022/onlyplainlib1.h | 14 ++++++++++++++ .../target_link_libraries/cmp0022/onlyplainlib2.cpp | 8 ++++++++ .../target_link_libraries/cmp0022/onlyplainlib2.h | 7 +++++++ .../target_link_libraries/cmp0022/onlyplainlib_user.cpp | 7 +++++++ 6 files changed, 56 insertions(+) create mode 100644 Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.cpp create mode 100644 Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.h create mode 100644 Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib2.cpp create mode 100644 Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib2.h create mode 100644 Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib_user.cpp diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt index 33757b6..818b8c9 100644 --- a/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt @@ -28,3 +28,10 @@ endif() add_executable(staticlib_exe staticlib_exe.cpp) target_link_libraries(staticlib_exe staticlib1) + +add_library(onlyplainlib1 SHARED onlyplainlib1.cpp) +add_library(onlyplainlib2 SHARED onlyplainlib2.cpp) +target_link_libraries(onlyplainlib2 onlyplainlib1) + +add_executable(onlyplainlib_user onlyplainlib_user.cpp) +target_link_libraries(onlyplainlib_user onlyplainlib2) diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.cpp b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.cpp new file mode 100644 index 0000000..41dc3ce --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.cpp @@ -0,0 +1,13 @@ + +#include "onlyplainlib1.h" + +OnlyPlainLib1::OnlyPlainLib1() + : result(0) +{ + +} + +int OnlyPlainLib1::GetResult() +{ + return result; +} diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.h b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.h new file mode 100644 index 0000000..c0373ce --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.h @@ -0,0 +1,14 @@ + +struct +#ifdef _WIN32 +__declspec(dllexport) +#endif +OnlyPlainLib1 +{ + OnlyPlainLib1(); + + int GetResult(); + +private: + int result; +}; diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib2.cpp b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib2.cpp new file mode 100644 index 0000000..2865ae9 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib2.cpp @@ -0,0 +1,8 @@ + +#include "onlyplainlib2.h" + +OnlyPlainLib1 onlyPlainLib2() +{ + OnlyPlainLib1 opl1; + return opl1; +} diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib2.h b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib2.h new file mode 100644 index 0000000..74b18a0 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib2.h @@ -0,0 +1,7 @@ + +#include "onlyplainlib1.h" + +#ifdef _WIN32 +__declspec(dllexport) +#endif +OnlyPlainLib1 onlyPlainLib2(); diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib_user.cpp b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib_user.cpp new file mode 100644 index 0000000..0fb7b0a --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib_user.cpp @@ -0,0 +1,7 @@ + +#include "onlyplainlib2.h" + +int main(int argc, char **argv) +{ + return onlyPlainLib2().GetResult(); +} -- cgit v0.12