Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow a QString in a logging request when 'Qt support/integration' is ON #242

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1afccd7
Allow a QString in a logging request when 'Qt support/integration' is ON
stephen-webb Jul 28, 2023
c0ad757
Generate log4cxx-qt when 'Qt support/integration' is ON
stephen-webb Jul 29, 2023
c9b81b8
Restore DOMConfigurator ABI
stephen-webb Jul 29, 2023
80e012d
Merge branch 'master' into add_qstring_support
swebb2066 Aug 4, 2023
3cae7a1
Restore CFString code
stephen-webb Aug 4, 2023
7ff624f
Restore CFString code
stephen-webb Aug 4, 2023
aaf0ca6
Restore CFString code
stephen-webb Aug 4, 2023
0101dba
Restore CFString code
stephen-webb Aug 4, 2023
535cdd3
Restore CFString code
stephen-webb Aug 4, 2023
6f70709
Add missing declaration
stephen-webb Aug 4, 2023
c0335ac
Replace duplicate code
stephen-webb Aug 4, 2023
c3ca1c4
Using a different library name should be optional
stephen-webb Aug 4, 2023
fd0a309
Make reviewing simpler
stephen-webb Aug 4, 2023
1b74043
Allow UNICHAR and QT_SUPPORT concurrently enabled
stephen-webb Aug 4, 2023
bbe2321
Allow UNICHAR and QT_SUPPORT concurrently enabled
stephen-webb Aug 4, 2023
b68e6fe
Remove mdc and ndc from the change set
stephen-webb Aug 4, 2023
28a3252
Fix documentation
stephen-webb Aug 5, 2023
eafea48
Remove reference to log4cxx-qt target
stephen-webb Aug 5, 2023
b7cb50f
Add a example Qt application with automatic configuration
stephen-webb Aug 5, 2023
19bce74
Qt cannot be used until QCoreApplication is initialized
stephen-webb Aug 5, 2023
06a252b
Prevent ambiguous LogManager::exists() overload error
stephen-webb Aug 5, 2023
b2bf304
Prevent 'call of overloaded ‘getLogger(const char*)’ is ambiguous'
stephen-webb Aug 5, 2023
7fb4a4c
Qt requires position independent code on Linux
stephen-webb Aug 5, 2023
d02e134
Merge branch 'master' into add_qstring_support
swebb2066 Aug 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 19 additions & 53 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ include(src/cmake/projectVersionDetails.cmake)
project(log4cxx VERSION ${log4cxx_VER} LANGUAGES CXX)
include(CTest)

# Allow option based library naming.
set(LOG4CXX_LIB_NAME "log4cxx${LOG4CXX_LIBRARY_SUFFIX}")

# If you are including log4cxx from a higher-level CMake file(perhaps as a submodule?)
# CMAKE_SOURCE_DIR will refer to the first CMakeLists.txt. Since we need some files
# in relation to the log4cxx source root, set a variable that contains the log4cxx root.
Expand Down Expand Up @@ -67,6 +70,12 @@ elseif(TARGET expat::expat)
set(EXPAT_LIBRARIES expat::expat)
endif()

option(LOG4CXX_QT_SUPPORT "Qt support/integration" OFF)
if(LOG4CXX_QT_SUPPORT)
find_package(Qt5 COMPONENTS Core REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif(LOG4CXX_QT_SUPPORT)

option(LOG4CXX_ENABLE_ODBC "Support logging via ODBC" OFF)
if(LOG4CXX_ENABLE_ODBC)
find_package(ODBC)
Expand Down Expand Up @@ -126,38 +135,24 @@ if(WIN32)
endif()
include(GNUInstallDirs)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/src/main/include/log4cxx
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LOG4CXX_LIBRARY_SUFFIX}"
FILES_MATCHING PATTERN "*.h"
PATTERN "Private" EXCLUDE
)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/main/include/log4cxx
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LOG4CXX_LIBRARY_SUFFIX}"
FILES_MATCHING PATTERN "*.h"
PATTERN "Private" EXCLUDE
)

