-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathCMakeLists.txt
78 lines (69 loc) · 2.96 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
cmake_minimum_required(VERSION 3.5..3.10)
project(vban C)
message(STATUS "CMake version ${CMAKE_VERSION}")
# https://cmake.org/cmake/help/latest/prop_tgt/C_STANDARD.html
string(COMPARE EQUAL "${CMAKE_C_STANDARD}" "" no_cmake_c_standard_set)
if(no_cmake_c_standard_set)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
message(STATUS "Using default C standard ${CMAKE_C_STANDARD}")
else()
message(STATUS "Using user specified C standard ${CMAKE_C_STANDARD}")
endif()
set(default_build_type "Release")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" 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" "MinSizeRel" "RelWithDebInfo")
endif()
option(WITH_ALSA "Build vban with ALSA support" ON)
option(WITH_PULSEAUDIO "Build vban with PulseAudio support" ON)
option(WITH_JACK "Build vban with JACK support" ON)
#set(CMAKE_VERBOSE_MAKEFILE ON)
# add macro define 'DEBUG' to debug build
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
# enable various compiler warnings
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wextra -pedantic") # more warnings
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wsign-compare")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wshadow")
# disable specific compiler warnings
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-multichar") # also disables other unused warnings
if(WITH_ALSA)
find_package(ALSA QUIET)
if(ALSA_FOUND)
message(STATUS "found dependency ALSA: ${ALSA_VERSION_STRING} '${ALSA_INCLUDE_DIRS}' '${ALSA_LIBRARIES}'")
else()
message(FATAL_ERROR "missing ALSA dependency. If you want to disable backend set WITH_ALSA=No")
endif()
else()
message(STATUS "building without ALSA backend")
endif()
if(WITH_PULSEAUDIO)
find_package(PulseAudio QUIET)
if(PulseAudio_FOUND)
message(STATUS "found dependency PulseAudio: ${PULSEAUDIO_VERSION} '${PULSEAUDIO_INCLUDE_DIR}' '${PULSEAUDIO_LIBRARY}'")
else()
message(FATAL_ERROR "missing PulseAudio dependency. If you want to disable backend set WITH_PULSEAUDIO=No")
endif()
else()
message(STATUS "building without PulseAudio backend")
endif()
if(WITH_JACK)
include(FindPkgConfig)
pkg_search_module(JACK jack QUIET)
if(JACK_FOUND)
message(STATUS "found dependency JACK: ${JACK_VERSION} '${JACK_INCLUDEDIR}' '${JACK_LIBRARIES}'")
else()
message(STATUS "missing JACK dependency, disabling backend")
message(FATAL_ERROR "missing JACK dependency. If you want to disable backend set WITH_JACK=No")
endif()
else()
message(STATUS "building without JACK backend")
endif()
# We want to compile source in src, so let's go there
add_subdirectory(src)