This is an automated email from the ASF dual-hosted git repository. rmiddleton pushed a commit to branch logcxx_510_rm_vs2019 in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git
commit f1bf48bdab448f40706d4968a2c457471354c4fd Author: Robert Middleton <[email protected]> AuthorDate: Thu Sep 3 20:04:57 2020 -0700 Add CMAKE_PROGRAM_PATH to path for tests ensured that things work with expat Updated documentation and made sure varaibles are correct --- src/cmake/FindAPR-Util.cmake | 1 - src/site/apt/building/cmake.apt | 15 +++++++++++++++ src/test/cpp/CMakeLists.txt | 7 ++++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/cmake/FindAPR-Util.cmake b/src/cmake/FindAPR-Util.cmake index aecb240..b2da4b4 100644 --- a/src/cmake/FindAPR-Util.cmake +++ b/src/cmake/FindAPR-Util.cmake @@ -48,7 +48,6 @@ else() 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 expat) else() find_library(APR_UTIL_LIBRARIES NAMES libaprutil-1) find_program(APR_UTIL_DLL libaprutil-1.dll) 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 @@ $ sudo make install | -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 $ 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/test/cpp/CMakeLists.txt b/src/test/cpp/CMakeLists.txt index 2e847d5..72fdc27 100644 --- a/src/test/cpp/CMakeLists.txt +++ b/src/test/cpp/CMakeLists.txt @@ -6,7 +6,7 @@ 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 "${CMAKE_PROGRAM_PATH}" ${LOG4CXX_PROGRAM_PATH} ) +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 @@ -71,10 +71,11 @@ add_subdirectory(xml) 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) + 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 ${APR_DLL_DIR};${APR_UTIL_DLL_DIR};${LOG4CXX_DLL_DIR};${XMLLIB_DLL_DIR}\;) + 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 "")