install(TARGETS log4cxx EXPORT log4cxxTargets
install(TARGETS ${LOG4CXX_LIB_NAME} EXPORT log4cxxTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

if(LOG4CXX_QT_SUPPORT)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/main/include/log4cxx-qt
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.h"
)
install(TARGETS log4cxx-qt EXPORT log4cxx-qtTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
endif(LOG4CXX_QT_SUPPORT)

IF(WIN32 AND BUILD_SHARED_LIBS AND LOG4CXX_INSTALL_PDB)
INSTALL(FILES $<TARGET_PDB_FILE:log4cxx>
INSTALL(FILES $<TARGET_PDB_FILE:${LOG4CXX_LIB_NAME}>
DESTINATION ${CMAKE_INSTALL_BINDIR}
CONFIGURATIONS RelWithDebInfo Debug
)
Expand All @@ -167,37 +162,24 @@ if(UNIX)
# Support for pkg-config in consuming projects
set(prefix "${CMAKE_INSTALL_PREFIX}")
set(exec_prefix "${CMAKE_INSTALL_PREFIX}")
set(libsuffix "${LOG4CXX_LIBRARY_SUFFIX}")
set(libdir "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}/${LOG4CXX_LIBRARY_SUFFIX}")
set(VERSION "${log4cxx_VERSION_MAJOR}.${log4cxx_VERSION_MINOR}.${log4cxx_VERSION_PATCH}")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/liblog4cxx.pc.in"
"${CMAKE_CURRENT_BINARY_DIR}/liblog4cxx.pc"
"${CMAKE_CURRENT_BINARY_DIR}/lib${LOG4CXX_LIB_NAME}.pc"
)

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/liblog4cxx.pc"
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/lib${LOG4CXX_LIB_NAME}.pc"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

if(LOG4CXX_QT_SUPPORT)
set(prefix "${CMAKE_INSTALL_PREFIX}")
set(exec_prefix "${CMAKE_INSTALL_PREFIX}")
set(libdir "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
set(VERSION "${log4cxx_VERSION_MAJOR}.${log4cxx_VERSION_MINOR}.${log4cxx_VERSION_PATCH}")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/liblog4cxx-qt.pc.in"
"${CMAKE_CURRENT_BINARY_DIR}/liblog4cxx-qt.pc"
)

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/liblog4cxx-qt.pc"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif(LOG4CXX_QT_SUPPORT)
endif(UNIX)

# Support for find_package(log4cxx) in consuming CMake projects using
# target_include_directories(myApplication PRIVATE $<TARGET_PROPERTY:log4cxx,INTERFACE_INCLUDE_DIRECTORIES>)
# target_link_libraries( myApplication PRIVATE log4cxx)
install(EXPORT log4cxxTargets
FILE log4cxxConfig.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/log4cxx
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${LOG4CXX_LIB_NAME}
)
# Support for find_package(log4cxx 0.11) in consuming CMake projects
include(CMakePackageConfigHelpers)
Expand All @@ -206,25 +188,9 @@ write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/log4cxxConfigVersi
COMPATIBILITY SameMinorVersion
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/log4cxxConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/log4cxx
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${LOG4CXX_LIB_NAME}
)

if(LOG4CXX_QT_SUPPORT)
install(EXPORT log4cxx-qtTargets
FILE log4cxx-qtConfig.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/log4cxx-qt
)
# Support for find_package(log4cxx 0.11) in consuming CMake projects
include(CMakePackageConfigHelpers)
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/log4cxx-qtConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMinorVersion
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/log4cxx-qtConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/log4cxx-qt
)
endif(LOG4CXX_QT_SUPPORT)

#
# Get the varaibles from the subdirectories
#
Expand Down
4 changes: 2 additions & 2 deletions liblog4cxx.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@

