From 2314b57bceb72d22246a491a3b3e787121706236 Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Sat, 12 Nov 2016 17:25:44 +0100 Subject: [PATCH] fix(cmake): Default module flags based on libs --- cmake/build/options.cmake | 55 +++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/cmake/build/options.cmake b/cmake/build/options.cmake index eee16e2f..3fb9a1e8 100644 --- a/cmake/build/options.cmake +++ b/cmake/build/options.cmake @@ -2,6 +2,41 @@ # Build options # +# Default value for: ENABLE_ALSA {{{ + +find_package(ALSA QUIET) +if(NOT DEFINED ENABLE_ALSA AND NOT ALSA_FOUND) + set(ENABLE_ALSA OFF CACHE STRING "Module support for alsa-lib") +endif() + +# }}} +# Default value for: ENABLE_NETWORK {{{ + +find_package(Libiw QUIET) +if(NOT DEFINED ENABLE_NETWORK AND NOT LIBIW_FOUND) + set(ENABLE_NETWORK OFF CACHE STRING "Module support for wireless_tools") +endif() + +# }}} +# Default value for: ENABLE_MPD {{{ + +find_package(LibMPDClient QUIET) +if(NOT DEFINED ENABLE_MPD AND NOT LIBMPDCLIENT_FOUND) + set(ENABLE_MPD OFF CACHE STRING "Module support for libmpdclient") +endif() + +# }}} +# Default value for: ENABLE_I3 {{{ + +find_program(I3_BINARY i3) +if(NOT DEFINED ENABLE_I3 AND NOT I3_BINARY) + set(ENABLE_I3 OFF CACHE STRING "Module support for i3wm") +endif() + +# }}} + +# Define build options {{{ + option(CXXLIB_CLANG "Link against libc++" OFF) option(CXXLIB_GCC "Link against stdlibc++" OFF) @@ -19,6 +54,9 @@ option(ENABLE_RANDR_EXT "Enable RandR X extension" ON) option(ENABLE_RENDER_EXT "Enable Render X extension" OFF) option(ENABLE_DAMAGE_EXT "Enable Damage X extension" OFF) +# }}} +# Set cache vars {{{ + set(SETTING_ALSA_SOUNDCARD "default" CACHE STRING "Name of the ALSA soundcard driver") set(SETTING_CONNECTION_TEST_IP "8.8.8.8" @@ -42,19 +80,4 @@ set(SETTING_PATH_MEMORY_INFO "/proc/meminfo" set(SETTING_PATH_TEMPERATURE_INFO "/sys/class/thermal/thermal_zone%zone%/temp" CACHE STRING "Path to file containing the current temperature") -find_package(ALSA QUIET) -if(NOT ALSA_FOUND) - set(ENABLE_ALSA OFF) -endif() -find_package(Libiw QUIET) -if(NOT LIBIW_FOUND) - set(ENABLE_NETWORK OFF) -endif() -find_package(LibMPDClient QUIET) -if(NOT LIBMPDCLIENT_FOUND) - set(ENABLE_MPD OFF) -endif() -find_program(I3_BINARY i3) -if(NOT I3_BINARY) - set(ENABLE_I3 OFF) -endif() +# }}}