-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
64 lines (56 loc) · 1.89 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
# ---------------------------------------------------------------------------
#
# 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)
project(coroutine LANGUAGES CXX VERSION 1.4.2)
# import cmake code snippets. see `cmake/`
list(APPEND CMAKE_MODULE_PATH
${PROJECT_SOURCE_DIR}/cmake
)
include(test-target-platform)
include(test-cxx-coroutine)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
include(display-build-info)
# GSL(Guideline Support Library) configuration
if(${CMAKE_TOOLCHAIN_FILE} MATCHES vcpkg.cmake)
# portfile in vcpkg must give the path
else()
# try find_package first
find_package(GSL)
if(NOT GSL_FOUND)
# last chance. use submodule
add_subdirectory(external/guideline)
endif()
get_target_property(GSL_INCLUDE_DIR GSL INTERFACE_INCLUDE_DIRECTORIES)
endif()
# ensure the path is defined
if(NOT DEFINED GSL_INCLUDE_DIR)
message(FATAL_ERROR "Path - GSL_INCLUDE_DIR is required")
endif()
add_subdirectory(modules)
# build test project?
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()
add_subdirectory(test)
add_dependencies(coroutine_test coroutine)