You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rm...@apache.org on 2020/09/05 20:51:32 UTC
[logging-log4cxx] 01/07: Use find expat
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 ff3fefad1a7e221913b43dc306080a8b5359324b
Author: Robert Middleton <ro...@rm5248.com>
AuthorDate: Thu Sep 3 21:18:31 2020 -0400
Use find expat
Use expat variables to link
---
CMakeLists.txt | 3 +++
src/CMakeLists.txt | 2 +-
src/cmake/FindAPR-Util.cmake | 2 --
src/test/cpp/CMakeLists.txt | 10 ++++++++++
src/test/cpp/xml/CMakeLists.txt | 2 +-
5 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d30a71b..3ecf5f0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,6 +23,9 @@ find_package(APR REQUIRED)
# Find Apache Runtime Utilities
find_package(APR-Util REQUIRED)
+# Find expat for XML parsing
+find_package(EXPAT REQUIRED)
+
# Building
add_subdirectory(src)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3e0cb17..9a450b7 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,7 +1,7 @@
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
target_link_libraries(log4cxx PRIVATE odbc32.lib)
diff --git a/src/cmake/FindAPR-Util.cmake b/src/cmake/FindAPR-Util.cmake
index 76d4c3b..aecb240 100644
--- a/src/cmake/FindAPR-Util.cmake
+++ b/src/cmake/FindAPR-Util.cmake
@@ -52,8 +52,6 @@ else()
else()
find_library(APR_UTIL_LIBRARIES NAMES libaprutil-1)
find_program(APR_UTIL_DLL libaprutil-1.dll)
- find_library(XMLLIB_LIBRARIES NAMES libexpatd)
- find_program(XMLLIB_DLL libexpatd.dll)
endif()
endif()
diff --git a/src/test/cpp/CMakeLists.txt b/src/test/cpp/CMakeLists.txt
index d81b213..2e847d5 100644
--- a/src/test/cpp/CMakeLists.txt
+++ b/src/test/cpp/CMakeLists.txt
@@ -5,6 +5,16 @@ target_include_directories(testingFramework PRIVATE ${CMAKE_CURRENT_LIST_DIR} $<
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} )
+
+# 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
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 @@ add_executable(xmltests
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)