You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ts...@apache.org on 2020/02/09 20:19:47 UTC

[logging-log4cxx] 07/49: Build examples when building tests

This is an automated email from the ASF dual-hosted git repository.

tschoening pushed a commit to branch ghpr_14_replace-ant-build-with-cmake
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git

commit c244c28c01ec609a2371a861c2e960af6a372ed6
Author: Stephen Webb <st...@sabreautonomous.com.au>
AuthorDate: Fri Jan 31 12:44:27 2020 +1100

    Build examples when building tests
---
 src/CMakeLists.txt              | 1 +
 src/examples/cpp/CMakeLists.txt | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index fced9be..39420dd 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -9,4 +9,5 @@ endif()
 
 if(BUILD_TESTING)
    add_subdirectory(test)
+   add_subdirectory(examples/cpp)
 endif()
diff --git a/src/examples/cpp/CMakeLists.txt b/src/examples/cpp/CMakeLists.txt
new file mode 100644
index 0000000..ed0412a
--- /dev/null
+++ b/src/examples/cpp/CMakeLists.txt
@@ -0,0 +1,7 @@
+set(ALL_LOG4CXX_EXAMPLES console delayedloop stream trivial)
+
+foreach(exampleName IN LISTS ALL_LOG4CXX_EXAMPLES)
+    add_executable(${exampleName} ${exampleName}.cpp)
+    target_include_directories(${exampleName} PRIVATE ${CMAKE_CURRENT_LIST_DIR} $<TARGET_PROPERTY:log4cxx,INCLUDE_DIRECTORIES>)
+    target_link_libraries(${exampleName} PRIVATE log4cxx ${APR_LIBRARIES})
+endforeach()