Provide find modules for APR and APR-Util. Add the version resource to log4cxx.dll
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b28b810..df334be 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,10 @@
 cmake_minimum_required(VERSION 3.13)
-project(log4cxx VERSION 0.10.0 LANGUAGES CXX)
+include(src/cmake/projectVersionDetails.cmake)
+project(log4cxx VERSION ${log4cxx_VER} LANGUAGES CXX)
+include(CTest)
+
+# FindAPR and FindAPR-util are not provided by APR and APR-Util so source them locally
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/src/cmake")
 
 # Find Apache Runtime
 find_package(apr QUIET)
@@ -13,12 +18,6 @@
 find_path(APR_UTIL_INCLUDE_DIR apu.h PATH_SUFFIXES apr-1)
 find_library(APR_UTIL_LIBRARIES NAMES libaprutil-1 aprutil-1)
 
-## Testing
-option(TEST_LOG4CXX "Build log4cxx tests" OFF)
-if(TEST_LOG4CXX)
-  enable_testing()
-endif()
-
 # Building
 add_subdirectory(src)
 
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 95e66e1..fced9be 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -7,6 +7,6 @@
 option(LOG4CXX_INSTALL_PDB "Install .pdb files (if generated)"  ON)
 endif()
 
-if(TEST_LOG4CXX)
-  add_subdirectory(test)
+if(BUILD_TESTING)
+   add_subdirectory(test)
 endif()
diff --git a/src/cmake/findAPR-Util.cmake b/src/cmake/findAPR-Util.cmake
new file mode 100644
index 0000000..3485911
--- /dev/null
+++ b/src/cmake/findAPR-Util.cmake
@@ -0,0 +1,40 @@
+# Locate APR-Util include paths and libraries
+include(FindPackageHandleStandardArgs)
+
+# This module defines
+# APR_UTIL_INCLUDE_DIR, where to find apr.h, etc.
+# APR_UTIL_LIBRARIES, the libraries to link against to use APR.
+# APR_UTIL_FOUND, set to yes if found
+
+macro(_apu_invoke _varname)
+    execute_process(
+        COMMAND ${APR_UTIL_CONFIG_EXECUTABLE} ${ARGN}
+        OUTPUT_VARIABLE _apr_output
+        RESULT_VARIABLE _apr_failed
+    )
+
+    if(_apr_failed)
+        message(FATAL_ERROR "apu-1-config ${ARGN} failed with result ${_apr_failed}")
+    else(_apr_failed)
+        string(REGEX REPLACE "[\r\n]"  "" _apr_output "${_apr_output}")
+        string(REGEX REPLACE " +$"     "" _apr_output "${_apr_output}")
+        string(REGEX REPLACE "^ +"     "" _apr_output "${_apr_output}")
+
+        separate_arguments(_apr_output)
+
+        set(${_varname} "${_apr_output}")
+    endif(_apr_failed)
+endmacro(_apu_invoke)
+
+find_program(APR_UTIL_CONFIG_EXECUTABLE
+    apu-1-config
+    PATHS /usr/local/bin    /usr/bin    C:/Progra~1/apr-util/bin
+    )
+mark_as_advanced(APR_UTIL_CONFIG_EXECUTABLE)
+if(EXISTS ${APR_UTIL_CONFIG_EXECUTABLE})
+    _apu_invoke(APR_UTIL_INCLUDE_DIR   --includedir)
+    _apu_invoke(APR_UTIL_LIBRARIES     --link-ld)
+endif()
+
+find_package_handle_standard_args(apr-util DEFAULT_MSG
+  APR_UTIL_INCLUDE_DIR APR_UTIL_LIBRARIES)
diff --git a/src/cmake/findAPR.cmake b/src/cmake/findAPR.cmake
new file mode 100644
index 0000000..171d745
--- /dev/null
+++ b/src/cmake/findAPR.cmake
@@ -0,0 +1,39 @@
+# Locate APR include paths and libraries
+include(FindPackageHandleStandardArgs)
+
+# This module defines
+# APR_INCLUDE_DIR, where to find apr.h, etc.
+# APR_LIBRARIES, the libraries to link against to use APR.
+# APR_FOUND, set to 'yes' if found
+macro(_apr_invoke _varname)
+    execute_process(
+        COMMAND ${APR_CONFIG_EXECUTABLE} ${ARGN}
+        OUTPUT_VARIABLE _apr_output
+        RESULT_VARIABLE _apr_failed
+    )
+
+    if(_apr_failed)
+        message(FATAL_ERROR "apr-1-config ${ARGN} failed with result ${_apr_failed}")
+    else(_apr_failed)
+        string(REGEX REPLACE "[\r\n]"  "" _apr_output "${_apr_output}")
+        string(REGEX REPLACE " +$"     "" _apr_output "${_apr_output}")
+        string(REGEX REPLACE "^ +"     "" _apr_output "${_apr_output}")
+
+        separate_arguments(_apr_output)
+        set(${_varname} "${_apr_output}")
+    endif(_apr_failed)
+endmacro(_apr_invoke)
+
+
+find_program(APR_CONFIG_EXECUTABLE
+    apr-1-config
+    PATHS /usr/local/bin    /usr/bin    C:/Progra~1/apr/bin
+    )
+mark_as_advanced(APR_CONFIG_EXECUTABLE)
+if(EXISTS ${APR_CONFIG_EXECUTABLE})
+    _apr_invoke(APR_INCLUDE_DIR  --includedir)
+    _apr_invoke(APR_LIBRARIES  --link-ld)
+endif()
+
+find_package_handle_standard_args(apr
+    APR_INCLUDE_DIR APR_LIBRARIES)
diff --git a/src/cmake/projectVersionDetails.cmake b/src/cmake/projectVersionDetails.cmake
new file mode 100644
index 0000000..68bda9b
--- /dev/null
+++ b/src/cmake/projectVersionDetails.cmake
@@ -0,0 +1,5 @@
+# This file should contain nothing but the following line
+# setting the project version. The variable name must not
+# clash with the log4cxx_VERSION* variables automatically
+# defined by the project() command.
+set(log4cxx_VER 0.11.0.0)
diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt
index 12cb4c9..80dd6d8 100644
--- a/src/main/CMakeLists.txt
+++ b/src/main/CMakeLists.txt
@@ -1,5 +1,6 @@
 add_subdirectory(include)
 add_subdirectory(cpp)
