mirror of
https://github.com/gabime/spdlog.git
synced 2026-10-28 09:45:28 +08:00
Don't show spdlog message and build type when rerunning CMake (#3649)
These messages are useful, but only once, showing them again and again and again as CMake reruns in the same build tree is more annoying than anything else. Skip doing this by defining a helper spdlog_message_once() function and use it instead of message(). Co-authored-by: Gabi Melman <gmelman1@gmail.com>
This commit is contained in:
1 parent
2ad32cab2e
commit
b7ae19f59f
2 files changed
+13
-2
No files matched your search
+2
-2
@@ -11,7 +11,7 @@ include(cmake/ide.cmake)
|
||||
spdlog_extract_version()
|
||||
|
||||
project(spdlog VERSION ${SPDLOG_VERSION} LANGUAGES CXX)
|
||||
message(STATUS "Build spdlog: ${SPDLOG_VERSION}")
|
||||
spdlog_message_once(VERSION "Build spdlog: ${SPDLOG_VERSION}")
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
@@ -172,7 +172,7 @@ if(SPDLOG_BUILD_PIC)
|
||||
endif()
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
|
||||
spdlog_message_once(BUILD_TYPE "Build type: ${CMAKE_BUILD_TYPE}")
|
||||
# ---------------------------------------------------------------------------------------
|
||||
# Static/Shared library
|
||||
# ---------------------------------------------------------------------------------------
|
||||
|
||||
@@ -71,3 +71,14 @@ function(spdlog_enable_thread_sanitizer target_name)
|
||||
target_compile_options(${target_name} PRIVATE -fno-omit-frame-pointer)
|
||||
target_link_libraries(${target_name} PRIVATE -fsanitize=thread)
|
||||
endfunction()
|
||||
|
||||
# Show a status message during the first CMake run only, as repeating it during
|
||||
# the automatic reconfigurations of a parent project including us is just noise.
|
||||
# The key identifies the message and has to be unique, the text is shown again
|
||||
# if it changes, e.g. when the build type is different from the previous run.
|
||||
function(spdlog_message_once key text)
|
||||
if(NOT "${text}" STREQUAL "$CACHE{SPDLOG_MESSAGE_${key}}")
|
||||
set(SPDLOG_MESSAGE_${key} "${text}" CACHE INTERNAL "")
|
||||
message(STATUS "${text}")
|
||||
endif()
|
||||
endfunction()
|
||||
Reference in new issue
Block a user