cmake: Use lists

This commit is contained in:
patrick96 2020-12-24 01:40:26 +01:00 committed by Patrick Ziegler
parent 3c51a1d955
commit 17f4dfd342
2 changed files with 13 additions and 11 deletions

View File

@ -22,8 +22,7 @@ else()
set(APP_VERSION "${version_txt}") set(APP_VERSION "${version_txt}")
endif() endif()
set(CMAKE_MODULE_PATH list(APPEND CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
${PROJECT_SOURCE_DIR}/cmake ${PROJECT_SOURCE_DIR}/cmake
${PROJECT_SOURCE_DIR}/cmake/common ${PROJECT_SOURCE_DIR}/cmake/common
${PROJECT_SOURCE_DIR}/cmake/modules) ${PROJECT_SOURCE_DIR}/cmake/modules)

View File

@ -2,9 +2,9 @@
# Generate configuration file # Generate configuration file
# #
set(MODULES_LEFT "bspwm i3") set(MODULES_LEFT "bspwm;i3")
set(MODULES_CENTER "mpd") set(MODULES_CENTER "mpd")
set(MODULES_RIGHT "filesystem backlight-acpi alsa pulseaudio xkeyboard memory cpu wlan eth battery temperature date powermenu") set(MODULES_RIGHT "filesystem;backlight-acpi;alsa;pulseaudio;xkeyboard;memory;cpu;wlan;eth;battery;temperature;date;powermenu")
set(FONT_FIXED "fixed:pixelsize=10") set(FONT_FIXED "fixed:pixelsize=10")
set(FONT_UNIFONT "unifont:fontformat=truetype") set(FONT_UNIFONT "unifont:fontformat=truetype")
@ -17,24 +17,28 @@ queryfont(FONT_SIJI ${FONT_SIJI} FIELDS family pixelsize)
# Strip disabled modules {{{ # Strip disabled modules {{{
if(NOT ENABLE_PULSEAUDIO) if(NOT ENABLE_PULSEAUDIO)
string(REPLACE " pulseaudio" "" MODULES_RIGHT ${MODULES_RIGHT}) list(REMOVE_ITEM MODULES_RIGHT "pulseaudio")
endif() endif()
if(NOT ENABLE_ALSA) if(NOT ENABLE_ALSA)
string(REPLACE " alsa" "" MODULES_RIGHT ${MODULES_RIGHT}) list(REMOVE_ITEM MODULES_RIGHT "alsa")
endif() endif()
if(NOT ENABLE_I3) if(NOT ENABLE_I3)
string(REPLACE " i3" "" MODULES_LEFT ${MODULES_LEFT}) list(REMOVE_ITEM MODULES_LEFT "i3")
endif() endif()
if(NOT ENABLE_MPD) if(NOT ENABLE_MPD)
string(REPLACE "mpd" "" MODULES_CENTER ${MODULES_CENTER}) list(REMOVE_ITEM MODULES_CENTER "mpd")
endif() endif()
if(NOT ENABLE_NETWORK) if(NOT ENABLE_NETWORK)
string(REPLACE " wlan eth" "" MODULES_RIGHT ${MODULES_RIGHT}) list(REMOVE_ITEM MODULES_RIGHT "wlan" "eth")
endif() endif()
if(NOT WITH_XKB) if(NOT WITH_XKB)
string(REPLACE "xkeyboard " "" MODULES_RIGHT ${MODULES_RIGHT}) list(REMOVE_ITEM MODULES_RIGHT "xkeyboard")
endif() endif()
string(REPLACE ";" " " MODULES_LEFT "${MODULES_LEFT}")
string(REPLACE ";" " " MODULES_CENTER "${MODULES_CENTER}")
string(REPLACE ";" " " MODULES_RIGHT "${MODULES_RIGHT}")
# }}} # }}}
# Get battery/adapter name {{{ # Get battery/adapter name {{{
@ -89,7 +93,6 @@ install(FILES ${CMAKE_BINARY_DIR}/generated-sources/config
COMPONENT config) COMPONENT config)
# }}} # }}}
# Target: userconfig {{{ # Target: userconfig {{{
configure_file( configure_file(