You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
105 lines
3.2 KiB
105 lines
3.2 KiB
# This block needs to stay before the project (log4cplus) line so that
|
|
# the output files placed into Android's libs directory.
|
|
if (CMAKE_TOOLCHAIN_FILE)
|
|
# Android: set output folder to ${CMAKE_BINARY_DIR}
|
|
set (LIBRARY_OUTPUT_PATH_ROOT ${CMAKE_BINARY_DIR} CACHE PATH
|
|
"root for library output, set this to change where android libs are compiled to")
|
|
endif ()
|
|
|
|
project (log4cplus)
|
|
cmake_minimum_required (VERSION 2.8.0)
|
|
|
|
include (Log4CPlusUtils.cmake)
|
|
log4cplus_get_version ("${PROJECT_SOURCE_DIR}/include"
|
|
log4cplus_version_major log4cplus_version_minor log4cplus_version_patch)
|
|
message("-- Generating build for Log4cplus version ${log4cplus_version_major}.${log4cplus_version_minor}.${log4cplus_version_patch}")
|
|
set (log4cplus_soversion 7)
|
|
set (log4cplus_postfix "")
|
|
|
|
option(LOG4CPLUS_BUILD_TESTING "Build the test suite." ON)
|
|
|
|
find_package (Threads)
|
|
message (STATUS "Threads: ${CMAKE_THREAD_LIBS_INIT}")
|
|
|
|
set(BUILD_SHARED_LIBS TRUE CACHE BOOL "If TRUE, log4cplus is built as a shared library, otherwise as a static library")
|
|
|
|
message(STATUS "Building shared libs: ${BUILD_SHARED_LIBS}")
|
|
|
|
if (WIN32)
|
|
set (UNICODE_DEFAULT ON)
|
|
else (WIN32)
|
|
set (UNICODE_DEFAULT OFF)
|
|
endif (WIN32)
|
|
|
|
if (MSVC)
|
|
set (LOG4CPLUS_WORKING_LOCALE_DEFAULT ON)
|
|
else (MSVC)
|
|
set (CMAKE_CXX_FLAGS "-std=c++11")
|
|
set (LOG4CPLUS_WORKING_LOCALE_DEFAULT OFF)
|
|
endif (MSVC)
|
|
|
|
option(LOG4CPLUS_WORKING_LOCALE "Define for compilers/standard libraries that support more than just the C locale."
|
|
${LOG4CPLUS_WORKING_LOCALE_DEFAULT})
|
|
|
|
option(LOG4CPLUS_WORKING_C_LOCALE
|
|
"Define for compilers/standard libraries that have working C locale."
|
|
OFF)
|
|
|
|
option (LOG4CPLUS_QT4 "Build with Qt4DebugAppender" OFF)
|
|
|
|
option(UNICODE "Build with tchar = wchar_t" ${UNICODE_DEFAULT})
|
|
|
|
option(WITH_ICONV "Use iconv() for char->wchar_t conversion."
|
|
OFF)
|
|
|
|
set(_WIN32_WINNT 0x0500 CACHE STRING "Define Windows API version to use.")
|
|
|
|
if (NOT ${BUILD_SHARED_LIBS})
|
|
# set S-prefix for static build
|
|
set (log4cplus_postfix "${log4cplus_postfix}S")
|
|
endif()
|
|
|
|
if (UNICODE)
|
|
set (log4cplus_postfix "${log4cplus_postfix}U")
|
|
endif (UNICODE)
|
|
|
|
if (WITH_ICONV)
|
|
set(LOG4CPLUS_WITH_ICONV 1)
|
|
endif ()
|
|
|
|
set (log4cplus "log4cplus${log4cplus_postfix}")
|
|
|
|
include(ConfigureChecks.cmake)
|
|
|
|
# Prepare defines.hxx.cmake from defines.hxx.in by doing a bit of
|
|
# string manipulation.
|
|
file(READ include/log4cplus/config/defines.hxx.in FILE_BUFFER)
|
|
string(REGEX REPLACE "#undef[^a-zA-Z0-9_]+([a-zA-Z0-9_]+)"
|
|
"#cmakedefine \\1 @\\1@" FILE_BUFFER "${FILE_BUFFER}")
|
|
set(DEFINES_HXX_CMAKE
|
|
${log4cplus_BINARY_DIR}/include/log4cplus/config/defines.hxx.cmake)
|
|
set(DEFINES_HXX ${log4cplus_BINARY_DIR}/include/log4cplus/config/defines.hxx)
|
|
file(WRITE ${DEFINES_HXX_CMAKE} ${FILE_BUFFER})
|
|
|
|
configure_file(${DEFINES_HXX_CMAKE} ${DEFINES_HXX} @ONLY)
|
|
|
|
include_directories (${log4cplus_SOURCE_DIR}/include
|
|
${log4cplus_BINARY_DIR}/include
|
|
)
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
|
|
|
|
if (LOG4CPLUS_BUILD_TESTING)
|
|
enable_testing()
|
|
endif (LOG4CPLUS_BUILD_TESTING)
|
|
|
|
add_subdirectory (src)
|
|
add_subdirectory (loggingserver)
|
|
if (LOG4CPLUS_BUILD_TESTING)
|
|
add_subdirectory (tests)
|
|
endif (LOG4CPLUS_BUILD_TESTING)
|
|
if (LOG4CPLUS_QT4)
|
|
add_subdirectory (qt4debugappender)
|
|
endif (LOG4CPLUS_QT4)
|
|
|
|
include(Log4CPlusCPack.cmake)
|