Name: log4cxx
Name: log4cxx@libsuffix@
Description: log4cxx C++ logging framework
Version: @VERSION@
Libs: -L${libdir} -llog4cxx
Libs: -L${libdir} -llog4cxx@libsuffix@
Cflags: -I${includedir}
Requires.private: apr-1 apr-util-1

14 changes: 7 additions & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ include(${CMAKE_CURRENT_LIST_DIR}/cmake/boost-fallback/boost-fallback.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/compiler-features/check-compiler-support.cmake)

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} ${EXPAT_LIBRARIES} ${APR_LIBRARIES} ${APR_SYSTEM_LIBS})
target_compile_definitions(${LOG4CXX_LIB_NAME} PRIVATE ${LOG4CXX_COMPILE_DEFINITIONS} ${APR_COMPILE_DEFINITIONS} ${APR_UTIL_COMPILE_DEFINITIONS} )
target_include_directories(${LOG4CXX_LIB_NAME} INTERFACE $<INSTALL_INTERFACE:include> PRIVATE ${APR_INCLUDE_DIR} ${APR_UTIL_INCLUDE_DIR})
target_link_libraries(${LOG4CXX_LIB_NAME} PRIVATE ${APR_UTIL_LIBRARIES} ${EXPAT_LIBRARIES} ${APR_LIBRARIES} ${APR_SYSTEM_LIBS})
if(HAS_LIBESMTP)
target_include_directories(log4cxx PRIVATE ${ESMTP_INCLUDE_DIR})
target_link_libraries(log4cxx PRIVATE ${ESMTP_LIBRARIES})
target_include_directories(${LOG4CXX_LIB_NAME} PRIVATE ${ESMTP_INCLUDE_DIR})
target_link_libraries(${LOG4CXX_LIB_NAME} PRIVATE ${ESMTP_LIBRARIES})
endif()
if(HAS_ODBC)
target_include_directories(log4cxx PRIVATE ${ODBC_INCLUDE_DIR})
target_link_libraries( log4cxx PRIVATE ${ODBC_LIBRARIES})
target_include_directories(${LOG4CXX_LIB_NAME} PRIVATE ${ODBC_INCLUDE_DIR})
target_link_libraries(${LOG4CXX_LIB_NAME} PRIVATE ${ODBC_LIBRARIES})
endif(HAS_ODBC)

if(BUILD_TESTING)
Expand Down
2 changes: 1 addition & 1 deletion src/cmake/win32_target_environment_path.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function(get_target_environment_path varName)


