From 7b46d443b0418b4b7a4b66e046a3dc28585821d0 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 8 Jan 2020 03:32:39 +0300 Subject: cmake/examples: more distinct output --- cmake/examples/boost/foo.cpp | 2 +- cmake/examples/dynamic/CMakeLists.txt | 8 ++++---- cmake/examples/dynamic/bar.cpp | 7 ------- cmake/examples/dynamic/bar.hpp | 6 ------ cmake/examples/dynamic/baz.cpp | 7 +++++++ cmake/examples/dynamic/baz.hpp | 6 ++++++ cmake/examples/dynamic/foo.cpp | 4 ++-- cmake/examples/simple/foo.cpp | 2 +- 8 files changed, 21 insertions(+), 21 deletions(-) delete mode 100644 cmake/examples/dynamic/bar.cpp delete mode 100644 cmake/examples/dynamic/bar.hpp create mode 100644 cmake/examples/dynamic/baz.cpp create mode 100644 cmake/examples/dynamic/baz.hpp (limited to 'cmake/examples') diff --git a/cmake/examples/boost/foo.cpp b/cmake/examples/boost/foo.cpp index b5db3b5..e5b7704 100644 --- a/cmake/examples/boost/foo.cpp +++ b/cmake/examples/boost/foo.cpp @@ -3,6 +3,6 @@ #include int main(int argc, char* argv[]) { - std::cout << boost::filesystem::absolute(boost::filesystem::path{argv[0]}).string() << "\n"; + std::cout << "Hello from " << boost::filesystem::absolute(boost::filesystem::path{argv[0]}).string() << "!\n"; return 0; } diff --git a/cmake/examples/dynamic/CMakeLists.txt b/cmake/examples/dynamic/CMakeLists.txt index 013cde1..1a602d6 100644 --- a/cmake/examples/dynamic/CMakeLists.txt +++ b/cmake/examples/dynamic/CMakeLists.txt @@ -4,10 +4,10 @@ project(example_dynamic) include(../../common.cmake) -add_library(bar SHARED bar.cpp) -target_include_directories(bar PUBLIC .) +add_library(baz SHARED baz.cpp) +target_include_directories(baz PUBLIC .) add_executable(foo foo.cpp) -target_link_libraries(foo PRIVATE bar) +target_link_libraries(foo PRIVATE baz) -install(TARGETS foo bar RUNTIME DESTINATION bin LIBRARY DESTINATION lib) +install(TARGETS foo baz RUNTIME DESTINATION bin LIBRARY DESTINATION lib) diff --git a/cmake/examples/dynamic/bar.cpp b/cmake/examples/dynamic/bar.cpp deleted file mode 100644 index 37aa9b5..0000000 --- a/cmake/examples/dynamic/bar.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "bar.hpp" - -#include - -void bar() { - std::cout << "bar\n"; -} diff --git a/cmake/examples/dynamic/bar.hpp b/cmake/examples/dynamic/bar.hpp deleted file mode 100644 index cf838ca..0000000 --- a/cmake/examples/dynamic/bar.hpp +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -#ifdef _MSC_VER -__declspec(dllexport) -#endif -void bar(); diff --git a/cmake/examples/dynamic/baz.cpp b/cmake/examples/dynamic/baz.cpp new file mode 100644 index 0000000..d108ae3 --- /dev/null +++ b/cmake/examples/dynamic/baz.cpp @@ -0,0 +1,7 @@ +#include "baz.hpp" + +#include + +void baz() { + std::cout << "baz\n"; +} diff --git a/cmake/examples/dynamic/baz.hpp b/cmake/examples/dynamic/baz.hpp new file mode 100644 index 0000000..505a3c4 --- /dev/null +++ b/cmake/examples/dynamic/baz.hpp @@ -0,0 +1,6 @@ +#pragma once + +#ifdef _MSC_VER +__declspec(dllexport) +#endif +void baz(); diff --git a/cmake/examples/dynamic/foo.cpp b/cmake/examples/dynamic/foo.cpp index c6355a2..b7d9986 100644 --- a/cmake/examples/dynamic/foo.cpp +++ b/cmake/examples/dynamic/foo.cpp @@ -1,6 +1,6 @@ -#include +#include int main() { - bar(); + baz(); return 0; } diff --git a/cmake/examples/simple/foo.cpp b/cmake/examples/simple/foo.cpp index 8b6a1d7..b9d3132 100644 --- a/cmake/examples/simple/foo.cpp +++ b/cmake/examples/simple/foo.cpp @@ -1,6 +1,6 @@ #include int main() { - std::cout << "Hello, world!\n"; + std::cout << "foo\n"; return 0; } -- cgit v1.2.3