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/04 03:10:50 UTC

[logging-log4cxx] 01/03: Use expat variables to link

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 6b6bc3b640add64e9f8340e294d5f4eb28cc9ecb
Author: Robert Middleton <ro...@rm5248.com>
AuthorDate: Thu Sep 3 19:50:05 2020 -0700

    Use expat variables to link
---
 CMakeLists.txt                  |  1 -
 src/CMakeLists.txt              |  2 +-
 src/test/cpp/CMakeLists.txt     | 10 ++++++++++
 src/test/cpp/xml/CMakeLists.txt |  2 +-
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f380439..3ecf5f0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,7 +25,6 @@ find_package(APR-Util REQUIRED)
 
 # Find expat for XML parsing
 find_package(EXPAT REQUIRED)
-set(XMLLIB_LIBRARIES EXPAT_LIBRARIES)
 
 # 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/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)