forked from simulationcraft/simc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
52 lines (41 loc) · 1.48 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
# Projects Settings
cmake_minimum_required (VERSION 3.1)
# allow enabling lto from the command line
if(POLICY CMP0069)
cmake_policy(SET CMP0069 NEW)
endif()
project(simc)
# switch on/off different build targets
option(BUILD_GUI "Build the Qt gui along with cli binary" ON)
# disable various features that may be anvailable or unneeded
option(SC_NO_THREADING "Disable all dependencies on pthreads" OFF)
option(SC_NO_NETWORKING "Disable all networking related stuff." OFF)
set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO)
# enable colored output with ninja build system
if(${CMAKE_GENERATOR} STREQUAL "Ninja")
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
add_compile_options (-fdiagnostics-color=always)
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
add_compile_options (-fcolor-diagnostics)
endif()
endif()
# output a compile_commands.json used for editor tooling
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# link in all activated targets
add_subdirectory(engine)
if (BUILD_GUI)
add_subdirectory(qt)
endif()
# enable warnings
if (MSVC)
target_compile_options(engine PUBLIC /W4)
else()
target_compile_options(engine PUBLIC -Wall -Wextra)
endif()
# 'simc' command line interface target
include(source_files/cmake_engine_main.txt)
string(REGEX REPLACE "([^;]+)" "engine/\\1" source_files "${source_files}")
add_executable(simc ${source_files})
target_link_libraries(simc engine)