-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
84 lines (67 loc) · 2.92 KB
/
CMakeLists.txt
File metadata and controls
84 lines (67 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
project(liblogcpp)
cmake_minimum_required( VERSION 3.0 )
set( LIBLOGCPP_STABLE_VERSION 1 )
set( LIBLOGCPP_RELEASE 10 )
set( LIBLOGCPP_PATCH_VERSION 1 )
set( LIBLOGCPP_VERSION "${LIBLOGCPP_STABLE_VERSION}.${LIBLOGCPP_RELEASE}.${LIBLOGCPP_PATCH_VERSION}" )
set( LIBLOGCPP_SRC_DIR ${PROJECT_SOURCE_DIR}/src )
set ( PROJECT_NAME "${CMAKE_PROJECT_NAME}" )
set ( PROJECT_VERSION "${LIBLOGCPP_VERSION}" )
set ( PROJECT_DESCRIPTION "An intuitive and highly customizable LGPL library for logging with C++." )
if( UNIX )
add_definitions( -std=c++17 )
endif()
add_definitions(-DLOGCPP_SRC_DIR=${LIBLOGCPP_SRC_DIR})
if( LOGCPP_DESTDIR )
else()
set( LOGCPP_DESTDIR "${CMAKE_INSTALL_PREFIX}" )
endif()
file (GLOB LIBLOGCPP_HEADERS ${LIBLOGCPP_SRC_DIR}/*.hpp )
set ( LIBLOGCPP_SOURCE ${LIBLOGCPP_SRC_DIR}/basic_log_input.cpp ${LIBLOGCPP_SRC_DIR}/log.cpp ${LIBLOGCPP_SRC_DIR}/severity_default.cpp ${LIBLOGCPP_SRC_DIR}/severity_logger.cpp )
## COLOR CODES ARE NOT WORKING ANYMORE
#if( UNIX )
# set( LIBLOGCPP_SOURCE ${LIBLOGCPP_SOURCE} ${LIBLOGCPP_SRC_DIR}/color_feature.cpp )
# message("-- Compiling with support for ANSI Color codes")
# add_definitions( -DLOGCPP_AUTOCOLOR=1 )
#else()
# list(REMOVE_ITEM ${LIBLOGCPP_HEADERS} "${LIBLOGCPP_SRC_DIR}/color_feature.hpp")
#endif()
if( LOGCPP_SHARED )
add_library( logcpp SHARED ${LIBLOGCPP_SOURCE} )
set( LOGCPP_PKGCONFIG_LIBNAME "liblogcpp.so" )
else()
add_library( logcpp STATIC ${LIBLOGCPP_SOURCE} )
set( LOGCPP_PKGCONFIG_LIBNAME "liblogcpp.a" )
endif()
if( BUILD_LOGCPP_TEST )
# Instruct CMake not to run moc automatically when needed.
set(CMAKE_AUTOMOC OFF)
# Find the QtCore library
find_package(Qt5Core)
# Build the test binary
add_executable( logcpp_test ${LIBLOGCPP_SRC_DIR}/main.cpp )
target_link_libraries( logcpp_test logcpp ${Qt5Core_LIBRARIES} )
endif()
if( LOGCPP_HEADER_INSTALL_DIR )
else()
set( LOGCPP_HEADER_INSTALL_DIR ${LOGCPP_DESTDIR}/include/liblogcpp )
endif()
if ( LOGCPP_LIB_INSTALL_DIR )
else()
set ( LOGCPP_LIB_INSTALL_DIR ${LOGCPP_DESTDIR}/lib )
endif()
if( LOGCPP_INSTALL_LIBS )
install(TARGETS logcpp DESTINATION ${LOGCPP_LIB_INSTALL_DIR} )
install(FILES ${LIBLOGCPP_HEADERS} DESTINATION ${LOGCPP_HEADER_INSTALL_DIR} )
install(FILES ${PROJECT_SOURCE_DIR}/lib/LibLogCPPConfig.cmake DESTINATION "${LOGCPP_LIB_INSTALL_DIR}/cmake/LibLogCPP" )
configure_file(${PROJECT_SOURCE_DIR}/lib/liblogcpp.pc.in ${CMAKE_CURRENT_BINARY_DIR}/liblogcpp.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/liblogcpp.pc DESTINATION "${LOGCPP_LIB_INSTALL_DIR}/pkgconfig" )
endif()
if( UNIX AND ENABLE_DOC_LOGCPP )
find_package(Doxygen)
if(DOXYGEN_FOUND)
message("-- Enabled doc_logcpp target for make")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
add_custom_target(doc_logcpp ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Generating documentation with Doxygen")
endif()
endif()