-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
executable file
·52 lines (42 loc) · 1.34 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
cmake_minimum_required(VERSION 3.5)
# Options
cmake_policy(SET CMP0077 NEW)
option(BUILD_EXAMPLES "Build Examples" ON)
option(PURE_CPP "Pure C++" OFF)
# Project
project(pneatm)
# Sources
file(GLOB_RECURSE SOURCES src/*.cpp)
# Add the library
add_library(${PROJECT_NAME} STATIC ${SOURCES})
# Includes
target_include_directories(pneatm PUBLIC include)
# Flags
if (PURE_CPP)
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/W4 /WX>
$<$<CXX_COMPILER_ID:AppleClang>:-std=c++11>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-DPURE_CPP -O3 -Wall -Wextra -Werror -Wundef -Wcast-align -Wwrite-strings -Wunreachable-code -Wconversion -Wpedantic>
)
else()
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/W4 /WX>
$<$<CXX_COMPILER_ID:AppleClang>:-std=c++11>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-O3 -Wall -Wextra -Werror -Wundef -Wcast-align -Wwrite-strings -Wunreachable-code -Wconversion -Wpedantic>
)
endif()
if (NOT PURE_CPP)
message(STATUS "Building with additional libraries (spdlog, SFML)")
# Add Libraries
find_package(spdlog REQUIRED)
find_package(SFML COMPONENTS window system graphics REQUIRED)
# Link Libraries
target_link_libraries(${PROJECT_NAME}
PUBLIC spdlog::spdlog
PRIVATE sfml-window sfml-system sfml-graphics
)
endif()
if(BUILD_EXAMPLES)
# SnakePNEATM
add_subdirectory(examples/snake)
endif()