forked from luncliff/coroutine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
71 lines (62 loc) · 2.19 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
# ---------------------------------------------------------------------------
#
# Author : github.com/luncliff ([email protected])
# Note
# CMake support for project with LLVM toolchain
# GCC will be added ASAP when it supports coroutine
#
# Support
# - MSVC + Windows (Visual Studio)
# - Clang + Windows (Ninja)
# - Clang + MacOS (Unix Makefiles)
# - Clang + Linux (Unix Makefiles. WSL, Ubuntu 1604 and later)
#
# ---------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.8) # c++ 17
project(coroutine LANGUAGES CXX VERSION 1.4.2)
# import cmake code snippets. see `cmake/`
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include(check-target-platform)
include(check-compiler)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
include(report-project-info)
# Dependency configuration
if(${CMAKE_TOOLCHAIN_FILE} MATCHES vcpkg.cmake)
# portfile in vcpkg must give the path
set(GSL_INCLUDE_DIR ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include)
else()
# use submodule
add_subdirectory(external/guideline)
set(GSL_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/guideline/include)
endif()
# ensure the path is defined
if(NOT DEFINED GSL_INCLUDE_DIR)
message(FATAL_ERROR "Path - GSL_INCLUDE_DIR is required")
else()
message(STATUS "GSL (C++ Core Guideline Support Library)")
message(STATUS " Path \t: ${GSL_INCLUDE_DIR}")
endif()
# Project modules
add_subdirectory(modules)
# Test projects
if(TEST_DISABLED)
message(STATUS "Test is disabled.")
return()
elseif(IOS OR ANDROID)
message(STATUS "Mobile cross build doesn't support tests")
return()
elseif(NOT ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
message(STATUS "This is not a root project. Skip tests")
return()
endif()
# if package does not exist, use submodule instead
find_package(Catch2)
if(NOT Catch2_FOUND)
add_subdirectory(${PROJECT_SOURCE_DIR}/external/catch2
${CMAKE_BINARY_DIR}/catch2
)
endif()
add_subdirectory(test)
add_dependencies(coroutine_test coroutine)