[cmake-developers] Introducing: message(DEBUG)
Alexander Neundorf
neundorf at kde.org
Mon Mar 5 16:03:14 EST 2012
On Saturday 03 March 2012, Rolf Eike Beer wrote:
> I have a small patch to CMake that looks like this:
>
> diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx
> index e1dbf34..ad24368 100644
> --- a/Source/cmMessageCommand.cxx
> +++ b/Source/cmMessageCommand.cxx
> @@ -52,6 +52,18 @@ bool cmMessageCommand
> status = true;
> ++i;
> }
> + else if (*i == "DEBUG")
> + {
> + if (!this->Makefile->GetCMakeInstance()->GetDebugOutput())
> + {
> + if (!this->Makefile->IsOn("CMAKE_DEBUG_MESSAGES"))
> + {
> + return true;
> + }
> + }
> + status = true;
> + ++i;
> + }
>
> for(;i != args.end(); ++i)
> {
>
> The idea behind this is like that: you can write message(DEBUG ...)
> everywhere in your CMake code and it will just print out nothing. Once you
> run cmake -- debug-output these messages will behave like message(STATUS),
> i.e. give you their contents and call trace. If at the point of the
> message(DEBUG) call a variable CMAKE_DEBUG_MESSAGES is set the message
> will behave like a normal message(STATUS), too. This variable is a
> completely normal CMake variable, i.e. it follows the normal scoping
> rules. My idea is to go into
> Modules/Find*.cmake and e.g. replace if(Boost_DEBUG) message(...) endif()
> just by "CMAKE_DEBUG_MESSAGES |= Boost_DEBUG" message(DEBUG ...).
>
> Opinions?
Is there a chance that something like
message(VARIABLES var1 var2 ... varN)
which would print the name followed by the value of the given variables
("FOO_LIBRARY=/usr/lib/libfoo.so HAVE_BAR=1 ...")
would be also accepted ?
I need that all the time, and it's somewhat related to the patch here.
Alex
More information about the cmake-developers
mailing list