-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
55 lines (43 loc) · 1.66 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
cmake_minimum_required(VERSION 3.14)
project(unleash VERSION 1.0.0)
# C++ language configuration boilerplate
if(NOT DEFINED CMAKE_CXX_VISIBILITY_PRESET AND NOT DEFINED
CMAKE_VISIBILITY_INLINES_HIDDEN)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)
endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE
"Release"
CACHE STRING "Choose the type of build, options are: Debug Release
RelWithDebInfo MinSizeRel." FORCE)
endif(NOT CMAKE_BUILD_TYPE)
option(ENABLE_TESTING "Enable Test Builds" ON)
option(ENABLE_TEST_COVERAGE "Enable Test Coverage" OFF)
find_package(cpr)
find_package(nlohmann_json)
# Let unleash_SHARED_LIBS override BUILD_SHARED_LIBS
if(DEFINED unleash_SHARED_LIBS)
set(BUILD_SHARED_LIBS "${unleash_SHARED_LIBS}")
endif()
# Create the main unleash library target
add_subdirectory(src)
if(ENABLE_TESTING)
enable_testing()
add_subdirectory(test)
endif()
# Generate the export header for unleash and attach it to the target
include(GenerateExportHeader)
generate_export_header(unleash EXPORT_FILE_NAME include/unleash/export.h)
target_compile_definitions(
unleash PUBLIC "$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:unleash_STATIC_DEFINE>")
target_include_directories(
unleash PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>")
# Include the install rules if the user wanted them (included by default when
# top-level)
string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}"
is_top_level)
option(unleash_INCLUDE_PACKAGING "Include packaging rules for unleash" ON)
if(unleash_INCLUDE_PACKAGING)
add_subdirectory(packaging)
endif()