forked from ETCLabs/RDMnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
98 lines (77 loc) · 3.03 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
cmake_minimum_required(VERSION 3.10)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "Minimum macOS version targeted by RDMnet on macOS")
project(RDMnet VERSION 0.4.0)
# Sometimes the seems to be some weirdness with drive letter capitalization on Windows, so do a
# case-insensitive comparision
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL Windows)
string(TOLOWER ${PROJECT_SOURCE_DIR} PROJECT_SOURCE_DIR_LC)
string(TOLOWER ${CMAKE_SOURCE_DIR} CMAKE_SOURCE_DIR_LC)
else()
set(PROJECT_SOURCE_DIR_LC ${PROJECT_SOURCE_DIR})
set(CMAKE_SOURCE_DIR_LC ${CMAKE_SOURCE_DIR})
endif()
if(PROJECT_SOURCE_DIR_LC STREQUAL CMAKE_SOURCE_DIR_LC)
set(BUILDING_RDMNET_STANDALONE TRUE)
if (MSVC)
add_compile_options(/W4 /permissive-)
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_options(-Wall)
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
add_compile_options(-Wno-sign-conversion)
else()
add_compile_options(-Wno-sign-compare)
endif()
endif()
# Allow folder grouping in generated IDE projects
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Add a target to run Clang Format
file(GLOB_RECURSE FILES_TO_REFORMAT
examples/*.c
examples/*.cpp
examples/*.h
include/*.h
src/*.c
src/*.cpp
src/*.h
tests/*.c
tests/*.cpp
tests/*.h
)
add_custom_target(reformat_all COMMAND clang-format -i ${FILES_TO_REFORMAT})
set_target_properties(reformat_all PROPERTIES FOLDER tools)
endif()
set(RDMNET_ROOT ${CMAKE_CURRENT_LIST_DIR})
set(RDMNET_INCLUDE ${CMAKE_CURRENT_LIST_DIR}/include)
set(RDMNET_SRC ${CMAKE_CURRENT_LIST_DIR}/src)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
option(RDMNET_BUILD_TESTS "Build the RDMnet unit tests" OFF)
option(RDMNET_BUILD_GUI_EXAMPLES "Build the RDMnet GUI example applications" OFF)
option(RDMNET_BUILD_CONSOLE_EXAMPLES "Build the RDMnet console example applications" OFF)
option(RDMNET_BUILD_TEST_TOOLS "Build the RDMnet test tools (typically used in development only)" OFF)
option(RDMNET_INSTALL_PDBS "Include PDBs in RDMnet install target" ON)
if(RDMNET_BUILD_TESTS)
add_subdirectory(external/fff)
endif()
################################ DNS-SD SUPPORT ###############################
include(ResolveDnsSdProvider)
################################ Main libraries ###############################
add_subdirectory(src)
#################################### Tests ####################################
if(RDMNET_BUILD_TESTS)
enable_testing()
include(AddGoogleTest)
add_subdirectory(tests)
endif()
################################### Examples ##################################
if(RDMNET_BUILD_GUI_EXAMPLES OR RDMNET_BUILD_CONSOLE_EXAMPLES)
add_subdirectory(examples)
endif()
##################################### Misc ####################################
if(RDMNET_BUILD_TEST_TOOLS)
add_subdirectory(tools/test)
endif()
# On Windows, we put the DLL in the install directory to later be packaged with
# the installer.
if(DEFINED DNS_SD_DLL)
install(FILES ${DNS_SD_DLL} DESTINATION bin)
endif()