#
# 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.
#
cmake_minimum_required(VERSION 3.13)
include(src/cmake/projectVersionDetails.cmake)
project(log4cxx VERSION ${log4cxx_VER} LANGUAGES CXX)
include(CTest)
# 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.
set(LOG4CXX_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
# The namespace in which all log4cxx entities will be placed, default value is "log4cxx"
set(LOG4CXX_NS "log4cxx" CACHE STRING "Root namespace name")
# define the SO Version of the library. Version of the log4cxx project is subtly different than the version of the library
# (at least in the past it was project vesion: 0.a.b.c and the library so vesion a.b.c.0
# See also: https://mail.kde.org/pipermail/kde-buildsystem/2008-April/004543.html
# Note that the lib version is different from the SOVERSION
# The lib version is the version of log4cxx, the SOVERSION is the ABI version
# See also: https://cmake.org/pipermail/cmake/2012-September/051904.html
set(current_log4cxx_ABI_VER 15)
set(next_log4cxx_ABI_VER 16)
set(log4cxx_ABI_VER "${current_log4cxx_ABI_VER}" CACHE STRING "The DSO library version")
set_property(CACHE log4cxx_ABI_VER PROPERTY STRINGS "${current_log4cxx_ABI_VER}" "${next_log4cxx_ABI_VER}")
set(LIBLOG4CXX_LIB_VERSION ${log4cxx_ABI_VER}.${log4cxx_VERSION_MINOR}.${log4cxx_VERSION_PATCH})
set(LIBLOG4CXX_LIB_SOVERSION ${log4cxx_ABI_VER})
# Set the 'release' version. This is the human-readable version
set(LOG4CXX_RELEASE_VERSION ${log4cxx_VERSION_MAJOR}.${log4cxx_VERSION_MINOR}.${log4cxx_VERSION_PATCH})
# FindAPR and FindAPR-util are not provided by APR and APR-Util so source them locally
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/src/cmake")
# Add support for linking statically
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
if(NOT BUILD_SHARED_LIBS)
set(LOG4CXX_COMPILE_DEFINITIONS LOG4CXX_STATIC)
endif()
option(ENABLE_COVERAGE "Enable code coverage" OFF)
if(ENABLE_COVERAGE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
endif()
# Find Apache Runtime
option(APR_STATIC "Link to the APR static library" OFF)
find_package(APR REQUIRED)
# Find Apache Runtime Utilities
option(APU_STATIC "Link to the APR-Util static library" OFF)
find_package(APR-Util REQUIRED)
find_package( Threads REQUIRED )
# Find expat for XML parsing
find_package(EXPAT REQUIRED)
if(TARGET EXPAT::EXPAT)
set(EXPAT_LIBRARIES EXPAT::EXPAT)
elseif(TARGET expat::expat)
set(EXPAT_LIBRARIES expat::expat)
endif()
option(LOG4CXX_ENABLE_ODBC "Support logging via ODBC" OFF)
if(LOG4CXX_ENABLE_ODBC)
find_package(ODBC)
if(${ODBC_FOUND})
set(HAS_ODBC 1)
else()
set(HAS_ODBC 0)
endif(${ODBC_FOUND})
if(NOT ${HAS_ODBC})
message(SEND_ERROR "ODBC not found but requested")
endif()
else()
set(HAS_ODBC 0)
endif(LOG4CXX_ENABLE_ODBC)
option(LOG4CXX_ENABLE_ESMTP "Support logging via libesmtp" OFF)
option(LIBESMTP_STATIC "Link to the libesmtp static library" OFF)
if(LOG4CXX_ENABLE_ESMTP)
find_package(ESMTP)
if(ESMTP_FOUND)
set(HAS_LIBESMTP 1)
else()
set(HAS_LIBESMTP 0)
message(SEND_ERROR "libesmtp not found but SMTP support requested")
endif(ESMTP_FOUND)
else()
set(ESMTP_LIBRARIES )
set(HAS_LIBESMTP 0)
endif(LOG4CXX_ENABLE_ESMTP)
find_package(fmt 7.1 QUIET)
if(${fmt_FOUND})
option(ENABLE_FMT_LAYOUT "Enable the FMT layout(if libfmt found)" ON)
else()
set(ENABLE_FMT_LAYOUT "OFF")
endif()
# Request C++20, if available
# This *should* fallback to an older standard if it is not available
if( NOT "${CMAKE_CXX_STANDARD}")
set(CMAKE_CXX_STANDARD 20)
endif()
# Don't allow for compiler-specific extensions
set(CMAKE_CXX_EXTENSIONS OFF)
# Use solution folders.
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Building
add_subdirectory(src)
## Installing
if(WIN32)
option(LOG4CXX_INSTALL_PDB "Install .pdb files (if generated)" ON)
endif()
include(GNUInstallDirs)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/src/main/include/log4cxx
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.h"
PATTERN "Private" EXCLUDE
)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/main/include/log4cxx
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.h"
PATTERN "Private" EXCLUDE
)
install(TARGETS log4cxx EXPORT ${LOG4CXX_LIB_NAME}Targets
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_LIB_NAME}-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(MSVC AND BUILD_SHARED_LIBS AND LOG4CXX_INSTALL_PDB)
INSTALL(FILES $<TARGET_PDB_FILE:log4cxx>
DESTINATION ${CMAKE_INSTALL_BINDIR}
CONFIGURATIONS RelWithDebInfo Debug
)
ENDIF()
if(UNIX)
# Support for pkg-config in consuming projects
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.pc.in"
"${CMAKE_CURRENT_BINARY_DIR}/lib${LOG4CXX_LIB_NAME}.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}/lib${LOG4CXX_LIB_NAME}-qt.pc"
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/lib${LOG4CXX_LIB_NAME}-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 ${LOG4CXX_LIB_NAME}Targets
FILE ${LOG4CXX_LIB_NAME}Config.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${LOG4CXX_LIB_NAME}
)
# Support for find_package(log4cxx 0.11) in consuming CMake projects
include(CMakePackageConfigHelpers)
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/${LOG4CXX_LIB_NAME}ConfigVersion.cmake"
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
本项目是基于Apache Log4cxx的C++日志库设计源码,共有839个文件,其中包括305个C++源文件、233个头文件、54个属性文件、33个文本文件、32个Markdown文件、30个XML文件、18个版本控制文件、14个二进制文件、10个CMake文件。Apache Log4cxx是一个C++版本的Apache Log4j,提供了一种灵活、可扩展的日志记录机制,适用于各种C++应用程序的开发。
资源推荐
资源详情
资源评论
收起资源包目录
基于Apache Log4cxx的C++日志库设计源码 (843个子文件)
sbr-test2.0 100B
tbr-test6.0 33B
tbr-test4.0 33B
tbr-test5.0 33B
tbr-test1.0 0B
tbr-test2.0 0B
xmlLayout.1 3KB
socketServer.1 2KB
l7d.1 1KB
dom.A1.1 455B
dom.A2.1 446B
NDC.1 415B
xmlLayout.mdc.1 288B
customLogger.1 282B
customLevel.1 210B
patternLayout.1 180B
sbr-test2.1 100B
tbr-test4.1 66B
tbr-test1.1 66B
tbr-test2.1 66B
tbr-test5.1 66B
messagebuffer.1 53B
patternLayout.mdc.1 45B
threadnametestcase.1 21B
hierarchyThreshold.1 0B
patternLayout.10 489B
patternLayout.11 384B
patternLayout.12 489B
patternLayout.13 270B
patternLayout.14 390B
xmlLayout.2 4KB
socketServer.2 2KB
patternLayout.mdc.2 471B
dom.A1.2 455B
dom.A2.2 446B
patternLayout.2 370B
xmlLayout.mdc.2 348B
customLevel.2 210B
tbr-test1.2 66B
tbr-test2.2 66B
tbr-test4.2 66B
tbr-test5.2 66B
customLogger.2 47B
hierarchyThreshold.2 38B
socketServer.3 2KB
xmlLayout.3 678B
patternLayout.3 369B
hierarchyThreshold.3 76B
tbr-test4.3 66B
tbr-test5.3 66B
customLevel.3 42B
tbr-test1.3 33B
tbr-test2.3 33B
tbr-test3.3 33B
socketServer.4 2KB
patternLayout.4 369B
customLevel.4 210B
hierarchyThreshold.4 113B
socketServer.5 2KB
patternLayout.5 369B
hierarchyThreshold.5 150B
socketServer.6 2KB
patternLayout.6 369B
hierarchyThreshold.6 188B
socketServer.7 2KB
patternLayout.7 369B
hierarchyThreshold.7 226B
socketServer.8 2KB
patternLayout.8 359B
hierarchyThreshold.8 226B
patternLayout.9 359B
.astylerc 972B
MSG00001.bin 164B
FindAPR.cmake 3KB
FindAPR-Util.cmake 3KB
FindESMTP.cmake 3KB
FindODBC.cmake 2KB
win32_target_environment_path.cmake 2KB
boost-fallback.cmake 1KB
check-compiler-support.cmake 913B
boost-std-configuration.h.cmake 733B
log4cxx-pthread.cmake 376B
makeunique.h.cmake 369B
projectVersionDetails.cmake 235B
domconfigurator.cpp 31KB
logger.cpp 27KB
timebasedrollingtest.cpp 23KB
streamtestcase.cpp 21KB
cacheddateformattestcase.cpp 19KB
odbcappender.cpp 19KB
messagebuffer.cpp 19KB
loggertestcase.cpp 18KB
smtpappender.cpp 18KB
propertyconfigurator.cpp 17KB
multiprocessrollingfileappender.cpp 17KB
simpledateformat.cpp 16KB
patternlayouttest.cpp 15KB
rollingfileappender.cpp 15KB
timebasedrollingpolicy.cpp 15KB
charsetencoder.cpp 15KB
共 843 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
资源评论
沐知全栈开发
- 粉丝: 4959
- 资源: 4984
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功