-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
53 lines (41 loc) · 1.52 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
#Change this if you need to target a specific CMake version
cmake_minimum_required(VERSION 3.3)
# Set cmake flags
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wall -pedantic -Wno-reorder")
# Enable debug symbols by default
# must be done before project() statement
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build (Debug or Release)" FORCE)
endif ()
# (you can also set it on the command line: -D CMAKE_BUILD_TYPE=Release)
# Name of project
project(legend_of_the_swamp)
# Define sources and executable
set(EXECUTABLE_NAME "legend_of_the_swamp")
file(GLOB LEGEND_OF_THE_SWAMP_SRC
"src/include/*.h"
"src/*.cpp")
file(GLOB LIB_SRC
"lib/EasyBMP/*.h"
"lib/EasyBMP/*.cpp")
add_executable(${EXECUTABLE_NAME} ${LEGEND_OF_THE_SWAMP_SRC} ${LIB_SRC})
# Detect and add SFML
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules" ${CMAKE_MODULE_PATH})
#Find any version 2.X of SFML
#See the FindSFML.cmake file for additional details and instructions
if (WIN32)
find_package(SFML 2 REQUIRED system window graphics audio main)
else ()
find_package(SFML 2 REQUIRED system window graphics audio)
endif ()
if (SFML_FOUND)
include_directories(${SFML_INCLUDE_DIR})
target_link_libraries(${EXECUTABLE_NAME} ${SFML_LIBRARIES})
endif ()
# Install target
install(TARGETS ${EXECUTABLE_NAME} DESTINATION bin)
# CPack packaging
include(InstallRequiredSystemLibraries)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
include(CPack)