+add_subdirectory(resources)
 
 # setup include directories 
 include(GNUInstallDirs)
diff --git a/src/main/include/CMakeLists.txt b/src/main/include/CMakeLists.txt
index 0afef45..1939886 100644
--- a/src/main/include/CMakeLists.txt
+++ b/src/main/include/CMakeLists.txt
@@ -14,6 +14,10 @@
     ${CMAKE_CURRENT_BINARY_DIR}/log4cxx/log4cxx.h
     ${CMAKE_CURRENT_BINARY_DIR}/log4cxx/private/log4cxx_private.h
 )
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/log4cxx/version_info.h.in
+               ${CMAKE_CURRENT_BINARY_DIR}/log4cxx/version_info.h
+               @ONLY
+)
 else()
 # Configure log4cxx.h
 set(LOG4CXX_CHAR "utf-8" CACHE STRING "Interal character representation, choice of utf-8 (default), wchar_t, unichar")
diff --git a/src/main/include/log4cxx/version_info.h.in b/src/main/include/log4cxx/version_info.h.in
new file mode 100644
index 0000000..b4331fc
--- /dev/null
+++ b/src/main/include/log4cxx/version_info.h.in
@@ -0,0 +1,5 @@
+// Information used by resource files
+#define INFO_PRODUCT_VERSION_LIST @log4cxx_VERSION_MAJOR@,@log4cxx_VERSION_MINOR@,@log4cxx_VERSION_PATCH@
+#define INFO_PRODUCT_VERSION_STRING "@log4cxx_VERSION@"
+#define INFO_FILE_VERSION_LIST INFO_PRODUCT_VERSION_LIST,@log4cxx_VERSION_TWEAK@
+#define INFO_FILE_VERSION_STRING INFO_PRODUCT_VERSION_STRING "." @log4cxx_VERSION_TWEAK@
diff --git a/src/main/resources/CMakeLists.txt b/src/main/resources/CMakeLists.txt
new file mode 100644
index 0000000..3827357
--- /dev/null
+++ b/src/main/resources/CMakeLists.txt
@@ -0,0 +1,7 @@
+# Configure
+if(WIN32)
+target_sources(log4cxx
+  PRIVATE
+  log4cxx.rc
+)
+endif()
\ No newline at end of file
diff --git a/src/main/resources/log4cxx.rc b/src/main/resources/log4cxx.rc
index d61b19c..3faf8b0 100644
--- a/src/main/resources/log4cxx.rc
+++ b/src/main/resources/log4cxx.rc
@@ -74,10 +74,11 @@
 //

 // Version

 //

+#include <log4cxx/version_info.h>

 

 VS_VERSION_INFO VERSIONINFO

- FILEVERSION 0, 0, 0, 0

- PRODUCTVERSION 0, 0, 0, 0

+ FILEVERSION INFO_FILE_VERSION_LIST

+ PRODUCTVERSION INFO_PRODUCT_VERSION_LIST

  FILEFLAGSMASK 0x17L

 #ifdef _DEBUG

  FILEFLAGS 0x1L

@@ -94,12 +95,12 @@
         BEGIN

             VALUE "CompanyName", "Apache Software Foundation"

             VALUE "FileDescription", "Apache log4cxx"

-            VALUE "FileVersion", "0, 0, 0, 0"

+            VALUE "FileVersion", INFO_FILE_VERSION_STRING

             VALUE "InternalName", "log4cxx"

             VALUE "LegalCopyright",  "Licensed to the Apache Software Foundation (ASF) under one or more\ncontributor license agreements.  See the NOTICE file distributed with\nthis work for additional information regarding copyright ownership.\nThe ASF licenses this file to You under the Apache License, Version 2.0\n(the ""License""); you may not use this file except in compliance with\nthe License.  You may obtain a copy of the License at\n\n     http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an ""AS IS"" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License."

             VALUE "OriginalFilename", "log4cxx.dll"

             VALUE "ProductName", "Apache log4cxx"

-            VALUE "ProductVersion", "0, 0, 0, 0"

+            VALUE "ProductVersion", INFO_PRODUCT_VERSION_STRING

         END

     END

     BLOCK "VarFileInfo"