forked from DeveloperPaul123/eventbus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
46 lines (34 loc) · 1.26 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
cmake_minimum_required(VERSION 3.14)
project(eventbus)
set(CXX_STANDARD 17)
set(CXX_STANDARD_REQUIRED ON)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
option(EVENTBUS_BUILD_TESTS "Build unit tests." ON)
include(CompilerWarnings)
add_library(project_warnings INTERFACE)
set_project_warnings(project_warnings)
add_library(project_options INTERFACE)
target_compile_features(project_options INTERFACE cxx_std_17)
if(EVENTBUS_BUILD_TESTS)
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM.cmake")
set(CPM_VERSION 0.27.3)
if(NOT EXISTS ${CPM_DOWNLOAD_LOCATION})
message(STATUS "Downloading CPM.cmake")
file(DOWNLOAD https://raw.githubusercontent.com/TheLartians/CPM/v${CPM_VERSION}/cmake/CPM.cmake ${CPM_DOWNLOAD_LOCATION})
endif(NOT EXISTS ${CPM_DOWNLOAD_LOCATION})
include(${CPM_DOWNLOAD_LOCATION})
CPMAddPackage(
NAME googletest
GITHUB_REPOSITORY google/googletest
GIT_TAG release-1.8.1
VERSION 1.8.1
OPTIONS
"INSTALL_GTEST OFF"
"gtest_force_shared_crt ON"
)
# this needs to be in the top level directory
# before any calls to `add_subdirectory()` for
# ctest to be set up properly
enable_testing()
endif()
add_subdirectory(eventbus)