-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
62 lines (51 loc) · 1.79 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
# Copyright 2020 Antony Kellermann
cmake_minimum_required(VERSION 3.16)
project(iex
VERSION 1.0.0
LANGUAGES CXX
DESCRIPTION "C++17 library for querying IEX Cloud REST API."
)
message(STATUS "${PROJECT_NAME} version: ${PROJECT_VERSION}")
# Options
option(IEX_BUILD_LIBRARY "Build iex library." ON)
option(IEX_BUILD_WARNINGS "Build with compiler warnings." OFF)
option(IEX_BUILD_TESTS "Build unit tests." OFF)
option(IEX_BUILD_STRESS_TESTS "Build stress unit tests." OFF)
option(IEX_BUILD_DOCUMENTATION "Build Doxygen documentation." OFF)
option(IEX_TIDY "Run static analyzer." OFF)
option(BUILD_SHARED_LIBS "Build shared library instead of static." ON)
if (IEX_BUILD_TESTING AND NOT IEX_BUILD_LIBRARY)
set(IEX_BUILD_LIBRARY ON)
endif ()
# At least C++17
if (NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
endif ()
# Set a default build type if none was specified
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(default_build_type "Release")
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif ()
# clang-tidy
if (IEX_TIDY)
set(CMAKE_CXX_CLANG_TIDY "clang-tidy")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
endif ()
include(GNUInstallDirs)
if (IEX_BUILD_LIBRARY)
set(IEX_LIBRARY ${PROJECT_NAME})
add_subdirectory(include)
add_subdirectory(lib)
endif ()
if (IEX_BUILD_TESTS)
add_subdirectory(tests)
endif ()
if (IEX_BUILD_DOCUMENTATION)
add_subdirectory(doc)
endif ()