-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
92 lines (74 loc) · 2.03 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
cmake_minimum_required(VERSION 3.8)
project(wolfram_r184)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
####################
# Source files
####################
set(HEADER_FILES
src/CellularAutomaton.hpp
src/Grid.hpp
src/InputController.hpp
src/TransitionLookupTable.hpp
)
set(SOURCE_FILES
src/CellularAutomaton.cpp
src/Grid.cpp
src/InputController.cpp
src/main.cpp
)
# OS specific source code
if(WIN32)
set(PLATFORM_SOURCES
src/platform/win/OutputColorizer.cpp
)
else()
set(PLATFORM_SOURCES
src/platform/other/OutputColorizer.cpp
)
endif()
# Source file grouping for Visual Studio
source_group("Header Files" FILES ${HEADER_FILES})
source_group("Source Files" FILES ${SOURCE_FILES})
source_group("Platform Source Files" FILES ${PLATFORM_SOURCES})
# Add all source files to executable
# Note: Headers are not mandatory for building here.
# They are added in order to make them visible within the VS Solution Explorer.
add_executable(${PROJECT_NAME}
${HEADER_FILES}
${SOURCE_FILES}
${PLATFORM_SOURCES}
)
####################
# Build type
####################
# Set a default build type to 'RelWithDebInfo' if none was specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message("Setting build type to 'RelWithDebInfo' as none was specified.")
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
# Set possible values for cmake-gui and ccmake
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
####################
# Compiler config
####################
# Set C++ standard
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# Compiler specific flags
if(MSVC)
set(COMPILER_FLAGS /W4)
else()
set(COMPILER_FLAGS -Wall -Wextra -Wpedantic)
endif()
target_include_directories(${PROJECT_NAME}
PRIVATE ${PROJECT_SOURCE_DIR}/src
)
target_compile_options(${PROJECT_NAME}
PRIVATE ${COMPILER_FLAGS}
)
####################
# Install settings
####################
install (TARGETS ${PROJECT_NAME}
DESTINATION bin
)