-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
65 lines (50 loc) · 2.2 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
61
62
63
64
65
cmake_minimum_required(VERSION 3.13)
################################################################################
## PROJECT
## name and version
################################################################################
project(Lens LANGUAGES CXX)
################################################################################
## SETTINGS
## basic project settings before use
################################################################################
# If this project is used as a submodule, the variable should be overridden
# to "OFF" in the top-level application (to disable forced cache rewriting)
option(${PARENT}_SUBMODULE_CACHE_OVERWRITE "Enable forced cache rewriting" ON)
if (${PARENT}_SUBMODULE_CACHE_OVERWRITE)
SET(REWRITE_FORCE "FORCE")
else()
SET(REWRITE_FORCE "")
endif()
# Set default Release mode if not specified
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type defaulting to Release" FORCE)
endif()
################################################################################
## CONFIGURATION
## project configuration
################################################################################
SET(${PARENT}_LENS ON CACHE BOOL "" ${REWRITE_FORCE})
if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
SET(${PARENT}_LENS_TEST OFF CACHE BOOL "" ${REWRITE_FORCE})
SET(${PARENT}_LENS_EXAMPLE OFF CACHE BOOL "" ${REWRITE_FORCE})
message("${PROJECT_NAME} included as subrepository.")
else()
SET(${PARENT}_LENS_TEST ON CACHE BOOL "" ${REWRITE_FORCE})
SET(${PARENT}_LENS_EXAMPLE ON CACHE BOOL "" ${REWRITE_FORCE})
message("${PROJECT_NAME} is a standalone project.")
endif()
################################################################################
## INCLUDING SUBDIRECTORIES
## Adding subdirectories according to the project configuration
################################################################################
if (${PARENT}_LENS)
add_subdirectory(3rdparty)
add_subdirectory(src)
endif()
if (${PARENT}_LENS_TEST)
add_subdirectory(test)
endif()
if (${PARENT}_LENS_EXAMPLE)
add_subdirectory(example)
endif()