forked from HendrikBrueckler/QGP3D
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
57 lines (45 loc) · 1.81 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
cmake_minimum_required(VERSION 3.10)
project(QGP3D VERSION 1.0)
### Default to C++11, CLI and tests need C++17, however
set (CMAKE_CXX_STANDARD 17)
### Require out-of-source builds
file(TO_CMAKE_PATH "${PROJECT_BINARY_DIR}/CMakeLists.txt" LOC_PATH)
if(EXISTS "${LOC_PATH}")
message(FATAL_ERROR "You cannot build this in a source directory (or any directory with a CMakeLists.txt file). "
"Please make a build subdirectory. Feel free to remove CMakeCache.txt and CMakeFiles.")
endif()
### Build type
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE "Release" CACHE
STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "RelWithDebInfo")
endif()
### Cmake package finder files
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(macrOS)
if(${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
set(QGP3D_STANDALONE TRUE)
else()
set(QGP3D_STANDALONE FALSE)
endif()
# ### Binary output
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Build/lib/)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Build/lib/)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Build/bin/)
### Options
option(QGP3D_ENABLE_LOGGING "Enable logging for QGP3D" ${QGP3D_STANDALONE})
option(QGP3D_BUILD_CLI "Build CLI app for QGP3D" ${QGP3D_STANDALONE})
option(QGP3D_SUBMODULES_MANUAL "Skip automatic submodule download" OFF)
set(QGP3D_SUBMODULES_MANUAL ON)
### Load external libs
add_subdirectory(extern)
### Add library
set(QGP3D_LIB_NAME qgp3d)
add_subdirectory(src)
### Add CLI
if (QGP3D_BUILD_CLI)
add_subdirectory(cli)
endif()