Make logging of function and source file options

This commit is contained in:
BlackMark 2020-07-05 16:12:01 +02:00
parent ecf89d5e14
commit 191961780f

View File

@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 3.13)
project(AdaptiveBrightness CXX)
option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." ON)
option(LOG_SOURCE_FILE "Log the location in the source file where the log originates" OFF)
option(LOG_FUNCTION "Log the name of the function where the log originates" OFF)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
include(compile_flags)
@ -16,7 +20,6 @@ endif()
set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE STRING "CMake Configuration Types" FORCE)
option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." TRUE)
if(${FORCE_COLORED_OUTPUT})
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
add_compile_options(-fdiagnostics-color=always)
@ -86,7 +89,12 @@ endif()
adaptive_brightness_add_compile_flags(AdaptiveBrightness)
adaptive_brightness_enable_warnings(AdaptiveBrightness)
# adaptive_brightness_enable_source_file_log(AdaptiveBrightness)
# adaptive_brightness_enable_function_name_log(AdaptiveBrightness)
if(${LOG_SOURCE_FILE})
adaptive_brightness_enable_source_file_log(AdaptiveBrightness)
endif()
if(${LOG_FUNCTION})
adaptive_brightness_enable_function_name_log(AdaptiveBrightness)
endif()
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT AdaptiveBrightness)