diff options
| author | Egor Tensin <egor@tensin.name> | 2026-03-30 11:49:10 +0200 |
|---|---|---|
| committer | Egor Tensin <egor@tensin.name> | 2026-03-30 11:54:40 +0200 |
| commit | 4cd3a9cdf65a8f0b96de21420b98b8e02181e4f4 (patch) | |
| tree | 08b54a4313cdb41a883b244ffcbb423dbf7ced46 /test/examples/simple | |
| parent | remove examples "dynamic" & "static" (diff) | |
| download | cmake-common-4cd3a9cdf65a8f0b96de21420b98b8e02181e4f4.tar.gz cmake-common-4cd3a9cdf65a8f0b96de21420b98b8e02181e4f4.zip | |
move testing-only things into test/
Diffstat (limited to 'test/examples/simple')
| -rw-r--r-- | test/examples/simple/CMakeLists.txt | 11 | ||||
| -rw-r--r-- | test/examples/simple/baz.cpp | 7 | ||||
| -rw-r--r-- | test/examples/simple/baz.hpp | 9 | ||||
| -rw-r--r-- | test/examples/simple/foo.cpp | 9 |
4 files changed, 36 insertions, 0 deletions
diff --git a/test/examples/simple/CMakeLists.txt b/test/examples/simple/CMakeLists.txt new file mode 100644 index 0000000..50a588b --- /dev/null +++ b/test/examples/simple/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.15) + +project(example_simple) + +add_library(baz SHARED baz.cpp) +target_include_directories(baz PUBLIC .) + +add_executable(foo foo.cpp) +target_link_libraries(foo PRIVATE baz) + +install(TARGETS foo baz RUNTIME DESTINATION bin LIBRARY DESTINATION lib) diff --git a/test/examples/simple/baz.cpp b/test/examples/simple/baz.cpp new file mode 100644 index 0000000..d108ae3 --- /dev/null +++ b/test/examples/simple/baz.cpp @@ -0,0 +1,7 @@ +#include "baz.hpp" + +#include <iostream> + +void baz() { + std::cout << "baz\n"; +} diff --git a/test/examples/simple/baz.hpp b/test/examples/simple/baz.hpp new file mode 100644 index 0000000..2fc9b2a --- /dev/null +++ b/test/examples/simple/baz.hpp @@ -0,0 +1,9 @@ +#pragma once + +#ifdef _MSC_VER +#define DLLEXPORT __declspec(dllexport) +#else +#define DLLEXPORT +#endif + +DLLEXPORT void baz(); diff --git a/test/examples/simple/foo.cpp b/test/examples/simple/foo.cpp new file mode 100644 index 0000000..7e928e1 --- /dev/null +++ b/test/examples/simple/foo.cpp @@ -0,0 +1,9 @@ +#include <baz.hpp> + +#include <iostream> + +int main() { + std::cout << "foo\n"; + baz(); + return 0; +} |
