diff --git a/cmake/01-core.cmake b/cmake/01-core.cmake index 7b6716b7..d65c62c3 100644 --- a/cmake/01-core.cmake +++ b/cmake/01-core.cmake @@ -16,6 +16,7 @@ if(NOT CMAKE_BUILD_TYPE) message_colored(STATUS "No build type specified; using RelWithDebInfo" 33) set(CMAKE_BUILD_TYPE "RelWithDebInfo") endif() +string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPER) # Compiler flags set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") diff --git a/cmake/02-opts.cmake b/cmake/02-opts.cmake index 9f817fda..905696f4 100644 --- a/cmake/02-opts.cmake +++ b/cmake/02-opts.cmake @@ -10,13 +10,17 @@ checklib(ENABLE_NETWORK "cmake" Libiw) checklib(WITH_XRM "pkg-config" xcb-xrm) checklib(WITH_XRANDR_MONITORS "pkg-config" "xcb-randr>=1.12") +if(NOT DEFINED ENABLE_CCACHE AND CMAKE_BUILD_TYPE_UPPER MATCHES DEBUG) + set(ENABLE_CCACHE ON) +endif() + option(CXXLIB_CLANG "Link against libc++" OFF) option(CXXLIB_GCC "Link against stdlibc++" OFF) option(BUILD_IPC_MSG "Build ipc messager" ON) option(BUILD_TESTS "Build testsuite" OFF) -option(ENABLE_CCACHE "Enable ccache support" ${DEBUG}) +option(ENABLE_CCACHE "Enable ccache support" OFF) option(ENABLE_ALSA "Enable alsa support" ON) option(ENABLE_CURL "Enable curl support" ON) option(ENABLE_I3 "Enable i3 support" ON) @@ -33,11 +37,13 @@ option(WITH_XCOMPOSITE "xcb-composite support" OFF) option(WITH_XKB "xcb-xkb support" ON) option(WITH_XRM "xcb-xrm support" ON) -option(DEBUG_LOGGER "Debug logging" ${DEBUG}) -option(DEBUG_LOGGER_VERBOSE "Debug logging (verbose)" OFF) -option(DEBUG_HINTS "Debug clickable areas" OFF) -option(DEBUG_WHITESPACE "Debug whitespace" OFF) -option(DEBUG_FONTCONFIG "Debug fontconfig" OFF) +if(CMAKE_BUILD_TYPE_UPPER MATCHES DEBUG) + option(DEBUG_LOGGER "Debug logging" ON) + option(DEBUG_LOGGER_VERBOSE "Debug logging (verbose)" OFF) + option(DEBUG_HINTS "Debug clickable areas" OFF) + option(DEBUG_WHITESPACE "Debug whitespace" OFF) + option(DEBUG_FONTCONFIG "Debug fontconfig" OFF) +endif() set(SETTING_ALSA_SOUNDCARD "default" CACHE STRING "Name of the ALSA soundcard driver") @@ -64,7 +70,7 @@ set(SETTING_PATH_MESSAGING_FIFO "/tmp/polybar_mqueue.%pid%" set(SETTING_PATH_TEMPERATURE_INFO "/sys/class/thermal/thermal_zone%zone%/temp" CACHE STRING "Path to file containing the current temperature") -if(DEBUG) +if(CMAKE_BUILD_TYPE_UPPER MATCHES DEBUG) set(DEBUG_HINTS_OFFSET_X 0 CACHE INTEGER "Debug hint offset x") set(DEBUG_HINTS_OFFSET_Y 0 CACHE INTEGER "Debug hint offset y") endif() diff --git a/cmake/05-summary.cmake b/cmake/05-summary.cmake index ae3c5c09..0e12820a 100644 --- a/cmake/05-summary.cmake +++ b/cmake/05-summary.cmake @@ -2,8 +2,6 @@ # Output build summary # -string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_UPPER) - message(STATUS " Build:") message_colored(STATUS " Type: ${CMAKE_BUILD_TYPE}" "37;2") message_colored(STATUS " CC: ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UPPER}}" "37;2") @@ -31,7 +29,7 @@ colored_option(" xcb-composite" WITH_XCOMPOSITE) colored_option(" xcb-xkb" WITH_XKB) colored_option(" xcb-xrm" WITH_XRM) -if(DEBUG) +if(CMAKE_BUILD_TYPE_UPPER MATCHES DEBUG) message(STATUS " Debug options:") colored_option(" Trace logging" DEBUG_LOGGER) colored_option(" Trace logging (verbose)" DEBUG_LOGGER_VERBOSE)