diff options
author | Martin Braun <martin.braun@ettus.com> | 2018-11-13 21:53:22 -0800 |
---|---|---|
committer | Brent Stapleton <bstapleton@g.hmc.edu> | 2018-11-14 14:10:09 -0800 |
commit | a69ab0c23a0c38e3fed3e412df36538d8959d23c (patch) | |
tree | e6669a138dad84f79c46588f43a38c69dda90246 /host/cmake/Modules/UHDLog.cmake | |
parent | 4247f025020d7dd1f696dfbd3cce248957d6ace7 (diff) | |
download | uhd-a69ab0c23a0c38e3fed3e412df36538d8959d23c.tar.gz uhd-a69ab0c23a0c38e3fed3e412df36538d8959d23c.tar.bz2 uhd-a69ab0c23a0c38e3fed3e412df36538d8959d23c.zip |
cmake: Update coding style to use lowercase commands
Also updates our coding style file.
Ancient CMake versions required upper-case commands. Later command
names became case-insensitive. Now the preferred style is lower-case.
Run the following shell code (with GNU compliant sed):
cmake --help-command-list | grep -v "cmake version" | while read c; do
echo 's/\b'"$(echo $c | tr '[:lower:]' '[:upper:]')"'\(\s*\)(/'"$c"'\1(/g'
done > convert.sed \
&& git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' \
'*CMakeLists.txt' | xargs -0 gsed -i -f convert.sed && rm convert.sed
(Make sure the backslashes don't get mangled!)
Diffstat (limited to 'host/cmake/Modules/UHDLog.cmake')
-rw-r--r-- | host/cmake/Modules/UHDLog.cmake | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/host/cmake/Modules/UHDLog.cmake b/host/cmake/Modules/UHDLog.cmake index 4bc1daf13..18643e672 100644 --- a/host/cmake/Modules/UHDLog.cmake +++ b/host/cmake/Modules/UHDLog.cmake @@ -1,72 +1,72 @@ ######################################################################## # Logging Variables ######################################################################## -IF(CMAKE_BUILD_TYPE STREQUAL "Debug") - SET(UHD_LOG_MIN_LEVEL "debug" CACHE STRING "Set UHD log level to {trace, debug, info, warning, error, fatal}") - SET(UHD_LOG_CONSOLE_DISABLE "OFF" CACHE BOOL "Disable UHD logging to stderr") - SET(UHD_LOG_FILE_LEVEL "trace" CACHE STRING "SET UHD file logging level to {trace, debug, info, warning, error, fatal}") - SET(UHD_LOG_CONSOLE_LEVEL "debug" CACHE STRING "SET UHD file logging level to {trace, debug, info, warning, error, fatal}") -ELSE() - SET(UHD_LOG_MIN_LEVEL "debug" CACHE STRING "Set UHD log level to {trace, debug, info, warning, error, fatal}") - SET(UHD_LOG_CONSOLE_DISABLE "OFF" CACHE BOOL "Disable UHD logging to stderr") - SET(UHD_LOG_FILE_LEVEL "info" CACHE STRING "SET UHD file logging level to {trace, debug, info, warning, error, fatal}") - SET(UHD_LOG_CONSOLE_LEVEL "info" CACHE STRING "SET UHD file logging level to {trace, debug, info, warning, error, fatal}") -ENDIF() +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + set(UHD_LOG_MIN_LEVEL "debug" CACHE STRING "Set UHD log level to {trace, debug, info, warning, error, fatal}") + set(UHD_LOG_CONSOLE_DISABLE "OFF" CACHE BOOL "Disable UHD logging to stderr") + set(UHD_LOG_FILE_LEVEL "trace" CACHE STRING "SET UHD file logging level to {trace, debug, info, warning, error, fatal}") + set(UHD_LOG_CONSOLE_LEVEL "debug" CACHE STRING "SET UHD file logging level to {trace, debug, info, warning, error, fatal}") +else() + set(UHD_LOG_MIN_LEVEL "debug" CACHE STRING "Set UHD log level to {trace, debug, info, warning, error, fatal}") + set(UHD_LOG_CONSOLE_DISABLE "OFF" CACHE BOOL "Disable UHD logging to stderr") + set(UHD_LOG_FILE_LEVEL "info" CACHE STRING "SET UHD file logging level to {trace, debug, info, warning, error, fatal}") + set(UHD_LOG_CONSOLE_LEVEL "info" CACHE STRING "SET UHD file logging level to {trace, debug, info, warning, error, fatal}") +endif() -FUNCTION(UHD_LOG_LEVEL_CONVERT ARG1 ARG2) +function(UHD_LOG_LEVEL_CONVERT ARG1 ARG2) string(TOLOWER "${ARG1}" LOG_LEVEL_LOWER) - IF(LOG_LEVEL_LOWER STREQUAL "trace") - ADD_DEFINITIONS(-D${ARG2}=0) - ELSEIF(LOG_LEVEL_LOWER STREQUAL "debug") - ADD_DEFINITIONS(-D${ARG2}=1) - ELSEIF(LOG_LEVEL_LOWER STREQUAL "info") - ADD_DEFINITIONS(-D${ARG2}=2) - ELSEIF(LOG_LEVEL_LOWER STREQUAL "warning") - ADD_DEFINITIONS(-D${ARG2}=3) - ELSEIF(LOG_LEVEL_LOWER STREQUAL "error") - ADD_DEFINITIONS(-D${ARG2}=4) - ELSEIF(LOG_LEVEL_LOWER STREQUAL "fatal") - ADD_DEFINITIONS(-D${ARG2}=5) - ELSE() - ADD_DEFINITIONS(-D${ARG2}=${ARG1}) - ENDIF() -ENDFUNCTION() + if(LOG_LEVEL_LOWER STREQUAL "trace") + add_definitions(-D${ARG2}=0) + elseif(LOG_LEVEL_LOWER STREQUAL "debug") + add_definitions(-D${ARG2}=1) + elseif(LOG_LEVEL_LOWER STREQUAL "info") + add_definitions(-D${ARG2}=2) + elseif(LOG_LEVEL_LOWER STREQUAL "warning") + add_definitions(-D${ARG2}=3) + elseif(LOG_LEVEL_LOWER STREQUAL "error") + add_definitions(-D${ARG2}=4) + elseif(LOG_LEVEL_LOWER STREQUAL "fatal") + add_definitions(-D${ARG2}=5) + else() + add_definitions(-D${ARG2}=${ARG1}) + endif() +endfunction() UHD_LOG_LEVEL_CONVERT(${UHD_LOG_MIN_LEVEL} "UHD_LOG_MIN_LEVEL") UHD_LOG_LEVEL_CONVERT(${UHD_LOG_CONSOLE_LEVEL} "UHD_LOG_CONSOLE_LEVEL") UHD_LOG_LEVEL_CONVERT(${UHD_LOG_FILE_LEVEL} "UHD_LOG_FILE_LEVEL") -IF(UHD_LOG_CONSOLE_DISABLE) - ADD_DEFINITIONS(-DUHD_LOG_CONSOLE_DISABLE) -ELSE() - IF(UHD_LOG_CONSOLE_TIME) - ADD_DEFINITIONS(-DUHD_LOG_CONSOLE_TIME) - ENDIF() - IF(UHD_LOG_CONSOLE_THREAD) - ADD_DEFINITIONS(-DUHD_LOG_CONSOLE_THREAD) - ENDIF() - IF(UHD_LOG_CONSOLE_SRC) - ADD_DEFINITIONS(-DUHD_LOG_CONSOLE_SRC) - ENDIF() -ENDIF() +if(UHD_LOG_CONSOLE_DISABLE) + add_definitions(-DUHD_LOG_CONSOLE_DISABLE) +else() + if(UHD_LOG_CONSOLE_TIME) + add_definitions(-DUHD_LOG_CONSOLE_TIME) + endif() + if(UHD_LOG_CONSOLE_THREAD) + add_definitions(-DUHD_LOG_CONSOLE_THREAD) + endif() + if(UHD_LOG_CONSOLE_SRC) + add_definitions(-DUHD_LOG_CONSOLE_SRC) + endif() +endif() -SET(UHD_LOG_FASTPATH_DISABLE "OFF" CACHE BOOL "Disable printing of fastpath logging symbols to stderr (DOSU)") -IF(UHD_LOG_FASTPATH_DISABLE) - ADD_DEFINITIONS(-DUHD_LOG_FASTPATH_DISABLE) -ENDIF() +set(UHD_LOG_FASTPATH_DISABLE "OFF" CACHE BOOL "Disable printing of fastpath logging symbols to stderr (DOSU)") +if(UHD_LOG_FASTPATH_DISABLE) + add_definitions(-DUHD_LOG_FASTPATH_DISABLE) +endif() -IF(MSVC OR CYGWIN) - SET(UHD_LOG_CONSOLE_COLOR "OFF" CACHE BOOL "Enable color output on the terminal") -ELSE() - SET(UHD_LOG_CONSOLE_COLOR "ON" CACHE BOOL "Enable color output on the terminal") -ENDIF() +if(MSVC OR CYGWIN) + set(UHD_LOG_CONSOLE_COLOR "OFF" CACHE BOOL "Enable color output on the terminal") +else() + set(UHD_LOG_CONSOLE_COLOR "ON" CACHE BOOL "Enable color output on the terminal") +endif() -IF(UHD_LOG_CONSOLE_COLOR) - ADD_DEFINITIONS(-DUHD_LOG_CONSOLE_COLOR) -ENDIF() +if(UHD_LOG_CONSOLE_COLOR) + add_definitions(-DUHD_LOG_CONSOLE_COLOR) +endif() -SET(UHD_LOG_FILE "" CACHE FILE "Set UHD log file to a file in a existing directory") -IF(NOT UHD_LOG_FILE STREQUAL "") - ADD_DEFINITIONS(-DUHD_LOG_FILE=${UHD_LOG_FILE}) -ENDIF() +set(UHD_LOG_FILE "" CACHE FILE "Set UHD log file to a file in a existing directory") +if(NOT UHD_LOG_FILE STREQUAL "") + add_definitions(-DUHD_LOG_FILE=${UHD_LOG_FILE}) +endif() |