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:41 UTC

[logging-log4cxx] 01/49: Add support for building and testing with cmake

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 a85331089549d24401db642575b1e893a38a7450
Author: Stephen Webb <st...@sabreautonomous.com.au>
AuthorDate: Sun Oct 6 14:48:33 2019 +1100

    Add support for building and testing with cmake
---
 CMakeLists.txt                           |  53 ++++++++++
 src/CMakeLists.txt                       |  12 +++
 src/main/CMakeLists.txt                  |   9 ++
 src/main/cpp/CMakeLists.txt              | 165 +++++++++++++++++++++++++++++++
 src/main/include/CMakeLists.txt          |  97 ++++++++++++++++++
 src/test/CMakeLists.txt                  |   1 +
 src/test/cpp/CMakeLists.txt              |  63 ++++++++++++
 src/test/cpp/customlogger/CMakeLists.txt |   2 +
 src/test/cpp/db/CMakeLists.txt           |   3 +
 src/test/cpp/defaultinit/CMakeLists.txt  |   2 +
 src/test/cpp/filter/CMakeLists.txt       |   9 ++
 src/test/cpp/helpers/CMakeLists.txt      |  28 ++++++
 src/test/cpp/net/CMakeLists.txt          |  15 +++
 src/test/cpp/nt/CMakeLists.txt           |   2 +
 src/test/cpp/pattern/CMakeLists.txt      |   2 +
 src/test/cpp/rolling/CMakeLists.txt      |  14 +++
 src/test/cpp/spi/CMakeLists.txt          |   2 +
 src/test/cpp/util/CMakeLists.txt         |  21 ++++
 src/test/cpp/varia/CMakeLists.txt        |  10 ++
 src/test/cpp/xml/CMakeLists.txt          |   7 ++
 20 files changed, 517 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..5286f30
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,53 @@
+cmake_minimum_required(VERSION 3.13)
+project(log4cxx VERSION 0.10.0 LANGUAGES CXX)
+
+# Find Apache Runtime
+find_package(apr QUIET)
+# If APR find module sets the cache, the following will do nothing
+find_path(APR_INCLUDE_DIR apr.h)
+find_library(APR_LIBRARIES NAMES libapr-1 apr-1)
+
+# Find Apache Runtime Utilities
+find_package(apr-util QUIET)
+# If APR-UTIL find module sets the cache, the following will do nothing
+find_path(APR_UTIL_INCLUDE_DIR apu.h)
+find_library(APR_UTIL_LIBRARIES NAMES libaprutil-1 aprutil-1)
+
+## Testing
+option(TEST_LOG4CXX "Build log4cxx tests" ON)
+if(TEST_LOG4CXX)
+  enable_testing()
+endif()
+
+# Building
+add_subdirectory(src)
+
+## Installing
+install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/src/main/include/log4cxx
+  DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+  FILES_MATCHING PATTERN "*.h"
+)
+install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/main/include/log4cxx
+  DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+  FILES_MATCHING PATTERN "*.h"
+)
+
+install(TARGETS log4cxx EXPORT log4cxxTargets
+  RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 
+  ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+  INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+)
+IF(LOG4CXX_INSTALL_PDB)
+  INSTALL(FILES log4cxx.pdb
+          DESTINATION ${CMAKE_INSTALL_BINDIR}
+          CONFIGURATIONS RelWithDebInfo Debug
+  )
+ENDIF()
+
+# create export file which can be imported by other cmake projects
+install(EXPORT log4cxxTargets
+  FILE log4cxx-targets.cmake
+  NAMESPACE log4cxx::
+  DESTINATION lib/cmake/log4cxx
+)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..95e66e1
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,12 @@
+add_subdirectory(main)
+target_include_directories(log4cxx INTERFACE $<INSTALL_INTERFACE:include> PRIVATE ${APR_INCLUDE_DIR} ${APR_UTIL_INCLUDE_DIR})
+target_link_libraries(log4cxx PRIVATE ${APR_LIBRARIES} ${APR_UTIL_LIBRARIES})
+if(WIN32)
+# The ODBC appender is always enabled in the Windows configuration
+target_link_libraries(log4cxx PRIVATE odbc32.lib)
+option(LOG4CXX_INSTALL_PDB "Install .pdb files (if generated)"  ON)
+endif()
+
+if(TEST_LOG4CXX)
+  add_subdirectory(test)
+endif()
diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt
new file mode 100644
index 0000000..12cb4c9
--- /dev/null
+++ b/src/main/CMakeLists.txt
@@ -0,0 +1,9 @@
+add_subdirectory(include)
+add_subdirectory(cpp)
+
+# setup include directories 
+include(GNUInstallDirs)
+target_include_directories(log4cxx PUBLIC 
+  $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
+  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+)
diff --git a/src/main/cpp/CMakeLists.txt b/src/main/cpp/CMakeLists.txt
new file mode 100644
index 0000000..3571cf5
--- /dev/null
+++ b/src/main/cpp/CMakeLists.txt
@@ -0,0 +1,165 @@
+
+# Options
+option(LOG4CXX_BLOCKING_ASYNC_APPENDER "Async appender behaviour" ON)
+option(BUILD_SHARED_LIBS "Build shared libraries" ON)
+
+# Build the log4cxx library
+add_library(log4cxx action.cpp)
+if(BUILD_SHARED_LIBS)
+    target_compile_definitions(log4cxx PRIVATE LOG4CXX)
+else()
+    target_compile_definitions(log4cxx PUBLIC LOG4CXX_STATIC)
+endif()
+add_dependencies(log4cxx configure_log4cxx)
+target_sources(log4cxx
+  PRIVATE
+  andfilter.cpp
+  appenderattachableimpl.cpp
+  appenderskeleton.cpp
+  aprinitializer.cpp
+  $<IF:$<BOOL:LOG4CXX_BLOCKING_ASYNC_APPENDER>,asyncappender.cpp,asyncappender_nonblocking.cpp>
+  basicconfigurator.cpp
+  bufferedwriter.cpp
+  bytearrayinputstream.cpp
+  bytearrayoutputstream.cpp
+  bytebuffer.cpp
+  cacheddateformat.cpp
+  charsetdecoder.cpp
+  charsetencoder.cpp
+  class.cpp
+  classnamepatternconverter.cpp
+  classregistration.cpp
+  condition.cpp
+  configurator.cpp
+  consoleappender.cpp
+  cyclicbuffer.cpp
+  dailyrollingfileappender.cpp
+  datagrampacket.cpp
+  datagramsocket.cpp
+  date.cpp
+  dateformat.cpp
+  datelayout.cpp
+  datepatternconverter.cpp
+  defaultconfigurator.cpp
+  defaultloggerfactory.cpp
+  defaultrepositoryselector.cpp
+  domconfigurator.cpp
+  exception.cpp
+  fallbackerrorhandler.cpp
+  file.cpp
+  fileappender.cpp
+  filedatepatternconverter.cpp
+  fileinputstream.cpp
+  filelocationpatternconverter.cpp
+  fileoutputstream.cpp
+  filerenameaction.cpp
+  filewatchdog.cpp
+  filter.cpp
+  filterbasedtriggeringpolicy.cpp
+  fixedwindowrollingpolicy.cpp
+  formattinginfo.cpp
+  fulllocationpatternconverter.cpp
+  gzcompressaction.cpp
+  hierarchy.cpp
+  htmllayout.cpp
+  inetaddress.cpp
+  inputstream.cpp
+  inputstreamreader.cpp
+  integer.cpp
+  integerpatternconverter.cpp
+  layout.cpp
+  level.cpp
+  levelmatchfilter.cpp
+  levelpatternconverter.cpp
+  levelrangefilter.cpp
+  linelocationpatternconverter.cpp
+  lineseparatorpatternconverter.cpp
+  literalpatternconverter.cpp
+  loader.cpp
+  locale.cpp
+  locationinfo.cpp
+  logger.cpp
+  loggermatchfilter.cpp
+  loggerpatternconverter.cpp
+  loggingevent.cpp
+  loggingeventpatternconverter.cpp
+  loglog.cpp
+  logmanager.cpp
+  logstream.cpp
+  manualtriggeringpolicy.cpp
+  mdc.cpp
+  messagebuffer.cpp
+  messagepatternconverter.cpp
+  methodlocationpatternconverter.cpp
+  mutex.cpp
+  nameabbreviator.cpp
+  namepatternconverter.cpp
+  ndc.cpp
+  ndcpatternconverter.cpp
+  nteventlogappender.cpp
+  objectimpl.cpp
+  objectoutputstream.cpp
+  objectptr.cpp
+  obsoleterollingfileappender.cpp
+  odbcappender.cpp
+  onlyonceerrorhandler.cpp
+  optionconverter.cpp
+  outputdebugstringappender.cpp
+  outputstream.cpp
+  outputstreamwriter.cpp
+  patternconverter.cpp
+  patternlayout.cpp
+  patternparser.cpp
+  pool.cpp
+  properties.cpp
+  propertiespatternconverter.cpp
+  propertyconfigurator.cpp
+  propertyresourcebundle.cpp
+  propertysetter.cpp
+  reader.cpp
+  relativetimedateformat.cpp
+  relativetimepatternconverter.cpp
+  resourcebundle.cpp
+  rollingfileappender.cpp
+  rollingpolicy.cpp
+  rollingpolicybase.cpp
+  rolloverdescription.cpp
+  rootlogger.cpp
+  serversocket.cpp
+  simpledateformat.cpp
+  simplelayout.cpp
+  sizebasedtriggeringpolicy.cpp
+  smtpappender.cpp
+  socket.cpp
+  socketappender.cpp
+  socketappenderskeleton.cpp
+  sockethubappender.cpp
+  socketoutputstream.cpp
+  strftimedateformat.cpp
+  stringhelper.cpp
+  stringmatchfilter.cpp
+  stringtokenizer.cpp
+  synchronized.cpp
+  syslogappender.cpp
+  syslogwriter.cpp
+  system.cpp
+  systemerrwriter.cpp
+  systemoutwriter.cpp
+  telnetappender.cpp
+  threadcxx.cpp
+  threadlocal.cpp
+  threadpatternconverter.cpp
+  threadspecificdata.cpp
+  throwableinformationpatternconverter.cpp
+  timebasedrollingpolicy.cpp
+  timezone.cpp
+  transcoder.cpp
+  transform.cpp
+  triggeringpolicy.cpp
+  ttcclayout.cpp
+  writer.cpp
+  writerappender.cpp
+  xmllayout.cpp
+  xmlsocketappender.cpp
+  zipcompressaction.cpp
+)
diff --git a/src/main/include/CMakeLists.txt b/src/main/include/CMakeLists.txt
new file mode 100644
index 0000000..680101d
--- /dev/null
+++ b/src/main/include/CMakeLists.txt
@@ -0,0 +1,97 @@
+# Configure
+if(WIN32)
+add_custom_target(configure_log4cxx
+  COMMAND "${CMAKE_COMMAND}" -E copy_if_different
+    ${CMAKE_CURRENT_SOURCE_DIR}/log4cxx/log4cxx.hw
+    ${CMAKE_CURRENT_BINARY_DIR}/log4cxx/log4cxx.h
+  COMMAND "${CMAKE_COMMAND}" -E copy_if_different
+    ${CMAKE_CURRENT_SOURCE_DIR}/log4cxx/private/log4cxx_private.hw
+    ${CMAKE_CURRENT_BINARY_DIR}/log4cxx/private/log4cxx_private.h
+  DEPENDS
+    ${CMAKE_CURRENT_SOURCE_DIR}/log4cxx/log4cxx.hw
+    ${CMAKE_CURRENT_SOURCE_DIR}/log4cxx/private/log4cxx_private.hw
+  BYPRODUCTS
+    ${CMAKE_CURRENT_BINARY_DIR}/log4cxx/log4cxx.h
+    ${CMAKE_CURRENT_BINARY_DIR}/log4cxx/private/log4cxx_private.h
+)
+else()
+# Configure log4cxx.h
+set(LOG4CXX_CHAR "utf-8" CACHE STRING "Interal character representation, choice of utf-8 (default), wchar_t, unichar")
+set_property(CACHE LOG4CXX_CHAR PROPERTY STRINGS "utf-8" "wchar_t" "unichar")
+set(LOGCHAR_IS_UNICHAR 0)
+set(LOGCHAR_IS_WCHAR 0)
+set(LOGCHAR_IS_UTF8 0)
+if(${LOG4CXX_CHAR} STREQUAL "unichar")
+  set(LOGCHAR_IS_UNICHAR 1)
+elseif(${LOG4CXX_CHAR} STREQUAL "wchar_t")
+  set(LOGCHAR_IS_WCHAR 1)
+else()
+  set(LOGCHAR_IS_UTF8 1)
+endif()
+option(LOG4CXX_WCHAR_T "Enable wchar_t API methods" ON)
+option(LOG4CXX_UNICHAR "Enable UniChar API methods" OFF)
+if(APPLE)
+option(LOG4CXX_CFSTRING "Enable CFString API methods, requires Mac OS/X CoreFoundation" OFF)
+endif()
+set(CHAR_API 1)
+foreach(varName WCHAR_T  UNICHAR  CFSTRING )
+  if(${LOG4CXX_${varName}})
+    set("${varName}_API" 1)
+  else()
+    set("${varName}_API" 0)
+  endif()
+endforeach()
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/log4cxx/log4cxx.h.in
+               ${CMAKE_CURRENT_BINARY_DIR}/log4cxx/log4cxx.h
+               @ONLY
+)
+
+# Configure log4cxx_private.h
+set(LOG4CXX_CHARSET "locale" CACHE STRING "LogString characters, choice of locale (default), utf-8, ISO-8859-1, US-ASCII, EBCDIC")
+set_property(CACHE LOG4CXX_CHARSET PROPERTY STRINGS "locale" "utf-8" "ISO-8859-1" "US-ASCII" "EBCDIC")
+set(CHARSET_EBCDIC 0)
+set(CHARSET_USASCII 0)
+set(CHARSET_ISO88591 0)
+set(CHARSET_UTF8 0)
+if(${LOG4CXX_CHARSET} STREQUAL "EBCDIC")
+  set(CHARSET_EBCDIC 1)
+elseif(${LOG4CXX_CHARSET} STREQUAL "US-ASCII")
+  set(CHARSET_USASCII 1)
+elseif(${LOG4CXX_CHARSET} STREQUAL "ISO-8859-1")
+  set(CHARSET_ISO88591 1)
+elseif(${LOG4CXX_CHARSET} STREQUAL "utf-8")
+  set(CHARSET_UTF8 1)
+endif()
+
+option(LOG4CXX_HAS_STD_LOCALE "Is the standard locale header available?" OFF)
+option(LOG4CXX_HAS_ODBC "Build with ODBC appender?" OFF)
+option(LOG4CXX_HAS_MBSRTOWCS "Default character encoder converts multi-byte string to LogString using mbstowcs()?" OFF)
+option(LOG4CXX_HAS_WCSTOMBS "Default wide character encoder converts using wcstombs()?" OFF)
+option(LOG4CXX_HAS_FWIDE "Is the fwide(fd) function available?" OFF)
+option(LOG4CXX_HAS_LIBESMTP "Use libESMTP in SMTPAppender?" OFF)
+option(LOG4CXX_HAS_SYSLOG "Is the syslog function available?" OFF)
+
+foreach(varName HAS_STD_LOCALE  HAS_ODBC  HAS_MBSRTOWCS  HAS_WCSTOMBS  HAS_FWIDE  HAS_LIBESMTP  HAS_SYSLOG)
+  if(${LOG4CXX_${varName}})
+    set(${varName} 1)
+  else()
+    set(${varName} 0)
+  endif()
+endforeach()
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/log4cxx/private/log4cxx_private.h.in
+               ${CMAKE_CURRENT_BINARY_DIR}/log4cxx/private/log4cxx_private.h
+               @ONLY
+)
+
+# Provide the dependencies
+add_custom_target(configure_log4cxx
+  COMMAND "${CMAKE_COMMAND}" -E echo "Checking configuration"
+  DEPENDS
+    ${CMAKE_CURRENT_SOURCE_DIR}/include/log4cxx/log4cxx.h.in
+    ${CMAKE_CURRENT_SOURCE_DIR}/include/log4cxx/private/log4cxx_private.h.in
+  BYPRODUCTS
+    ${CMAKE_CURRENT_BINARY_DIR}/include/log4cxx/log4cxx.h
+    ${CMAKE_CURRENT_BINARY_DIR}/include/log4cxx/private/log4cxx_private.h
+)
+endif()
diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt
new file mode 100644
index 0000000..da8ed95
--- /dev/null
+++ b/src/test/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(cpp)
\ No newline at end of file
diff --git a/src/test/cpp/CMakeLists.txt b/src/test/cpp/CMakeLists.txt
new file mode 100644
index 0000000..ad3665f
--- /dev/null
+++ b/src/test/cpp/CMakeLists.txt
@@ -0,0 +1,63 @@
+# Components required by all tests
+add_library(testingFramework STATIC abts.cpp appenderskeletontestcase.cpp logunit.cpp vectorappender.cpp writerappendertestcase.cpp )
+target_include_directories(testingFramework PRIVATE ${CMAKE_CURRENT_LIST_DIR} $<TARGET_PROPERTY:log4cxx,INCLUDE_DIRECTORIES>)
+add_subdirectory(util)
+target_sources(testingUtilities PRIVATE xml/xlevel.cpp)
+
+# Tests defined in this directory
+set(ALL_LOG4CXX_TESTS 
+    asyncappendertestcase
+    consoleappendertestcase
+    decodingtest
+    encodingtest
+    fileappendertest
+    filetestcase
+    hierarchytest
+    hierarchythresholdtestcase
+    l7dtestcase
+    leveltestcase
+    loggertestcase
+    mdctestcase
+    minimumtestcase
+    ndctestcase
+    patternlayouttest
+    propertyconfiguratortest
+    rollingfileappendertestcase
+    streamtestcase
+)
+foreach(fileName IN LISTS ALL_LOG4CXX_TESTS)
+    add_executable(${fileName} "${fileName}.cpp")
+endforeach()
+target_sources(rollingfileappendertestcase PRIVATE fileappendertestcase.cpp)
+
+# Tests defined in subdirectories
+add_subdirectory(helpers)
+add_subdirectory(customlogger)
+if(LOG4CXX_HAS_ODBC OR WIN32)
+    add_subdirectory(db)
+endif()
+add_subdirectory(defaultinit)
+add_subdirectory(filter)
+add_subdirectory(net)
+if(WIN32)
+    add_subdirectory(nt)
+endif()
+add_subdirectory(pattern)
+add_subdirectory(rolling)
+add_subdirectory(spi)
+add_subdirectory(varia)
+add_subdirectory(xml)
+
+foreach(testName IN LISTS ALL_LOG4CXX_TESTS)
+    target_include_directories(${testName} PRIVATE ${CMAKE_CURRENT_LIST_DIR} $<TARGET_PROPERTY:log4cxx,INCLUDE_DIRECTORIES>)
+    target_link_libraries(${testName} PRIVATE log4cxx testingFramework testingUtilities ${APR_LIBRARIES})
+    add_test(NAME ${testName}
+        COMMAND ${testName} -v
+        WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../resources
+    )
+    if(WIN32)
+      set_tests_properties(${testName} PROPERTIES ENVIRONMENT
+        "PATH=$<SHELL_PATH:$<TARGET_FILE_DIR:log4cxx>>$<SEMICOLON>$ENV{PATH}"
+    )
+    endif()
+endforeach()
diff --git a/src/test/cpp/customlogger/CMakeLists.txt b/src/test/cpp/customlogger/CMakeLists.txt
new file mode 100644
index 0000000..76f02d6
--- /dev/null
+++ b/src/test/cpp/customlogger/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_executable(xloggertestcase xloggertestcase.cpp xlogger.cpp)
+set(ALL_LOG4CXX_TESTS ${ALL_LOG4CXX_TESTS} xloggertestcase PARENT_SCOPE)
diff --git a/src/test/cpp/db/CMakeLists.txt b/src/test/cpp/db/CMakeLists.txt
new file mode 100644
index 0000000..3f34418
--- /dev/null
+++ b/src/test/cpp/db/CMakeLists.txt
@@ -0,0 +1,3 @@
+add_executable(odbcappendertestcase odbcappendertestcase.cpp)
+target_include_directories(odbcappendertestcase PRIVATE ${CMAKE_CURRENT_LIST_DIR} $<TARGET_PROPERTY:log4cxx,INCLUDE_DIRECTORIES>)
+target_link_libraries(odbcappendertestcase log4cxx testingFramework testingUtilities ${APR_LIBRARIES})
diff --git a/src/test/cpp/defaultinit/CMakeLists.txt b/src/test/cpp/defaultinit/CMakeLists.txt
new file mode 100644
index 0000000..a9d2ee8
--- /dev/null
+++ b/src/test/cpp/defaultinit/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_executable(defaultinittestcase testcase1.cpp testcase2.cpp testcase3.cpp testcase4.cpp)
+set(ALL_LOG4CXX_TESTS ${ALL_LOG4CXX_TESTS} defaultinittestcase PARENT_SCOPE)
diff --git a/src/test/cpp/filter/CMakeLists.txt b/src/test/cpp/filter/CMakeLists.txt
new file mode 100644
index 0000000..83dc498
--- /dev/null
+++ b/src/test/cpp/filter/CMakeLists.txt
@@ -0,0 +1,9 @@
+add_executable(filtertests
+    andfiltertest.cpp
+    denyallfiltertest.cpp
+    levelmatchfiltertest.cpp
+    levelrangefiltertest.cpp
+    loggermatchfiltertest.cpp
+    stringmatchfiltertest.cpp
+)
+set(ALL_LOG4CXX_TESTS ${ALL_LOG4CXX_TESTS} filtertests PARENT_SCOPE)
diff --git a/src/test/cpp/helpers/CMakeLists.txt b/src/test/cpp/helpers/CMakeLists.txt
new file mode 100644
index 0000000..bb27546
--- /dev/null
+++ b/src/test/cpp/helpers/CMakeLists.txt
@@ -0,0 +1,28 @@
+set(HELPER_TESTS 
+    absolutetimedateformattestcase
+    cacheddateformattestcase
+    charsetdecodertestcase
+    charsetencodertestcase
+    cyclicbuffertestcase
+    datetimedateformattestcase
+    filewatchdogtest
+    inetaddresstestcase
+    iso8601dateformattestcase
+    messagebuffertest
+    optionconvertertestcase
+    propertiestestcase
+    relativetimedateformattestcase
+    stringhelpertestcase
+    stringtokenizertestcase
+    syslogwritertest
+    threadtestcase
+    timezonetestcase
+    transcodertestcase
+)
+foreach(fileName IN LISTS HELPER_TESTS)
+    add_executable(${fileName} "${fileName}.cpp")
+    target_include_directories(${fileName} PRIVATE ${CMAKE_CURRENT_LIST_DIR} $<TARGET_PROPERTY:log4cxx,INCLUDE_DIRECTORIES> ${APR_INCLUDE_DIR})
+endforeach()
+target_sources(cacheddateformattestcase PRIVATE localechanger.cpp)
+target_sources(datetimedateformattestcase PRIVATE  localechanger.cpp)
+set(ALL_LOG4CXX_TESTS ${ALL_LOG4CXX_TESTS} ${HELPER_TESTS} PARENT_SCOPE)
diff --git a/src/test/cpp/net/CMakeLists.txt b/src/test/cpp/net/CMakeLists.txt
new file mode 100644
index 0000000..6bc5847
--- /dev/null
+++ b/src/test/cpp/net/CMakeLists.txt
@@ -0,0 +1,15 @@
+
+# Tests defined in this directory
+set(NET_TESTS 
+    smtpappendertestcase
+    socketappendertestcase
+    sockethubappendertestcase
+    socketservertestcase
+    syslogappendertestcase
+    telnetappendertestcase
+    xmlsocketappendertestcase
+)
+foreach(fileName IN LISTS NET_TESTS)
+    add_executable(${fileName} "${fileName}.cpp")
+endforeach()
+set(ALL_LOG4CXX_TESTS ${ALL_LOG4CXX_TESTS} ${NET_TESTS} PARENT_SCOPE)
diff --git a/src/test/cpp/nt/CMakeLists.txt b/src/test/cpp/nt/CMakeLists.txt
new file mode 100644
index 0000000..0b8a825
--- /dev/null
+++ b/src/test/cpp/nt/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_executable(eventlogtests nteventlogappendertestcase.cpp)
+set(ALL_LOG4CXX_TESTS ${ALL_LOG4CXX_TESTS} eventlogtests PARENT_SCOPE)
diff --git a/src/test/cpp/pattern/CMakeLists.txt b/src/test/cpp/pattern/CMakeLists.txt
new file mode 100644
index 0000000..cd00697
--- /dev/null
+++ b/src/test/cpp/pattern/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_executable(patternparsertestcase patternparsertestcase.cpp num343patternconverter.cpp)
+set(ALL_LOG4CXX_TESTS ${ALL_LOG4CXX_TESTS} patternparsertestcase PARENT_SCOPE)
diff --git a/src/test/cpp/rolling/CMakeLists.txt b/src/test/cpp/rolling/CMakeLists.txt
new file mode 100644
index 0000000..2b2c650
--- /dev/null
+++ b/src/test/cpp/rolling/CMakeLists.txt
@@ -0,0 +1,14 @@
+# Tests defined in this directory
+set(ROLLING_TESTS
+    filenamepatterntestcase
+    filterbasedrollingtest
+    manualrollingtest
+    obsoletedailyrollingfileappendertest
+    obsoleterollingfileappendertest
+    sizebasedrollingtest
+    timebasedrollingtest
+)
+foreach(fileName  IN LISTS ROLLING_TESTS)
+    add_executable(${fileName} "${fileName}.cpp")
+endforeach()
+set(ALL_LOG4CXX_TESTS ${ALL_LOG4CXX_TESTS} ${ROLLING_TESTS} PARENT_SCOPE)
diff --git a/src/test/cpp/spi/CMakeLists.txt b/src/test/cpp/spi/CMakeLists.txt
new file mode 100644
index 0000000..380269f
--- /dev/null
+++ b/src/test/cpp/spi/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_executable(spitestcase loggingeventtest.cpp)
+set(ALL_LOG4CXX_TESTS ${ALL_LOG4CXX_TESTS} spitestcase PARENT_SCOPE)
diff --git a/src/test/cpp/util/CMakeLists.txt b/src/test/cpp/util/CMakeLists.txt
new file mode 100644
index 0000000..dd25dd7
--- /dev/null
+++ b/src/test/cpp/util/CMakeLists.txt
@@ -0,0 +1,21 @@
+# Components required by all tests
+add_library(testingUtilities STATIC
+    serializationtesthelper.cpp
+    absolutedateandtimefilter.cpp
+    absolutetimefilter.cpp
+    binarycompare.cpp
+    compare.cpp
+    controlfilter.cpp
+    filenamefilter.cpp
+    iso8601filter.cpp
+    linenumberfilter.cpp
+    relativetimefilter.cpp
+    threadfilter.cpp
+    transformer.cpp
+    utilfilter.cpp
+    xmlfilenamefilter.cpp
+    xmllineattributefilter.cpp
+    xmlthreadfilter.cpp
+    xmltimestampfilter.cpp
+)
+target_include_directories(testingUtilities PRIVATE ${CMAKE_CURRENT_LIST_DIR} $<TARGET_PROPERTY:log4cxx,INCLUDE_DIRECTORIES>)
diff --git a/src/test/cpp/varia/CMakeLists.txt b/src/test/cpp/varia/CMakeLists.txt
new file mode 100644
index 0000000..aeaeeb4
--- /dev/null
+++ b/src/test/cpp/varia/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Tests defined in this directory
+set(VARIA_TESTS
+    errorhandlertestcase
+    levelmatchfiltertestcase
+    levelrangefiltertestcase
+)
+foreach(fileName  IN LISTS VARIA_TESTS)
+    add_executable(${fileName} "${fileName}.cpp")
+endforeach()
+set(ALL_LOG4CXX_TESTS ${ALL_LOG4CXX_TESTS} ${VARIA_TESTS} PARENT_SCOPE)
diff --git a/src/test/cpp/xml/CMakeLists.txt b/src/test/cpp/xml/CMakeLists.txt
new file mode 100644
index 0000000..cd8bcf5
--- /dev/null
+++ b/src/test/cpp/xml/CMakeLists.txt
@@ -0,0 +1,7 @@
+add_executable(xmltests
+    domtestcase
+    xmllayouttest
+    xmllayouttestcase
+)
+target_link_libraries(xmltests PRIVATE ${APR_UTIL_LIBRARIES})
+set(ALL_LOG4CXX_TESTS ${ALL_LOG4CXX_TESTS} xmltests PARENT_SCOPE)