Merge branch 'master' into cpp11-and-better
diff --git a/.editorconfig b/.editorconfig
index c013fc3..4836cb6 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -26,3 +26,12 @@
insert_final_newline = true
tab_width = 2
trim_trailing_whitespace = true
+
+[CMakeLists.txt]
+charset = utf-8
+end_of_line = lf
+indent_size = 2
+indent_style = space
+insert_final_newline = true
+tab_width = 2
+trim_trailing_whitespace = true
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..fcadb2c
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+* text eol=lf
diff --git a/.github/workflows/log4cxx.yml b/.github/workflows/log4cxx.yml
new file mode 100644
index 0000000..ef0dd8e
--- /dev/null
+++ b/.github/workflows/log4cxx.yml
@@ -0,0 +1,91 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+name: log4cxx
+
+on: push
+
+jobs:
+ job:
+ name: ${{ matrix.os }}-${{ matrix.cxx }}-build-and-test
+ runs-on: ${{ matrix.os }}
+ timeout-minutes: 38
+ strategy:
+ fail-fast: false
+ matrix:
+ name: [ubuntu18-gcc, ubuntu18-clang, osx, windows-2019]
+ include:
+ - name: windows-2019
+ os: windows-2019
+ cxx: cl.exe
+ cc: cl.exe
+ - name: ubuntu18-gcc
+ os: ubuntu-18.04
+ cxx: g++
+ cc: gcc
+ - name: ubuntu18-clang
+ os: ubuntu-18.04
+ cxx: clang++
+ cc: clang
+ - name: osx
+ os: macos-latest
+ cxx: clang++
+ cc: clang
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - uses: lukka/set-shell-env@v1
+ with:
+ CXX: ${{ matrix.cxx }}
+ CC: ${{ matrix.cc }}
+
+ - name: 'Configure Dependencies - Ubuntu'
+ if: matrix.name == 'ubuntu18-gcc' || matrix.name == 'ubuntu18-clang'
+ run: |
+ sudo apt-get install -y libapr1-dev libaprutil1-dev
+ # note: sqlext.h exists on github VM, purge for now as we don't link correctly...
+ sudo apt-get purge unixodbc-dev
+
+ - name: 'Restore Prebuilt Dependencies - Windows'
+ id: restore-vcpkg-cache
+ if: matrix.name == 'windows-2019' || matrix.name == 'windows-2016'
+ uses: actions/cache@v2
+ with:
+ path: ${{ runner.workspace }}/vcpkg
+ key: ${{ runner.os }}-${{ matrix.name }}-cache
+
+ - name: 'Configure Dependencies - Windows'
+ if: matrix.name == 'windows-2019' || matrix.name == 'windows-2016'
+ uses: lukka/run-vcpkg@v2
+ id: runvcpkg
+ with:
+ vcpkgArguments: apr apr-util
+ vcpkgDirectory: ${{ runner.workspace }}/vcpkg/
+ vcpkgGitCommitId: ffa7fd27cfa29f206d1fd2ccfc722cad4aaeef3d
+ vcpkgTriplet: x64-windows
+
+ - name: 'run cmake'
+ uses: lukka/run-cmake@v2
+ with:
+ cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
+ buildDirectory: ${{ runner.workspace }}/build
+ useVcpkgToolchainFile: true
+ cmakeAppendedArgs: '-DLOG4CXX_TEST_PROGRAM_PATH=C:\msys64\usr\bin'
+
+ - name: run unit tests
+ shell: pwsh
+ run: |
+ cd ${{ runner.workspace }}/build
+ ctest -C Debug --output-on-failure -V
diff --git a/.gitignore b/.gitignore
index 6b1565d..dbaf83a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,11 +19,15 @@
release.properties
autom4te.cache/
+src/.vs
+src/**/__history
src/main/cpp/.libs/
src/main/cpp/liblog4cxx.la
src/main/include/log4cxx/log4cxx.h
src/main/include/log4cxx/private/log4cxx_private.h
+src/out
src/site/doxy/Doxyfile
src/site/doxy/manual/
+src/test/resources/org/
src/test/resources/output/
target/
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 24d354c..63c83e4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,6 +25,9 @@
find_package( Threads REQUIRED )
+# Find expat for XML parsing
+find_package(EXPAT REQUIRED)
+
# Building
add_subdirectory(src)
@@ -125,3 +128,10 @@
message(STATUS " Using libESMTP .................. : ${HAS_LIBESMTP}")
message(STATUS " ODBC library .................... : ${HAS_ODBC}")
message(STATUS " syslog .......................... : ${HAS_SYSLOG}")
+
+if(BUILD_TESTING)
+message(STATUS "Applications required for tests:")
+message(STATUS " zip ............................. : ${ZIP_APP}")
+message(STATUS " sed ............................. : ${SED_APP}")
+message(STATUS " gzip ............................ : ${GZIP_APP}")
+endif(BUILD_TESTING)
diff --git a/INSTALL b/INSTALL
index 89baa3e..6844f94 100644
--- a/INSTALL
+++ b/INSTALL
@@ -15,24 +15,20 @@
Detailed build instructions are provided for in both HTML
and APT format in releases. The APT sources are
-available in Subversion checkouts.
-
-autotools:
-site/building/autotools.html
-src/site/apt/building/autotools.apt
-
-Apache Ant:
-site/building/ant.html
-src/site/apt/building/ant.apt
+available in Git checkouts.
Apache Maven 2:
site/building/maven.html
src/site/apt/building/maven.apt
-Microsoft Visual Studio:
-site/building/vstudio.html
-src/site/apt/building/vstudio.apt
+autotools:
+site/building/autotools.html
+src/site/apt/building/autotools.apt
-Apple Xcode:
-site/building/xcode.html
-src/site/apt/building/xcode.apt
+CMake:
+site/building/cmake.html
+src/site/apt/building/cmake.apt
+
+Microsoft Vcpkg:
+site/building/vcpkg.html
+src/site/apt/building/vcpkg.apt
diff --git a/pom.xml b/pom.xml
index e08e09f..ba23870 100644
--- a/pom.xml
+++ b/pom.xml
@@ -353,15 +353,6 @@
</plugins>
</build>
- <dependencies>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
<reporting>
<excludeDefaults>true</excludeDefaults>
<plugins>
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3e0cb17..aa2d16e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,9 +1,10 @@
add_subdirectory(main)
target_compile_definitions(log4cxx PRIVATE ${LOG4CXX_COMPILE_DEFINITIONS} ${APR_COMPILE_DEFINITIONS} ${APR_UTIL_COMPILE_DEFINITIONS} )
target_include_directories(log4cxx INTERFACE $<INSTALL_INTERFACE:include> PRIVATE ${APR_INCLUDE_DIR} ${APR_UTIL_INCLUDE_DIR})
-target_link_libraries(log4cxx PRIVATE ${APR_UTIL_LIBRARIES} ${XMLLIB_LIBRARIES} ${APR_LIBRARIES} ${APR_SYSTEM_LIBS})
+target_link_libraries(log4cxx PRIVATE ${APR_UTIL_LIBRARIES} EXPAT::EXPAT ${APR_LIBRARIES} ${APR_SYSTEM_LIBS})
if(WIN32)
# The ODBC appender is always enabled in the Windows configuration
+cmake_policy(SET CMP0079 NEW)
target_link_libraries(log4cxx PRIVATE odbc32.lib)
option(LOG4CXX_INSTALL_PDB "Install .pdb files (if generated)" ON)
endif()
diff --git a/src/cmake/FindAPR-Util.cmake b/src/cmake/FindAPR-Util.cmake
index bb4e951..d9cf4df 100644
--- a/src/cmake/FindAPR-Util.cmake
+++ b/src/cmake/FindAPR-Util.cmake
@@ -29,7 +29,7 @@
find_program(APR_UTIL_CONFIG_EXECUTABLE
apu-1-config
- PATHS /usr/local/bin /usr/bin C:/Progra~1/apr-util/bin
+ PATHS /usr/local/bin /usr/local/opt/apr-util/bin /usr/bin $ENV{ProgramFiles}/apr-util/bin
)
mark_as_advanced(APR_UTIL_CONFIG_EXECUTABLE)
if(EXISTS ${APR_UTIL_CONFIG_EXECUTABLE})
@@ -48,8 +48,6 @@
if (APU_STATIC OR NOT BUILD_SHARED_LIBS)
set(APR_UTIL_COMPILE_DEFINITIONS APU_DECLARE_STATIC)
find_library(APR_UTIL_LIBRARIES NAMES aprutil-1)
- find_library(XMLLIB_LIBRARIES NAMES libexpat)
- find_program(XMLLIB_DLL libexpat.dll)
else()
find_library(APR_UTIL_LIBRARIES NAMES libaprutil-1)
find_program(APR_UTIL_DLL libaprutil-1.dll)
diff --git a/src/cmake/FindAPR.cmake b/src/cmake/FindAPR.cmake
index a204ece..73876c4 100644
--- a/src/cmake/FindAPR.cmake
+++ b/src/cmake/FindAPR.cmake
@@ -28,7 +28,7 @@
find_program(APR_CONFIG_EXECUTABLE
apr-1-config
- PATHS /usr/local/bin /usr/bin C:/Progra~1/apr/bin
+ PATHS /usr/local/bin /usr/local/opt/apr/bin /usr/bin $ENV{ProgramFiles}/apr/bin
)
mark_as_advanced(APR_CONFIG_EXECUTABLE)
if(EXISTS ${APR_CONFIG_EXECUTABLE})
diff --git a/src/main/cpp/logstream.cpp b/src/main/cpp/logstream.cpp
index de9a763..29c3bcf 100644
--- a/src/main/cpp/logstream.cpp
+++ b/src/main/cpp/logstream.cpp
@@ -35,6 +35,9 @@
//
memset(this, 0, sizeof(*this));
#endif
+#if LOG4CXX_INIT_IOS_BASE
+ init(NULL);
+#endif
flags(initval);
precision(initsize);
width(initsize);
diff --git a/src/main/include/CMakeLists.txt b/src/main/include/CMakeLists.txt
index d1a0bb2..a8b0f40 100644
--- a/src/main/include/CMakeLists.txt
+++ b/src/main/include/CMakeLists.txt
@@ -34,8 +34,10 @@
endif()
option(LOG4CXX_WCHAR_T "Enable wchar_t API methods" ON)
option(LOG4CXX_UNICHAR "Enable UniChar API methods" OFF)
+set(INIT_IOS_BASE 0)
if(APPLE)
option(LOG4CXX_CFSTRING "Enable CFString API methods, requires Mac OS/X CoreFoundation" OFF)
+set(INIT_IOS_BASE 1)
endif()
set(CHAR_API 1)
foreach(varName WCHAR_T UNICHAR CFSTRING )
diff --git a/src/main/include/log4cxx/private/log4cxx_private.h.in b/src/main/include/log4cxx/private/log4cxx_private.h.in
index e21f4d8..53e59ef 100644
--- a/src/main/include/log4cxx/private/log4cxx_private.h.in
+++ b/src/main/include/log4cxx/private/log4cxx_private.h.in
@@ -40,6 +40,7 @@
#define LOG4CXX_HAS_MBSRTOWCS @HAS_MBSRTOWCS@
#define LOG4CXX_HAS_WCSTOMBS @HAS_WCSTOMBS@
#define LOG4CXX_HAS_FWIDE @HAS_FWIDE@
+#define LOG4CXX_INIT_IOS_BASE @INIT_IOS_BASE@
#define LOG4CXX_CHARSET_UTF8 @CHARSET_UTF8@
#define LOG4CXX_CHARSET_ISO88591 @CHARSET_ISO88591@
diff --git a/src/site/apt/building/cmake.apt b/src/site/apt/building/cmake.apt
index fbbecac..9bfb794 100644
--- a/src/site/apt/building/cmake.apt
+++ b/src/site/apt/building/cmake.apt
@@ -57,6 +57,9 @@
| -DAPR_STATIC=yes | Link to the APR static library. By default, the log4cxx shared library is linked to the |
| | APR shared library. If BUILD_SHARED_LIBS=off, the static APR library is always used. |
*------------------------+---------------------------------------------------------------------------------------------+
+|-DLOG4CXX_TEST_PROGRAM_PATH=path| An extra path to prepend to the PATH for test programs. Log4cxx requires zip, |
+| | sed, and grep on the PATH in order for the tests to work properly. |
+*------------------------+---------------------------------------------------------------------------------------------+
Building and testing log4cxx on a Microsoft Windows with APR, Expat and APR-Util built from source
extracted into apr-1.7.0, libexpat(from github) and apr-util-1.6.1 in %HOMEPATH%\Libraries.
@@ -117,6 +120,18 @@
$ make install
+----+
+** Windows:
+
+The easiest way to get dependencies installed is to use vcpkg(for APR/expat), and msys2 for the command-line
+utilities(zip, grep, sed).
+
+Msys2 can be downloaded from: https://www.msys2.org/
+By default, this will be installed under C:\msys2, so you can add that to the build PATH by setting
+LOG4CXX_TEST_PROGRAM_PATH=C:/msys64/usr/bin in your build settings.
+
+For vcpkg, follow the directions at https://github.com/microsoft/vcpkg#quick-start-windows and then install
+the dependencies needed using `vcpkg install apr apr-util`.
+
* Using log4cxx in a CMake build
A log4cxxConfig.cmake and log4cxxConfigVersion.cmake is installed to allow use of find_package()
diff --git a/src/site/apt/building/vstudio.apt b/src/site/apt/building/vstudio.apt
deleted file mode 100644
index 8305838..0000000
--- a/src/site/apt/building/vstudio.apt
+++ /dev/null
@@ -1,86 +0,0 @@
-~~ Licensed to the Apache Software Foundation (ASF) under one or more
-~~ contributor license agreements. See the NOTICE file distributed with
-~~ this work for additional information regarding copyright ownership.
-~~ The ASF licenses this file to You under the Apache License, Version 2.0
-~~ (the "License"); you may not use this file except in compliance with
-~~ the License. You may obtain a copy of the License at
-~~
-~~ http://www.apache.org/licenses/LICENSE-2.0
-~~
-~~ Unless required by applicable law or agreed to in writing, software
-~~ distributed under the License is distributed on an "AS IS" BASIS,
-~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-~~ See the License for the specific language governing permissions and
-~~ limitations under the License.
- ------
- Building Apache log4cxx with Microsoft Visual Studio
- ------
- ------
- ------
-
-Building Apache log4cxx with Microsoft Visual Studio
-
-*Preparation
-
-+----+
-unzip apr-1.2.11-win32-src.zip
-rename apr-1.2.11 apr
-unzip apr-util-1.2.10-win32-src.zip
-rename apr-util-1.2.10 apr-util
-cd apache-log4cxx-x.x.x
-configure
-configure-aprutil
-+----+
-
- configure.bat copies the prefabricated log4cxx.hw and private/log4cxx_private.hw over
- to log4cxx.h and private/log4cxx_private.h.
-
- configure-aprutil.bat uses "sed" to modify apu.hw and apr_ldap.hw to disable APR-Iconv
- and LDAP which are not necessary for log4cxx and problematic to build.
- If "sed" is not available, the modifications would be trivial to do in any text editor.
-
- Use the Win32 source zips for APR and APR-Util to preserve the required line endings
- for the project files. Directories need to be renamed to "apr" and "apr-util" respectively.
-
-
-
-*Building log4cxx.dll
-
- Open projects/log4cxx.dsw with Microsoft
- Visual Studio 6 or later at which time you may be prompted to
- upgrade the projects to the format used by your version
- of Microsoft Visual Studio.
-
- Select log4cxx as active project and build.
-
-
-*Running unit tests
-
- To pass the unit tests, gzip, zip and sed must be on the path.
- Also three
- environment variables need to be defined: TOTO=wonderful,
- key1=value1 and key2=value2. These must be done outside
- of Microsoft Visual Studio, either in the Control Panel or
- in a Command Prompt used to launch Microsoft Visual Studio.
-
- Open projects/testsuite.dsw or projects/testsuite-standalone.dsw
- (test suite and implementation in one project) in Microsoft Visual
- Studio, select active project and build.
-
- On the Debug Tab of the Project/Settings dialog,
- set the Working Directory to "../src/test/resources".
- Individual tests can be specified in Program Arguments
- and "-v" can be specified to output verbose test results.
-
-
-*Known Issues
-
- *APR 1.2.12 has a known issue that will prevent
- compilation with Visual Studio 6 unless a later Platform SDK is installed.
- See APR bug {{{https://issues.apache.org/bugzilla/show_bug.cgi?44327}44327}}.
- APR 1.2.11 and the corresponding APR-Util 1.2.10 will compile with Visual Studio 6.
-
- *APR-Util requires later LDAP headers than provided with Visual Studio 6
- and will fail to compile. log4cxx does not use LDAP, it can be disabled in apr_ldap.hw.
-
- *APR-Iconv is problematic and not used by log4cxx, it can be disabled in apu.hw.
diff --git a/src/site/markdown/dependencies.md b/src/site/markdown/dependencies.md
new file mode 100644
index 0000000..49a21ec
--- /dev/null
+++ b/src/site/markdown/dependencies.md
@@ -0,0 +1,59 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+# LOG4CXX Dependencies
+
+log4cxx requires the following software to build and/or run correctly:
+
+|Dependency Name|Version|Dependency Type|Homepage|
+|---------------|-------|---------------|--------|
+|Apache Portable Runtime(APR)|>=1.5.4|Compile/Runtime|https://apr.apache.org
+|APR-Util |>=1.5.4|Compile/Runtime|https://apr.apache.org
+|gzip |any |Test/Runtime(optional)|https://gzip.org
+|sed |any |Test|N/A
+|zip |any |Test/Runtime(optional)|N/A
+|log4j |1.2.14 |Test |https://http://logging.apache.org/log4j/2.x/
+|java |>=6 |Test |https://adoptopenjdk.net
+
+## APR+APR-Util
+
+The Apache Portable Runtime(APR) provides the cross-platform backend for log4cxx.
+Both APR and APR-util need to be installed and available on your system.
+
+## sed+gzip+zip
+
+These applications are needed during test of log4cxx. `gzip`and `sed` are generally installed
+by default on Linux. `zip` may not be installed by default; check your distribution's
+documentation for information on how to install these applications.
+
+For Windows, you will have to install those tools through a system such as
+MinGW, cygwin, or MSYS2.
+
+`gzip` and `zip` only needed during runtime if you are compressing the log
+files, for example by setting a rollover policy which ends in `.gz` or `.zip`.
+
+## log4j+Java
+
+log4j and Java are needed to run some tests to ensure that log4cxx has binary compatability with
+log4j. Note that the correct binary for log4j will be downloaded and used automatically if CMAKE is
+used to build the project, otherwise one needs to get that manually. Java needs to be installed on
+the system already in all cases, but with CMAKE again, if it's not, the corresponding tests are
+skipped entirely automatically.
+
+# Licenses(direct dependencies only)
+
+**Apache License, Version 2.0**: log4cxx, APR, APR-util
diff --git a/src/site/xdoc/building/index.xml b/src/site/xdoc/building/index.xml
index 1a28ce1..e7303e6 100644
--- a/src/site/xdoc/building/index.xml
+++ b/src/site/xdoc/building/index.xml
@@ -1,187 +1,218 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-<document>
- <properties>
- <title>Building Apache log4cxx</title>
- </properties>
-
- <body>
- <section name="Building Apache log4cxx">
- <p>
- The project supports different build tools on different platforms, have a look at
- the menu to find the platform you need. If your environment is not covered already,
- feel free to ask about it on one of the <a href="../mail-lists.html">Mailing Lists</a>
- or leave a bug in our <a href="../issue-tracking.html">Issue Tracker</a>. In this
- case it would be very helpful of course if you could already provide some patches
- to support your environment or at least provide some technical details about the
- build tools, compiler etc. you use.
- </p>
- </section>
-
- <section name="Covered by the team">
- <p>
- The following table provides an overview about the environments some of the team
- members have access to and therefore normally should work out of the box or at
- least were used sometimes in the past. This list by no means tells something about
- how good the support on each platform is, it's just a guide.
- </p>
-
- <table>
- <caption>Environments in use</caption>
- <thead>
- <tr>
- <th id="os">OS</th>
- <th id="os_x86_x64">x86 vs. x64</th>
- <th id="environment">Environment</th>
- <th id="compiler">Compiler</th>
- <th id="compiler_x86_x64">x86 vs. x64</th>
- </tr>
- </thead>
- <tbody>
- <!-- Windows -->
- <tr>
- <td headers="os"
- rowspan="9">
- Windows 7
- </td>
- <td headers="os_x86_x64"
- rowspan="9">
- x64
- </td>
- <td headers="environment"
- rowspan="6">
- Win32
- </td>
- <td headers="compiler">
- MS Visual Studio 2008
- </td>
- <td headers="compiler_x86_x64"
- rowspan="5">
- both
- </td>
- </tr>
- <tr>
- <td headers="compiler">MS Visual Studio 2010 (Pro)</td>
- </tr>
- <tr>
- <td headers="compiler">MS Visual Studio 2010 (Express)</td>
- </tr>
- <tr>
- <td headers="compiler">MS Visual Studio 2012</td>
- </tr>
- <tr>
- <td headers="compiler">MS Visual Studio 2013 (Express)</td>
- </tr>
- <tr>
- <td headers="compiler">Embarcadero C++ Builder XE 4</td>
- <td headers="compiler_x86_x64">x86</td>
- </tr>
- <tr>
- <td headers="environment"
- rowspan="2">
- MinGW
- </td>
- <td headers="compiler">
- gcc 4.5.4
- </td>
- <td headers="compiler_x86_x64"
- rowspan="3">
- both
- </td>
- </tr>
- <tr>
- <td headers="compiler">gcc 4.6.4</td>
- </tr>
- <tr>
- <td headers="environment">Cygwin</td>
- <td headers="compiler">gcc 4.8.2</td>
- </tr>
- <!-- Linux -->
- <tr>
- <td headers="os"
- rowspan="2">
- Debian
- </td>
- <td headers="os_x86_x64"
- rowspan="2">
- x86
- </td>
- <td headers="environment"
- rowspan="11">
- Posix
- </td>
- <td headers="compiler">
- gcc
- </td>
- <td headers="compiler_x86_x64"
- rowspan="2">
- x86
- </td>
- </tr>
- <tr>
- <td headers="compiler">clang</td>
- </tr>
- <tr>
- <td headers="os" rowspan="7">
- Ubuntu and Scientific Linux
- </td>
- <td headers="os_x86_x64"
- rowspan="9">
- x64
- </td>
- <td headers="compiler">
- gcc 4.5
- </td>
- <td headers="compiler_x86_x64"
- rowspan="8">
- both
- </td>
- </tr>
- <tr>
- <td headers="compiler">gcc 4.6</td>
- </tr>
- <tr>
- <td headers="compiler">gcc 4.7</td>
- </tr>
- <tr>
- <td headers="compiler">gcc 4.8</td>
- </tr>
- <tr>
- <td headers="compiler">Intel 11.1</td>
- </tr>
- <tr>
- <td headers="compiler">Intel 12.1</td>
- </tr>
- <tr>
- <td headers="compiler">Intel 13.1</td>
- </tr>
- <tr>
- <td headers="os">Red Hat</td>
- <td headers="compiler">gcc</td>
- </tr>
- <!-- Mac OS X -->
- <tr>
- <td headers="os">Mac OS X 10.9 Mavericks</td>
- <td headers="compiler">Xcode 5.0.2</td>
- <td headers="compiler_x86_x64">x64</td>
- </tr>
- </tbody>
- </table>
- </section>
- </body>
-</document>
\ No newline at end of file
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<document>
+ <properties>
+ <title>Building Apache log4cxx</title>
+ </properties>
+
+ <body>
+ <section name="Building Apache log4cxx">
+ <p>
+ The project supports different build tools on different platforms, have a look at
+ the menu to find the platform you need. If your environment is not covered already,
+ feel free to ask about it on one of the <a href="../mail-lists.html">Mailing Lists</a>
+ or leave a bug in our <a href="../issue-tracking.html">Issue Tracker</a>. In this
+ case it would be very helpful of course if you could already provide some patches
+ to support your environment or at least provide some technical details about the
+ build tools, compiler etc. you use.
+ </p>
+ </section>
+
+ <section name="Running unit tests">
+ <p>
+ Autotools will link all tests into a single executable (testsuite).
+ The cmake build generates a number of executables which can be run using the ctest
+ tool. Some unit tests will fail if sed and gzip are not available.
+ </p>
+ </section>
+
+ <section name="Covered by the team">
+ <p>
+ The following table provides an overview about the environments some of the team
+ members have access to and therefore normally should work out of the box or at
+ least were used sometimes in the past. This list by no means tells something about
+ how good the support on each platform is, it's just a guide.
+ </p>
+
+ <table>
+ <caption>Environments in use</caption>
+ <thead>
+ <tr>
+ <th id="os">OS</th>
+ <th id="os_arch">Architecture</th>
+ <th id="environment">Environment</th>
+ <th id="compiler">Compiler</th>
+ <th id="compiler_arch">Architecture</th>
+ </tr>
+ </thead>
+ <tbody>
+ <!-- Windows -->
+ <tr>
+ <td headers="os"
+ rowspan="9">
+ Windows 7
+ </td>
+ <td headers="os_arch"
+ rowspan="9">
+ x64
+ </td>
+ <td headers="environment"
+ rowspan="6">
+ Win32
+ </td>
+ <td headers="compiler">
+ MS Visual Studio 2008
+ </td>
+ <td headers="compiler_arch"
+ rowspan="5">
+ x86 and x64
+ </td>
+ </tr>
+ <tr>
+ <td headers="compiler">MS Visual Studio 2010 (Pro)</td>
+ </tr>
+ <tr>
+ <td headers="compiler">MS Visual Studio 2010 (Express)</td>
+ </tr>
+ <tr>
+ <td headers="compiler">MS Visual Studio 2012</td>
+ </tr>
+ <tr>
+ <td headers="compiler">MS Visual Studio 2013 (Express)</td>
+ </tr>
+ <tr>
+ <td headers="compiler">Embarcadero C++ Builder XE 4</td>
+ <td headers="compiler_arch">x86</td>
+ </tr>
+ <tr>
+ <td headers="environment"
+ rowspan="2">
+ MinGW
+ </td>
+ <td headers="compiler">
+ gcc 4.5.4
+ </td>
+ <td headers="compiler_arch"
+ rowspan="3">
+ x86 and x64
+ </td>
+ </tr>
+ <tr>
+ <td headers="compiler">gcc 4.6.4</td>
+ </tr>
+ <tr>
+ <td headers="environment">Cygwin</td>
+ <td headers="compiler">gcc 4.8.2</td>
+ </tr>
+ <tr>
+ <td headers="os">Windows 10</td>
+ <td headers="os_arch">x64</td>
+ <td headers="environment">Win32</td>
+ <td headers="compiler">MS Visual Studio 2019 (Community)</td>
+ <td headers="compiler_arch">x86</td>
+ </tr>
+ <!-- Linux -->
+ <tr>
+ <td headers="os"
+ rowspan="2">
+ Debian
+ </td>
+ <td headers="os_arch"
+ rowspan="2">
+ x86
+ </td>
+ <td headers="environment"
+ rowspan="14">
+ Posix
+ </td>
+ <td headers="compiler">
+ gcc
+ </td>
+ <td headers="compiler_arch"
+ rowspan="2">
+ x86
+ </td>
+ </tr>
+ <tr>
+ <td headers="compiler">clang</td>
+ </tr>
+ <tr>
+ <td headers="os" rowspan="8">
+ Ubuntu and Scientific Linux
+ </td>
+ <td headers="os_arch"
+ rowspan="10">
+ x64
+ </td>
+ <td headers="compiler">
+ gcc 4.5
+ </td>
+ <td headers="compiler_arch"
+ rowspan="8">
+ x86 and x64
+ </td>
+ </tr>
+ <tr>
+ <td headers="compiler">gcc 4.6</td>
+ </tr>
+ <tr>
+ <td headers="compiler">gcc 4.7</td>
+ </tr>
+ <tr>
+ <td headers="compiler">gcc 4.8</td>
+ </tr>
+ <tr>
+ <td headers="compiler">gcc 7.5</td>
+ </tr>
+ <tr>
+ <td headers="compiler">Intel 11.1</td>
+ </tr>
+ <tr>
+ <td headers="compiler">Intel 12.1</td>
+ </tr>
+ <tr>
+ <td headers="compiler">Intel 13.1</td>
+ </tr>
+ <tr>
+ <td headers="os">Red Hat</td>
+ <td headers="compiler">gcc</td>
+ </tr>
+ <!-- Mac OS X -->
+ <tr>
+ <td headers="os">Mac OS X 10.9 Mavericks</td>
+ <td headers="compiler">Xcode 5.0.2</td>
+ <td headers="compiler_arch">x64</td>
+ </tr>
+ <!-- Arm -->
+ <tr>
+ <td headers="os">Raspian</td>
+ <td headers="os_arch">armv7</td>
+ <td headers="compiler">gcc 8.3</td>
+ <td headers="compiler_arch">armv7</td>
+ </tr>
+ <tr>
+ <td headers="os">Ubuntu 20.04</td>
+ <td headers="os_arch">armv8</td>
+ <td headers="compiler">gcc 9.10</td>
+ <td headers="compiler_arch">aarch</td>
+ </tr>
+ </tbody>
+ </table>
+ </section>
+ </body>
+</document>
diff --git a/src/test/cpp/CMakeLists.txt b/src/test/cpp/CMakeLists.txt
index 66f5c9d..bc38e91 100644
--- a/src/test/cpp/CMakeLists.txt
+++ b/src/test/cpp/CMakeLists.txt
@@ -6,6 +6,16 @@
add_subdirectory(util)
target_sources(testingUtilities PRIVATE xml/xlevel.cpp)
+set( LOG4CXX_TEST_PROGRAM_PATH "" CACHE PATH "Extra path for test programs" )
+set( CMAKE_PROGRAM_PATH "${LOG4CXX_TEST_PROGRAM_PATH};${CMAKE_PROGRAM_PATH}" )
+
+# sed, zip, and gzip are needed for the tests to work properly
+# Note: option 'required' not available until cmake 3.18, however adding
+# it does not cause an issue
+find_program(SED_APP sed REQUIRED)
+find_program(ZIP_APP zip REQUIRED)
+find_program(GZIP_APP gzip REQUIRED)
+
# Tests defined in this directory
set(ALL_LOG4CXX_TESTS
asyncappendertestcase
@@ -51,6 +61,31 @@
add_subdirectory(varia)
add_subdirectory(xml)
+# Note: we need to include the APR DLLs on our path so that the tests will run.
+# The way that CMake sets the environment is that it actually generates a secondary file,
+# CTestTestfile.cmake, which sets the final properties of the test.
+# However, this results in a secondary quirk to the running of the tests: CMake uses
+# a semicolon to deliminate entries in a list! Since the Windows PATH is semicolon-delimited
+# as well, CMake uses only the first entry in the list when setting the path.
+# So, we need to do a triple escape on the PATH that we want to set in order for CMake to
+# properly interpret the PATH
+if( WIN32 )
+ get_filename_component(APR_DLL_DIR "${APR_DLL}" DIRECTORY)
+ get_filename_component(APR_UTIL_DLL_DIR "${APR_UTIL_DLL}" DIRECTORY)
+ get_filename_component(EXPAT_LIB_DIR "${EXPAT_LIBRARY}" DIRECTORY)
+
+
+ set(EXPAT_DLL_DIR "${EXPAT_LIB_DIR}/../bin")
+ set(LOG4CXX_DLL_DIR "$<SHELL_PATH:$<TARGET_FILE_DIR:log4cxx>>;")
+ set(PATH_FOR_TESTS ${CMAKE_PROGRAM_PATH};${APR_DLL_DIR};${APR_UTIL_DLL_DIR};${LOG4CXX_DLL_DIR};${EXPAT_DLL_DIR}\;)
+ list(REMOVE_DUPLICATES PATH_FOR_TESTS)
+ set(NORMAL_PATH $ENV{PATH})
+ set(ESCAPED_PATH "")
+ foreach( ENTRY ${PATH_FOR_TESTS}${NORMAL_PATH} )
+ set(ESCAPED_PATH "${ESCAPED_PATH}${ENTRY}\\\;")
+ endforeach()
+endif( WIN32 )
+
foreach(testName IN LISTS ALL_LOG4CXX_TESTS)
target_compile_definitions(${testName} PRIVATE ${LOG4CXX_COMPILE_DEFINITIONS} ${APR_COMPILE_DEFINITIONS} ${APR_UTIL_COMPILE_DEFINITIONS} )
target_include_directories(${testName} PRIVATE ${CMAKE_CURRENT_LIST_DIR} $<TARGET_PROPERTY:log4cxx,INCLUDE_DIRECTORIES>)
@@ -61,20 +96,16 @@
COMMAND ${testName} -v
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../resources
)
+ set_tests_properties( ${testName} PROPERTIES TIMEOUT 120 )
if(WIN32)
- get_filename_component(APR_DLL_DIR "${APR_DLL}" DIRECTORY)
- get_filename_component(APR_UTIL_DLL_DIR "${APR_UTIL_DLL}" DIRECTORY)
- get_filename_component(XMLLIB_DLL_DIR "${XMLLIB_DLL}" DIRECTORY)
- set(PATH_FOR_TESTS $<SHELL_PATH:$<TARGET_FILE_DIR:log4cxx>> ${APR_DLL_DIR} ${APR_UTIL_DLL_DIR} ${XMLLIB_DLL_DIR})
- list(REMOVE_DUPLICATES PATH_FOR_TESTS)
if(${testName} STREQUAL socketservertestcase)
set_tests_properties(socketservertestcase PROPERTIES
- ENVIRONMENT "SOCKET_SERVER_PARAMETER_FILE=${START_SOCKET_SERVER_PARAMETER_FILE};PATH=${LOG4CXX_DLL_DIR}\;${APR_DLL_DIR}\;${APR_UTIL_DLL_DIR}"
+ ENVIRONMENT "SOCKET_SERVER_PARAMETER_FILE=${START_SOCKET_SERVER_PARAMETER_FILE};PATH=${ESCAPED_PATH}"
)
else()
set_tests_properties(${testName} PROPERTIES
- ENVIRONMENT "TOTO=wonderful;key1=value1;key2=value2;PATH==${LOG4CXX_DLL_DIR}\;${APR_DLL_DIR}\;${APR_UTIL_DLL_DIR}"
+ ENVIRONMENT "TOTO=wonderful;key1=value1;key2=value2;PATH=${ESCAPED_PATH}"
)
endif()
else()
diff --git a/src/test/cpp/xml/CMakeLists.txt b/src/test/cpp/xml/CMakeLists.txt
index bddfe48..138c489 100644
--- a/src/test/cpp/xml/CMakeLists.txt
+++ b/src/test/cpp/xml/CMakeLists.txt
@@ -4,5 +4,5 @@
xmllayouttestcase
)
-target_link_libraries(xmltests PRIVATE ${APR_UTIL_LIBRARIES} ${XMLLIB_LIBRARIES})
+target_link_libraries(xmltests PRIVATE ${APR_UTIL_LIBRARIES} EXPAT::EXPAT)
set(ALL_LOG4CXX_TESTS ${ALL_LOG4CXX_TESTS} xmltests PARENT_SCOPE)