set(EXPAT_DLL_DIR "${EXPAT_LIB_DIR}/../bin")
set(LOG4CXX_DLL_DIR "$<SHELL_PATH:$<TARGET_FILE_DIR:log4cxx>>;")
set(LOG4CXX_DLL_DIR "$<SHELL_PATH:$<TARGET_FILE_DIR:${LOG4CXX_LIB_NAME}>>;")
set(PATH_FOR_TESTS ${CMAKE_PROGRAM_PATH};${APR_DLL_DIR};${APR_UTIL_DLL_DIR};${LOG4CXX_DLL_DIR};${EXPAT_DLL_DIR}\;)
if(LOG4CXX_QT_SUPPORT)
list(APPEND PATH_FOR_TESTS "$<SHELL_PATH:$<TARGET_FILE_DIR:log4cxx-qt>>\;")
Expand Down
8 changes: 4 additions & 4 deletions src/examples/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ foreach(exampleName IN LISTS ALL_LOG4CXX_EXAMPLES)
target_sources(${PROGRAM_NAME} PRIVATE com/foo/config3.cpp )
endif()
target_compile_definitions(${PROGRAM_NAME} PRIVATE ${EXAMPLE_COMPILE_DEFINITIONS} ${LOG4CXX_COMPILE_DEFINITIONS} ${APR_COMPILE_DEFINITIONS} ${APR_UTIL_COMPILE_DEFINITIONS} )
target_include_directories(${PROGRAM_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR} $<TARGET_PROPERTY:log4cxx,INCLUDE_DIRECTORIES>)
target_link_libraries(${PROGRAM_NAME} PRIVATE log4cxx ${APR_UTIL_LIBRARIES} ${EXPAT_LIBRARIES} ${APR_LIBRARIES} ${APR_SYSTEM_LIBS})
target_include_directories(${PROGRAM_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR} $<TARGET_PROPERTY:${LOG4CXX_LIB_NAME},INCLUDE_DIRECTORIES>)
target_link_libraries(${PROGRAM_NAME} PRIVATE ${LOG4CXX_LIB_NAME} ${APR_UTIL_LIBRARIES} ${EXPAT_LIBRARIES} ${APR_LIBRARIES} ${APR_SYSTEM_LIBS})
if( WIN32 )
set_target_properties(${PROGRAM_NAME} PROPERTIES
VS_DEBUGGER_ENVIRONMENT "PATH=${ESCAPED_PATH}"
Expand All @@ -60,8 +60,8 @@ endforeach()
if(${fmt_FOUND})
add_executable( format-string format-string.cpp )
target_compile_definitions(format-string PRIVATE ${LOG4CXX_COMPILE_DEFINITIONS} ${APR_COMPILE_DEFINITIONS} ${APR_UTIL_COMPILE_DEFINITIONS} )
target_include_directories(format-string PRIVATE ${CMAKE_CURRENT_LIST_DIR} $<TARGET_PROPERTY:log4cxx,INCLUDE_DIRECTORIES>)
target_link_libraries(format-string PRIVATE log4cxx ${APR_UTIL_LIBRARIES} ${EXPAT_LIBRARIES} ${APR_LIBRARIES} ${APR_SYSTEM_LIBS} fmt::fmt)
target_include_directories(format-string PRIVATE ${CMAKE_CURRENT_LIST_DIR} $<TARGET_PROPERTY:${LOG4CXX_LIB_NAME},INCLUDE_DIRECTORIES>)
target_link_libraries(format-string PRIVATE ${LOG4CXX_LIB_NAME} ${APR_UTIL_LIBRARIES} ${EXPAT_LIBRARIES} ${APR_LIBRARIES} ${APR_SYSTEM_LIBS} fmt::fmt)
if( WIN32 )
set_target_properties( format-string PROPERTIES
VS_DEBUGGER_ENVIRONMENT "PATH=${ESCAPED_PATH}"
Expand Down
2 changes: 1 addition & 1 deletion src/examples/cpp/com/foo/config-qt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void ConfigureLogging() {
auto getLogger(const QString& name) -> LoggerPtr {
return name.isEmpty()
? log4cxx::LogManager::getRootLogger()
: log4cxx::LogManager::getLogger(name.toStdString());
: log4cxx::LogManager::getLogger(name);
}

// Retrieve the \c name logger pointer.
Expand Down
5 changes: 1 addition & 4 deletions src/examples/cpp/stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
BasicConfigurator::configure();
LoggerPtr rootLogger = Logger::getRootLogger();

NDC::push("trivial context");
NDC ctx("trivial context");

log4cxx::logstream logstream(rootLogger, Level::getDebug());
logstream << "debug message " << 1 << LOG4CXX_ENDMSG;
Expand All @@ -43,9 +43,6 @@ int main()
logstream << Level::getWarn() << "warn message" << LOG4CXX_ENDMSG;
logstream << Level::getError() << "error message" << LOG4CXX_ENDMSG;
logstream << Level::getFatal() << "fatal message" << LOG4CXX_ENDMSG;


NDC::pop();
}
catch(std::exception&)
{
Expand Down
11 changes: 4 additions & 7 deletions src/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@
#
add_subdirectory(include)
add_subdirectory(cpp)
add_subdirectory(cpp-qt)
if(LOG4CXX_QT_SUPPORT)
add_subdirectory(cpp-qt)
endif(LOG4CXX_QT_SUPPORT)
add_subdirectory(resources)

# setup include directories
include(GNUInstallDirs)
target_include_directories(log4cxx PUBLIC
target_include_directories(${LOG4CXX_LIB_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
Expand All @@ -34,8 +36,3 @@ if(LOG4CXX_CFSTRING)
endif()
endif()

if(LOG4CXX_QT_SUPPORT)
target_include_directories(log4cxx-qt PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
endif(LOG4CXX_QT_SUPPORT)
30 changes: 7 additions & 23 deletions src/main/cpp-qt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,12 @@
# limitations under the License.
#

option(LOG4CXX_QT_SUPPORT "Qt support/integration" OFF)

# Log4cxx Qt support, if enabled
if(LOG4CXX_QT_SUPPORT)
find_package(Qt5 COMPONENTS Core REQUIRED)

add_library(log4cxx-qt)
if(BUILD_SHARED_LIBS)
target_compile_definitions(log4cxx-qt PRIVATE LOG4CXX)
else()
target_compile_definitions(log4cxx-qt PUBLIC LOG4CXX_STATIC)
endif()
add_dependencies(log4cxx-qt configure_log4cxx)
target_compile_definitions(log4cxx-qt PRIVATE "QT_NO_KEYWORDS")
target_link_libraries(log4cxx-qt Qt5::Core log4cxx)
target_sources(log4cxx-qt
PRIVATE
messagehandler.cpp
configuration.cpp
)
set_target_properties(log4cxx-qt PROPERTIES
VERSION ${LIBLOG4CXX_LIB_VERSION}
SOVERSION ${LIBLOG4CXX_LIB_SOVERSION}
)
endif( LOG4CXX_QT_SUPPORT)
target_compile_definitions(${LOG4CXX_LIB_NAME} PRIVATE "QT_NO_KEYWORDS")
target_link_libraries(${LOG4CXX_LIB_NAME} PRIVATE Qt5::Core)
target_sources(${LOG4CXX_LIB_NAME}
PRIVATE
messagehandler.cpp
configuration.cpp
)
5 changes: 2 additions & 3 deletions src/main/cpp-qt/configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <log4cxx/helpers/loglog.h>
#include <log4cxx/xml/domconfigurator.h>
#include <log4cxx/propertyconfigurator.h>

#include <QFileSystemWatcher>
#include <QDir>
#include <QFile>
Expand Down Expand Up @@ -73,10 +72,10 @@ log4cxx::spi::ConfigurationStatus Configuration::tryLoadFile(const QString& file
bool isXML = false;

if(filename.endsWith(".xml")){
stat = log4cxx::xml::DOMConfigurator::configure(filename.toStdString());
stat = log4cxx::xml::DOMConfigurator::configure(filename);
isXML = true;
}else if(filename.endsWith(".properties")){
stat = log4cxx::PropertyConfigurator::configure(filename.toStdString());
stat = log4cxx::PropertyConfigurator::configure(filename);
}

if( stat == log4cxx::spi::ConfigurationStatus::Configured ){
Expand Down
24 changes: 12 additions & 12 deletions src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
option(LOG4CXX_ABI_CHECK "Check for ABI changes" OFF)

# Build the log4cxx library
add_library(log4cxx)
add_library(${LOG4CXX_LIB_NAME})
if(BUILD_SHARED_LIBS)
target_compile_definitions(log4cxx PRIVATE LOG4CXX)
target_compile_definitions(${LOG4CXX_LIB_NAME} PRIVATE LOG4CXX)
else()
target_compile_definitions(log4cxx PUBLIC LOG4CXX_STATIC)
target_compile_definitions(${LOG4CXX_LIB_NAME} PUBLIC LOG4CXX_STATIC)
endif()
add_dependencies(log4cxx configure_log4cxx)
add_dependencies(${LOG4CXX_LIB_NAME} configure_log4cxx)

set(extra_classes "")

Expand Down Expand Up @@ -59,7 +59,7 @@ if(${ENABLE_FMT_LAYOUT})
)
endif()

target_sources(log4cxx
target_sources(${LOG4CXX_LIB_NAME}
PRIVATE
action.cpp
andfilter.cpp
Expand Down Expand Up @@ -201,19 +201,19 @@ target_sources(log4cxx
zipcompressaction.cpp
${extra_classes}
)
set_target_properties(log4cxx PROPERTIES
set_target_properties(${LOG4CXX_LIB_NAME} PROPERTIES
VERSION ${LIBLOG4CXX_LIB_VERSION}
SOVERSION ${LIBLOG4CXX_LIB_SOVERSION}
)
boostfallback_link(log4cxx)
boostfallback_link(${LOG4CXX_LIB_NAME})
get_directory_property( FILESYSTEM_IMPL DIRECTORY "${LOG4CXX_SOURCE_DIR}/src/main/include" DEFINITION FILESYSTEM_IMPL )
if("${FILESYSTEM_IMPL}" STREQUAL "std::filesystem" OR
"${FILESYSTEM_IMPL}" STREQUAL "std::experimental::filesystem" )
target_link_libraries(log4cxx PUBLIC $<$<AND:$<CXX_COMPILER_ID:GNU>,$<VERSION_LESS:$<CXX_COMPILER_VERSION>,9.0>>:stdc++fs>)
target_link_libraries(${LOG4CXX_LIB_NAME} PUBLIC $<$<AND:$<CXX_COMPILER_ID:GNU>,$<VERSION_LESS:$<CXX_COMPILER_VERSION>,9.0>>:stdc++fs>)
endif()

if(${ENABLE_FMT_LAYOUT})
target_link_libraries(log4cxx PUBLIC fmt::fmt)
target_link_libraries(${LOG4CXX_LIB_NAME} PUBLIC fmt::fmt)
endif()

if(LOG4CXX_ABI_CHECK)
Expand Down Expand Up @@ -242,12 +242,12 @@ if(LOG4CXX_ABI_CHECK)
set(abi-compliance-script ${abi-compliance-checker_SOURCE_DIR}/abi-compliance-checker.pl)

add_custom_target(dump-abi ALL
COMMAND perl ${abi-dumper-script} -o new-abi.dump -skip-cxx -vnum ${log4cxx_ABI_VER} $<TARGET_FILE:log4cxx>
DEPENDS log4cxx
COMMAND perl ${abi-dumper-script} -o new-abi.dump -skip-cxx -vnum ${log4cxx_ABI_VER} $<TARGET_FILE:${LOG4CXX_LIB_NAME}>
DEPENDS ${LOG4CXX_LIB_NAME}
COMMENT "Dumping ABI symbols")

add_custom_target(compare-abi ALL
COMMAND perl ${abi-compliance-script} -skip-internal-symbols "\\d\\(fmt\\)" -skip-internal-types "\\(fmt\\)::" -l log4cxx -old ${LOG4CXX_SOURCE_DIR}/src/main/abi-symbols/abi.dump -new new-abi.dump
COMMAND perl ${abi-compliance-script} -skip-internal-symbols "\\d\\(fmt\\)" -skip-internal-types "\\(fmt\\)::" -l ${LOG4CXX_LIB_NAME} -old ${LOG4CXX_SOURCE_DIR}/src/main/abi-symbols/abi.dump -new new-abi.dump
DEPENDS dump-abi
COMMENT "Comparing ABI symbols")
endif(LOG4CXX_ABI_CHECK)
4 changes: 2 additions & 2 deletions src/main/cpp/aprsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ APRSocket::APRSocket(apr_socket_t* s, apr_pool_t* pool) :

if (sa->hostname != NULL)
{
Transcoder::decode(sa->hostname, remotename);
remotename = Transcoder::decode(sa->hostname);
}

char* buf = 0;
status = apr_sockaddr_ip_get(&buf, sa);

if (status == APR_SUCCESS)
{
Transcoder::decode(buf, remoteip);
remoteip = Transcoder::decode(buf);
}

_priv->address = std::make_shared<InetAddress>(remotename, remoteip);
Expand Down
Loading
Loading