mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
cmDebugTools: offer a way to disable CM_DBG output at runtime
This allows information to be gathered while debugging while also supporting running the test suite with the debugging enabled to test CMake module changes without tripping `stderr` output checkers.
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "cmSystemTools.h"
|
||||
|
||||
#define CM_DBG(expr) cm::dbg_impl(__FILE__, __LINE__, #expr, expr)
|
||||
|
||||
namespace cm {
|
||||
@@ -13,8 +15,10 @@ namespace {
|
||||
template <typename T>
|
||||
T dbg_impl(const char* fname, int line, const char* expr, T value)
|
||||
{
|
||||
std::cerr << fname << ':' << line << ": " << expr << " = " << value
|
||||
<< std::endl;
|
||||
if (!cmSystemTools::GetEnvVar("CMAKE_NO_DBG")) {
|
||||
std::cerr << fname << ':' << line << ": " << expr << " = " << value
|
||||
<< std::endl;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user