-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
54 lines (36 loc) · 1.11 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
# --- ECS Project
cmake_minimum_required(VERSION 3.8)
project(ECS CXX)
# --- C++17 Standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# --- Include Directories
include_directories("include")
# --- Source Files
file(GLOB_RECURSE ECS_SOURCES "src/*.cpp")
add_library(ECS STATIC ${ECS_SOURCES})
# --- Compiler Options
if (MSVC)
add_compile_options("/W4" "/MP")
if (DEFINED ENV{TRAVIS})
target_compile_options(ECS PRIVATE "/WX")
endif()
else()
add_compile_options("-Wall" "-Wextra")
if (DEFINED ENV{TRAVIS})
target_compile_options(ECS PRIVATE "-Werror")
endif()
endif()
# --- Install Directories
install(TARGETS ECS DESTINATION "lib")
install(DIRECTORY "include/" DESTINATION "include")
# --- Unit Tests
option(WITH_UNIT_TESTS "If set, the unit tests will be built." OFF)
if (WITH_UNIT_TESTS)
message(STATUS "Building WITH unit tests.")
enable_testing()
add_subdirectory("tests")
else()
message(STATUS "Building WITHOUT unit tests. Re-run CMake with the option -DWITH_UNIT_TESTS=1 to enable them.")
endif()