-
Notifications
You must be signed in to change notification settings - Fork 42
/
CMakeLists.txt
50 lines (37 loc) · 1.39 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
cmake_minimum_required(VERSION 3.10.0)
if (POLICY CMP0025)
cmake_policy(SET CMP0025 NEW)
endif ()
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "No build type selected, default to Release.")
set(CMAKE_BUILD_TYPE "Release")
endif()
project(openfodder VERSION 1.5.4 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${openfodder_SOURCE_DIR}/cmake)
find_package(SDL2 REQUIRED)
find_package(SDL2Mixer REQUIRED)
find_package(Threads REQUIRED)
# Locate git binary to provide information to the build environment
find_package(Git)
if(GIT_FOUND)
# Define short commit hash.
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE OPENFODDER_COMMIT_SHA1_SHORT
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
else()
# Fallback in case the git exe can't be found.
set(OPENFODDER_COMMIT_SHA1_SHORT "deadbeef")
endif()
configure_file(cmake/gitver.hpp.in Source/gitver.hpp @ONLY)
file(GLOB_RECURSE GAMEENGINE_HEADERS "Source/*.hpp")
file(GLOB_RECURSE GAMEENGINE_SOURCE "Source/*.cpp")
add_executable(openfodder ${GAMEENGINE_SOURCE} ${GAMEENGINE_HEADERS})
target_include_directories(openfodder PRIVATE
Source
${CMAKE_CURRENT_BINARY_DIR}/Source)
target_link_libraries(openfodder SDL2::SDL2 SDL2_mixer::SDL2_mixer Threads::Threads)