-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
92 lines (70 loc) · 2.15 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Copyright Dominic (DNKpp) Koepke 2024 - 2024.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# https://www.boost.org/LICENSE_1_0.txt)
cmake_minimum_required(VERSION 3.15)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
project(
mimicpp
LANGUAGES CXX
VERSION 4
DESCRIPTION "A modern and (mostly) macro free mocking-framework"
HOMEPAGE_URL "https://github.com/DNKpp/mimicpp"
)
include(GNUInstallDirs)
add_library(mimicpp INTERFACE)
add_library(mimicpp::mimicpp ALIAS mimicpp)
target_include_directories(
mimicpp
INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)
target_compile_options(
mimicpp
INTERFACE
# this option is required to make __VA_OPT__ work on msvc
"$<$<CXX_COMPILER_ID:MSVC>:/Zc:preprocessor>"
)
set(CMAKE_CXX_STANDARD 20)
if (MIMICPP_FORCED_CXX_STANDARD)
set(CMAKE_CXX_STANDARD ${MIMICPP_FORCED_CXX_STANDARD})
endif()
target_compile_features(
mimicpp
INTERFACE
cxx_std_${CMAKE_CXX_STANDARD}
)
include(EnableConfigOptions)
target_link_libraries(
mimicpp
INTERFACE
mimicpp::internal::config-options
)
if (CMAKE_SOURCE_DIR STREQUAL mimicpp_SOURCE_DIR)
set(IS_TOP_LEVEL_PROJECT ON)
else()
set(IS_TOP_LEVEL_PROJECT OFF)
endif()
OPTION(MIMICPP_BUILD_TESTS "Determines, whether the tests shall be built." ${IS_TOP_LEVEL_PROJECT})
if (MIMICPP_BUILD_TESTS)
include(CTest)
add_subdirectory("test")
endif()
OPTION(MIMICPP_BUILD_EXAMPLES "Determines, whether the examples shall be built." ${IS_TOP_LEVEL_PROJECT})
if (MIMICPP_BUILD_EXAMPLES)
include(CTest)
add_subdirectory("examples")
endif()
OPTION(MIMICPP_CONFIGURE_DOXYGEN "Determines, whether the doxyfile shall be configured." OFF)
if (MIMICPP_CONFIGURE_DOXYGEN)
OPTION(MIMICPP_ENABLE_GENERATE_DOCS "Enable the doxygen documentation target." OFF)
add_subdirectory("docs")
endif()
OPTION(MIMICPP_ENABLE_AMALGAMATE_HEADERS "Enables the amalgamation target." OFF)
if (MIMICPP_ENABLE_AMALGAMATE_HEADERS)
add_subdirectory("tools/amalgamate-headers")
endif()
if(NOT CMAKE_SKIP_INSTALL_RULES)
include(InstallRules)
endif()