-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
73 lines (56 loc) · 2.43 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
66
67
68
69
70
71
72
73
cmake_minimum_required(VERSION 3.15)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "Minimum macOS version targeted by sACN on macOS")
project(sACN)
set(SACN_ROOT ${CMAKE_CURRENT_LIST_DIR})
set(SACN_INCLUDE ${CMAKE_CURRENT_LIST_DIR}/include)
set(SACN_SRC ${CMAKE_CURRENT_LIST_DIR}/src)
set(SACN_CMAKE ${CMAKE_CURRENT_LIST_DIR}/cmake)
###################### Compile Options and Configuration ######################
if(DEFINED SACN_CONFIG_LOC)
get_filename_component(SACN_CONFIG_LOC ${SACN_CONFIG_LOC}
ABSOLUTE
BASE_DIR ${CMAKE_BINARY_DIR}
)
endif()
option(SACN_BUILD_TESTS "Build the sACN unit tests" OFF)
option(SACN_ENABLE_E2E_TESTS "Enable the end-to-end sACN tests (requires SACN_BUILD_TESTS)" OFF)
option(SACN_BUILD_EXAMPLES "Build the sACN example applications" OFF)
option(SACN_BUILD_TEST_TOOLS "Build the sACN test tools (typically used in development only)" OFF)
option(SACN_INSTALL_PDBS "Include PDBs in sACN install target" ON)
####################### Dependencies & standalone support ######################
include(${SACN_CMAKE}/OssDependencyTools.cmake)
determine_compile_environment()
if(NOT COMPILING_AS_OSS)
include(${SACN_CMAKE}/AddCMakeTools.cmake)
include(${CMAKE_TOOLS_MODULES}/QualityGateHelpers.cmake)
# While the functions below already check for standalone, this check is performed to avoid the risk of unknown
# function errors during CMake generation (i.e. when the application's CMake Tools is out-of-date).
get_directory_property(IS_DEPENDENCY PARENT_DIRECTORY)
if(NOT IS_DEPENDENCY)
setup_standalone_compile()
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
add_compile_options(-Wno-deprecated-declarations) # For compatibility with all platforms
endif()
setup_clang_format(${SACN_ROOT})
setup_clang_tidy()
setup_address_sanitizer()
setup_memory_sanitizer()
setup_undefined_behavior_sanitizer()
setup_thread_sanitizer()
endif()
endif()
include(${SACN_CMAKE}/ResolveDependencies.cmake)
################################ Main libraries ###############################
# Get the local source variables
add_subdirectory(src)
#################################### Tests ####################################
if(SACN_BUILD_TESTS)
include(GoogleTest)
enable_testing()
add_subdirectory(external/fff)
add_subdirectory(tests)
endif()
################################### Examples ##################################
if(SACN_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()