-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
59 lines (38 loc) · 2.27 KB
/
CMakeLists.txt
File metadata and controls
59 lines (38 loc) · 2.27 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
###############################################################################
# CMAKE VERSION #
###############################################################################
CMAKE_MINIMUM_REQUIRED (VERSION 3.11.4)
###############################################################################
# PROJECT #
###############################################################################
PROJECT (buildmode
VERSION 1.0.0
LANGUAGES CXX
DESCRIPTION "A C++11 library to easily handle code paths for different build modes like Debug and Release.")
###############################################################################
# LIBRARY #
###############################################################################
ADD_LIBRARY (buildmode INTERFACE)
###############################################################################
# HEADERS #
###############################################################################
TARGET_INCLUDE_DIRECTORIES (buildmode INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
###############################################################################
# TESTS #
###############################################################################
IF (BUILD_TESTING)
ENABLE_TESTING()
ADD_EXECUTABLE (isDebug "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_isDebug.cpp")
ADD_EXECUTABLE (isRelease "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_isRelease.cpp")
TARGET_LINK_LIBRARIES (isDebug buildmode ${COVERAGE_FLAG})
TARGET_LINK_LIBRARIES (isRelease buildmode ${COVERAGE_FLAG})
IF (MSVC)
TARGET_COMPILE_OPTIONS (isDebug PRIVATE /std:c++11)
TARGET_COMPILE_OPTIONS (isRelease PRIVATE /std:c++11 /DNDEBUG)
ELSE ()
TARGET_COMPILE_OPTIONS (isDebug PRIVATE -std=c++11 -g -Wall -Wextra -Werror -pedantic ${COVERAGE_FLAG})
TARGET_COMPILE_OPTIONS (isRelease PRIVATE -std=c++11 -DNDEBUG -O3 -Wall -Wextra -Werror -pedantic ${COVERAGE_FLAG})
ENDIF ()
ADD_TEST ([BUILDMODE]isDebug isDebug)
ADD_TEST ([BUILDMODE]isRelease isRelease)
ENDIF ()