Skip to content

Commit

Permalink
Applets: use CMakeDependentOption
Browse files Browse the repository at this point in the history
  • Loading branch information
rilian-la-te committed Mar 11, 2018
1 parent 0efe77d commit 0abec76
Showing 1 changed file with 14 additions and 36 deletions.
50 changes: 14 additions & 36 deletions applets/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,60 +1,38 @@
option(ENABLE_ALSA "Enable volume applet" ON)
include(CMakeDependentOption)
#Volume
pkg_check_modules(ALSA alsa IMPORTED_TARGET)
pkg_check_modules(CANBERRA libcanberra IMPORTED_TARGET)
cmake_dependent_option(ENABLE_ALSA "Enable volume applet" ON "ALSA_FOUND" OFF)
cmake_dependent_option(ENABLE_LIBCANBERRA "Volume: enable beep" ON "CANBERRA_FOUND;ALSA_FOUND" OFF)

if (ENABLE_ALSA)
pkg_check_modules(ALSA alsa IMPORTED_TARGET)
if (NOT(ALSA_FOUND))
set(ENABLE_ALSA OFF)
endif()
endif()

if (ENABLE_ALSA)
pkg_check_modules(CANBERRA libcanberra IMPORTED_TARGET)
if (CANBERRA_FOUND)
if (ENABLE_LIBCANBERRA)
set(CANBERRA_DEFINE -D CANBERRA)
set(CANBERRA_PACKAGE "libcanberra")
endif()
add_subdirectory(volume)
endif()

option(ENABLE_BATTERY "Enable battery applet" ON)

if (ENABLE_BATTERY)
add_subdirectory(batt)
endif()

option(ENABLE_WEATHER "Enable weather applet" ON)
if (ENABLE_WEATHER)
pkg_check_modules(GWEATHER gweather-3.0 IMPORTED_TARGET)
if (NOT(GWEATHER_FOUND))
set(ENABLE_WEATHER OFF)
endif()
endif()

pkg_check_modules(GWEATHER gweather-3.0 IMPORTED_TARGET)
cmake_dependent_option(ENABLE_WEATHER "Enable weather applet" ON "GWEATHER_FOUND" OFF)
if (ENABLE_WEATHER)
add_subdirectory(weather)
endif()

option(ENABLE_XKB "Enable xkb applet" ON)
if (ENABLE_XKB)
pkg_check_modules(XKB xkbcommon IMPORTED_TARGET)
pkg_check_modules(X11 xcb-xkb xkbcommon-x11 x11-xcb gdk-x11-3.0 IMPORTED_TARGET)
if (NOT(XKB_FOUND) OR NOT(X11_FOUND))
set(ENABLE_XKB OFF)
endif()
endif()

pkg_check_modules(XKB xkbcommon IMPORTED_TARGET)
pkg_check_modules(X11 xcb-xkb xkbcommon-x11 x11-xcb gdk-x11-3.0 IMPORTED_TARGET)
cmake_dependent_option(ENABLE_XKB "Enable xkb applet" ON "XKB_FOUND;X11_FOUND" OFF)
if (ENABLE_XKB)
add_subdirectory(xkb)
endif()

option(ENABLE_LIBGTOP "Enable netload applet" ON)
if (ENABLE_LIBGTOP)
pkg_check_modules(LIBGTOP libgtop-2.0 IMPORTED_TARGET)
if (NOT(LIBGTOP_FOUND))
set(ENABLE_LIBGTOP OFF)
endif()
endif()

pkg_check_modules(LIBGTOP libgtop-2.0 IMPORTED_TARGET)
cmake_dependent_option(ENABLE_LIBGTOP "Enable netload applet" ON "LIBGTOP_FOUND" OFF)
if (ENABLE_LIBGTOP)
add_subdirectory(gtop)
endif()

0 comments on commit 0abec76

Please sign in to comment.