-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
41 lines (33 loc) · 1.06 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
cmake_minimum_required(VERSION 3.15)
option(ACTO_BUILD_SAMPLES "Set to ON to build samples" OFF)
option(ACTO_BUILD_TESTS "Set to ON to build tests" OFF)
project(acto LANGUAGES CXX)
find_package(Threads REQUIRED)
# Determine whether this is a standalone project or
# included by other projects.
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wextra -Wshadow -Wsign-compare -Wshadow -Wwrite-strings -Wpointer-arith -Winit-self -Wconversion -Wno-sign-conversion")
endif()
set(ACTO_BUILD_SAMPLES ON)
set(ACTO_BUILD_TESTS ON)
elseif(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
# Library sources.
add_subdirectory(lib)
# Build samples.
if(ACTO_BUILD_SAMPLES)
add_subdirectory(samples)
endif()
# Build tests.
if(ACTO_BUILD_TESTS)
enable_testing()
add_subdirectory(test)
endif()