From 543c8c40f1aab7e7c394af4e1195a722fa0a047e Mon Sep 17 00:00:00 2001 From: Andrej Rode Date: Thu, 6 Apr 2017 11:53:33 -0700 Subject: utils: add coloring depending on loglevel to console output --- host/cmake/Modules/UHDLog.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'host/cmake') diff --git a/host/cmake/Modules/UHDLog.cmake b/host/cmake/Modules/UHDLog.cmake index 19b4c39ef..4bc1daf13 100644 --- a/host/cmake/Modules/UHDLog.cmake +++ b/host/cmake/Modules/UHDLog.cmake @@ -55,6 +55,16 @@ 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(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}) -- cgit v1.2.3