CMake: handle DEBUG_* consistently

- Make all four DEBUG_ flags actual CMake options, rather than
  stuffing some of them in the rather-peculiar _enable_debug_flags.
  Each debug option turns on suitable compile flags in the module(s)
  that are affected.
main
Adriaan de Groot 5 years ago
parent 3b69e48e04
commit 05990fb287

@ -54,6 +54,15 @@ option( WITH_PYTHON "Enable Python modules API (requires Boost.Python)." ON )
option( WITH_PYTHONQT "Enable next generation Python modules API (experimental, requires PythonQt)." OFF )
option( WITH_KF5Crash "Enable crash reporting with KCrash." ON )
# Possible debugging flags are:
# - DEBUG_TIMEZONES draws latitude and longitude lines on the timezone
# widget and enables chatty debug logging, for dealing with the timezone
# location database.
# - DEBUG_FILESYSTEMS does extra logging and checking when looking at
# partition configuration. Lists known KPMCore FS types.
# - DEBUG_PARTITION_UNSAFE (see partition/CMakeLists.txt)
# - DEBUG_PARTITION_LAME (see partition/CMakeLists.txt)
### USE_*
#
@ -156,26 +165,6 @@ set( CMAKE_CXX_STANDARD_REQUIRED ON )
set( CMAKE_C_STANDARD 99 )
set( CMAKE_C_STANDARD_REQUIRED ON )
# Debugging flags
#
# Possible debugging flags are:
# - DEBUG_TIMEZONES draws latitude and longitude lines on the timezone
# widget and enables chatty debug logging, for dealing with the timezone
# location database.
# - DEBUG_FILESYSTEMS does extra logging and checking when looking at
# partition configuration. Lists known KPMCore FS types.
#
# The flags listed here are enabled in Debug builds. By default, none
# are **actually** listed, because they're for such specific scenarios.
set( _enable_debug_flags
# DEBUG_TIMEZONES
# DEBUG_FILESYSTEMS
)
# Add those flags to the CXX flags in a suitable format.
foreach( _edf ${_enable_debug_flags} )
string( APPEND CMAKE_CXX_FLAGS_DEBUG " -D${_edf}" )
endforeach()
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall" )
if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
message( STATUS "Found Clang ${CMAKE_CXX_COMPILER_VERSION}, setting up Clang-specific compiler flags." )

@ -1,10 +1,15 @@
# When debugging the partitioning widget, or experimenting, you may
# want to allow unsafe partitioning choices (e.g. doing things to the
# current disk). Set DEBUG_PARTITION_UNSAFE to allow that (it turns off
# some filtering of devices).
# some filtering of devices). If you **do** allow unsafe partitioning,
# it will error out unless you **also** switch **off** DEBUG_PARTITION_LAME,
# at which point you are welcome to shoot yourself in the foot.
option( DEBUG_PARTITION_UNSAFE "Allow unsafe partitioning choices." OFF )
option( DEBUG_PARTITION_LAME "Unsafe partitioning will error out on exec." ON )
# This is very chatty, useful mostly if you don't know what KPMCore offers.
option( DEBUG_FILESYSTEMS "Log all available Filesystems from KPMCore." OFF )
include_directories( ${CMAKE_SOURCE_DIR} ) # For 3rdparty
set( _partition_defs )
@ -14,6 +19,9 @@ if( DEBUG_PARTITION_UNSAFE )
endif()
list( APPEND _partition_defs DEBUG_PARTITION_UNSAFE )
endif()
if ( DEBUG_FILESYSTEMS )
list( APPEND _partition_defs DEBUG_FILESYSTEMS )
endif()
find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE)

Loading…
Cancel
Save