-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
59 lines (44 loc) · 1.99 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
cmake_minimum_required(VERSION 3.13)
################################################################################
## PROJECT
## name and version
################################################################################
project(UdpSocket 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
## 3rd-party submodules configuration
################################################################################
SET(${PARENT}_UDP_SOCKET ON CACHE BOOL "" ${REWRITE_FORCE})
if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
SET(${PARENT}_UDP_SOCKET_EXAMPLES OFF CACHE BOOL "" ${REWRITE_FORCE})
message("${PROJECT_NAME} included as subrepository")
else()
SET(${PARENT}_UDP_SOCKET_EXAMPLES ON CACHE BOOL "" ${REWRITE_FORCE})
message("${PROJECT_NAME} is stand alone repository")
endif()
################################################################################
## INCLUDING SUBDIRECTORIES
## Adding subdirectories according to the 3rd-party configuration
################################################################################
if (${PARENT}_UDP_SOCKET)
add_subdirectory(src)
endif()
if (${PARENT}_UDP_SOCKET_EXAMPLES)
add_subdirectory(examples)
endif()