fix(cmake): Debug check

This commit is contained in:
Michael Carlberg 2017-01-27 13:30:23 +01:00
parent eb5c82a5c3
commit 41f7f82bd0
3 changed files with 15 additions and 10 deletions

View File

@ -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")

View File

@ -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})
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()

View File

@ -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)