-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
51 lines (47 loc) · 2.23 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
cmake_minimum_required(VERSION 3.5)
project(spaceship)
# This is a Super-Project which builds Sub-Projects and manage library dependencies.
# Libraries are built first as external projects and installed at the build directory.
# Sub-Projects are built after and can relate to the pre-built external libraries in the
# build directory with find_package or find_library.
#########################################################################################
# Configuration
#########################################################################################
# Default build type to Debug, for release use `cmake -DCMAKE_BUILD_TYPE=Release ..`
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type default to Debug" FORCE)
endif()
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
#########################################################################################
# Dependencies
#########################################################################################
# Module ExternaProject for building projects in external trees.
include(ExternalProject)
# Include the external libraries in the path where cmake looks for find_package/library.
list(PREPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}/external")
# `external` directory contains all dependency libraries for the sub-projects.
add_subdirectory(external)
#########################################################################################
# Project
#########################################################################################
message(STATUS "Adding sub-project: spaceship")
# FirstGameLinux contains the source code and build for last after all dependency libs.
ExternalProject_Add(spaceship
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/spaceship
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/spaceship
BUILD_ALWAYS 1
CMAKE_ARGS
-DCMAKE_GENERATOR=${CMAKE_GENERATOR}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
DEPENDS
spdlog_external
glfw_external
glbinding_external
glm_external
stb_external
gsl_external
drlibs_external
openal_external)