-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
60 lines (48 loc) · 1.57 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
cmake_minimum_required(VERSION 3.10)
if (POLICY CMP0074)
cmake_policy(SET CMP0074 NEW) # Enable CMake search paths defined by NasNas_ROOT variable
endif()
if (POLICY CMP0077)
cmake_policy(SET CMP0077 NEW) # NasNas options will not override user defined variable if they exist
endif()
project(
NasNas
VERSION 0.2.0
DESCRIPTION "An intuitive and beginner friendly 2D game framework"
LANGUAGES CXX
HOMEPAGE_URL "https://github.com/Madour/NasNas"
)
# NasNas modules names
set(NASNAS_OPTIONAL_MODULES "ECS;RESLIB;TILEMAPPING;TWEEN;UI")
set(NASNAS_MODULES "CORE;${NASNAS_OPTIONAL_MODULES}")
# Select optional modules
foreach(module ${NASNAS_OPTIONAL_MODULES})
option(NASNAS_BUILD_${module} "Build the ${module} module" ON)
endforeach()
# Select optional targets
option(NASNAS_EXAMPLES "Build the example applications" OFF)
option(NASNAS_BUILD_SFML "Download and build SFML as a subproject" OFF)
if (MSVC)
option(NASNAS_STATIC_VCRT "Use /MT option instead of /MD for static VC runtimes" OFF)
endif()
include(cmake/NasNasUtils.cmake)
check_compiler()
# find SFML or download it if not found
find_SFML()
# add NasNas subdirectory
add_subdirectory(${PROJECT_SOURCE_DIR}/src/NasNas)
if (NASNAS_EXAMPLES)
# add examples subdirectory
add_subdirectory(examples)
endif()
# print available targets
log_targets(ARCHIVE)
log_targets(LIBRARY)
log_targets(RUNTIME)
log_targets(EXECUTABLE)
if (NASNAS_EXAMPLES)
log_status("Custom targets available :")
log_list_item("NasNas_examples")
endif()
# export and install targets
NasNas_export_install()