-
Notifications
You must be signed in to change notification settings - Fork 10
/
CMakeLists.txt
64 lines (51 loc) · 1.44 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.14)
project(
humblelogging
VERSION 0.0.0
DESCRIPTION "HumbleLogging is a lightweight C++ logging framework. It aims to be extendible, easy to understand and as fast as possible."
HOMEPAGE_URL "https://github.com/mfreiholz/humblelogging"
)
#
# Options
#
option(BuildShared "BuildShared" OFF)
option(BuildTests "BuildTests" OFF)
option(BuildApps "BuildApps" ON)
if(WIN32)
add_definitions(/Zc:wchar_t-)
add_definitions(/INCREMENTAL:NO)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif(WIN32)
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
endif(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_STANDARD 17)
configure_file(
${PROJECT_SOURCE_DIR}/version.h.in
${PROJECT_SOURCE_DIR}/libs/humblelogging/include/humblelogging/version.h
)
#
# Third Party Libraries / Dependencies
# All of them should be optional.
#
if(BuildTests)
include(thirdparty/googletest.cmake)
endif(BuildTests)
# Apps
macro(humblelogging_POSTBUILD_COPY target_)
add_custom_command(
TARGET ${target_} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:humblelogging>
$<TARGET_FILE_DIR:${target_}>/$<TARGET_FILE_NAME:humblelogging>
)
endmacro(humblelogging_POSTBUILD_COPY)
add_subdirectory(libs/humblelogging)
if(BuildApps)
add_subdirectory(apps/basic_example)
add_subdirectory(apps/benchmark)
endif(BuildApps)
# Unit Testing
if(BuildTests)
add_subdirectory(tests)
endif(BuildTests)