Merge pull request #47 from NeroBurner/strict_cmake

Let CMake be more strict
This commit is contained in:
quiniouben 2020-02-17 15:46:37 +01:00 committed by GitHub
commit e0a6eee0d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 8 deletions

View File

@ -23,9 +23,9 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
option(DISABLE_ALSA "disable Alsa support" OFF)
option(DISABLE_PULSEAUDIO "disable PulseAudio support" OFF)
option(DISABLE_JACK "disable jack support" OFF)
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)
@ -40,25 +40,29 @@ 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(NOT DISABLE_ALSA)
if(WITH_ALSA)
find_package(ALSA QUIET)
if(ALSA_FOUND)
message(STATUS "found dependency ALSA: ${ALSA_VERSION_STRING} '${ALSA_INCLUDE_DIRS}' '${ALSA_LIBRARIES}'")
set(ALSA)
else()
message(STATUS "missing ALSA dependency, disabling backend")
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(NOT DISABLE_PULSEAUDIO)
if(WITH_PULSEAUDIO)
find_package(PulseAudio QUIET)
if(PulseAudio_FOUND)
message(STATUS "found dependency PulseAudio: ${PULSEAUDIO_VERSION} '${PULSEAUDIO_INCLUDE_DIR}' '${PULSEAUDIO_LIBRARY}'")
set(PULSEAUDIO)
else()
message(STATUS "missing PulseAudio dependency, disabling backend")
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(NOT DISABLE_JACK)
if(WITH_JACK)
include(FindPkgConfig)
pkg_search_module(JACK jack QUIET)
if(JACK_FOUND)
@ -66,7 +70,10 @@ if(NOT DISABLE_JACK)
set(JACK)
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()