-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
50 lines (39 loc) · 1.38 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
cmake_minimum_required(VERSION 3.16)
project(smaep)
include(CMakeModules/clang-cover.cmake)
set(CMAKE_CXX_STANDARD 17)
# set(FETCHCONTENT_BASE_DIR ${CMAKE_SOURCE_DIR}/3rdParty CACHE PATH "Download
# path for 3rdParty stuff")
include(FetchContent)
# force static runtime libraries for msvc builds
if(MSVC)
set(variables CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_MINSIZEREL)
foreach(variable ${variables})
if(${variable} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${variable} "${${variable}}")
endif()
endforeach()
endif()
option(SMAEP_BUILD_CLI_TOOL "Build the smaep cli calculator." ON)
option(SMAEP_BUILD_JSON_SOURCE "Build json data source." ON)
option(SMAEP_BUILD_TESTS "Build unit tests for all components." ON)
option(SMAEP_CODE_COVERAGE "Enable clang code coverage for tests." ON)
if(SMAEP_BUILD_TESTS)
FetchContent_Declare(
catch
URL https://github.com/catchorg/Catch2/archive/v2.13.3.zip)
FetchContent_Populate(catch)
message(STATUS "catch is available in " ${catch_SOURCE_DIR})
enable_testing()
endif()
add_subdirectory("./smaep")
if(SMAEP_BUILD_CLI_TOOL)
set(SMAEP_BUILD_JSON_SOURCE ON)
endif()
if(SMAEP_BUILD_JSON_SOURCE)
add_subdirectory("./json_source")
endif()
if(SMAEP_BUILD_CLI_TOOL)
add_subdirectory("./smaep_cli")
endif()