Let CMake be more strict
replace the DISABLE_XXX flags with WITH_XXX flags - DISABLE_ALSA -> WITH_ALSA - DISABLE_PULSEAUDIO -> WITH_PULSEAUDIO - DISABLE_JACK -> WITH_JACK Default the DISABLE_XXX flags to true. If one of the dependencies of an enabled dependency is missing exit with error. Fixes: https://github.com/quiniouben/vban/issues/45
This commit is contained in:
parent
64b35b4a18
commit
4b32f65268
|
@ -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()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue