Re: [cmake-developers] Introducing: message(DEBUG)

2012-03-03 Thread Eric Noulard
2012/3/3 Rolf Eike Beer :
> 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?

I like it, I thought about similar feature when writing CPackRPM.cmake
which uses the "CPACK_RPM_PACKAGE_DEBUG" for the same purpose.

However I thing that debug output should usually be prefixed by the context
emitting the  message in order to be able to tell debug output apart.

Thus I would rather have

message(DEBUG ...) automatically prefix with the name of the current list file
(for example) or may be adding a variable
CMAKE_DEBUG_MESSAGES_PREFIX with local scope which may
be set by the module/list file write before calling
message(DEBUG ...)

currently in CPackRPM I do:

MESSAGE("CPackRPM:Debug: rpmbuild version is <${RPMBUILD_EXECUTABLE_VERSION}>")

I would like to be able to write:

set(CMAKE_DEBUG_MESSAGES_PREFIX "CPackRPM:Debug: ")
...
MESSAGE(DEBUG "rpmbuild version is <${RPMBUILD_EXECUTABLE_VERSION}>")

That way I would have typed the prefix once for the whole CPackRPM.cmake file.

Note that if one begins to use "message(DEBUG" instead of  "if(Boost_DEBUG)"
you won't be able to have selective debug output anymore, i.e.
activating DEBUG output
would enable debug output for all module/list files which may not be
as convenient
as set(Boost_DEBUG 1)

or may be that what you meant by
CMAKE_DEBUG_MESSAGES |= Boost_DEBUG ?
message(DEBUG ...)

-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Introducing: message(DEBUG)

2012-03-03 Thread Yury G. Kudryashov
Rolf Eike Beer wrote:

> I have a small patch to CMake that looks like this:
> +  if (!this->Makefile->IsOn("CMAKE_DEBUG_MESSAGES"))
I propose to print message if one of the following holds:
* CMAKE_DEBUG_MESSAGES is true;
* CMAKE_DEBUG_MESSAGES_FileName is true, where FileName is 
CMAKE_CURRENT_LIST_FILE's name without extension;
* Current list file is CMakeLists.txt and 
CMAKE_DEBUG_MESSAGES_CurrentDirectory is true.

This will allow

# Turn all debug messages
-DCMAKE_DEBUG_MESSAGES=ON
# Turn all debug messages in FindBoost.cmake
-DCMAKE_DEBUG_MESSAGES_FindBoost=ON
# Turn all debug messages in mysubdir/CMakeLists.txt 
-DCMAKE_DEBUG_MESSAGES_mysubdir=ON
# Turn all debug messages in **/CMakeLists.txt
-DCMAKE_DEBUG_MESSAGES_CMakeLists=ON
-- 
Yury G. Kudryashov,
mailto: ur...@mccme.ru

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Introducing: message(DEBUG)

2012-03-03 Thread Rolf Eike Beer
Am Samstag, 3. März 2012, 12:45:12 schrieb Eric Noulard:
> 2012/3/3 Rolf Eike Beer :
> > 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?
>
> I like it, I thought about similar feature when writing CPackRPM.cmake
> which uses the "CPACK_RPM_PACKAGE_DEBUG" for the same purpose.
>
> However I thing that debug output should usually be prefixed by the context
> emitting the  message in order to be able to tell debug output apart.
>
> Thus I would rather have
>
> message(DEBUG ...) automatically prefix with the name of the current list
> file (for example) or may be adding a variable
> CMAKE_DEBUG_MESSAGES_PREFIX with local scope which may
> be set by the module/list file write before calling
> message(DEBUG ...)
>
> currently in CPackRPM I do:
>
> MESSAGE("CPackRPM:Debug: rpmbuild version is
> <${RPMBUILD_EXECUTABLE_VERSION}>")
>
> I would like to be able to write:
>
> set(CMAKE_DEBUG_MESSAGES_PREFIX "CPackRPM:Debug: ")
> ...
> MESSAGE(DEBUG "rpmbuild version is <${RPMBUILD_EXECUTABLE_VERSION}>")
> 
> That way I would have typed the prefix once for the whole CPackRPM.cmake
> file.

This is a nice idea.

> Note that if one begins to use "message(DEBUG" instead of  "if(Boost_DEBUG)"
> you won't be able to have selective debug output anymore, i.e.
> activating DEBUG output
> would enable debug output for all module/list files which may not be
> as convenient
> as set(Boost_DEBUG 1)
>
> or may be that what you meant by
> CMAKE_DEBUG_MESSAGES |= Boost_DEBUG ?
> message(DEBUG ...)

My patch to FindBoost.cmake begins with:

diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 9c03b3d..e30381a 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -257,6 +257,10 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)

+set(CMAKE_DEBUG_MESSAGES_OLD ${CMAKE_DEBUG_MESSAGES})
+if (CMAKE_DEBUG_MESSAGES OR Boost_DEBUG)
+  set(CMAKE_DEBUG_MESSAGES TRUE)
+endif()

So the idea is that you get Boost debug messages
-if you call cmake --debug-output
-if you set Boost_DEBUG before including the Boost Module (for backward
compatibility)
-if you set CMAKE_DEBUG_MESSAGES before including the Boost Module

Eike

signature.asc
Description: This is a digitally signed message part.
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Re: [cmake-developers] Introducing: message(DEBUG)

2012-03-03 Thread Rolf Eike Beer
Am Samstag, 3. März 2012, 17:05:11 schrieb Yury G.  Kudryashov:
> Rolf Eike Beer wrote:
> > I have a small patch to CMake that looks like this:
> > +  if (!this->Makefile->IsOn("CMAKE_DEBUG_MESSAGES"))
>
> I propose to print message if one of the following holds:
> * CMAKE_DEBUG_MESSAGES is true;
> * CMAKE_DEBUG_MESSAGES_FileName is true, where FileName is
> CMAKE_CURRENT_LIST_FILE's name without extension;
> * Current list file is CMakeLists.txt and
> CMAKE_DEBUG_MESSAGES_CurrentDirectory is true.
>
> This will allow
>
> # Turn all debug messages
> -DCMAKE_DEBUG_MESSAGES=ON
> # Turn all debug messages in FindBoost.cmake
> -DCMAKE_DEBUG_MESSAGES_FindBoost=ON
> # Turn all debug messages in mysubdir/CMakeLists.txt
> -DCMAKE_DEBUG_MESSAGES_mysubdir=ON
> # Turn all debug messages in **/CMakeLists.txt
> -DCMAKE_DEBUG_MESSAGES_CMakeLists=ON

I'm not absolutely sure if this is worth the effort. Not that it is generally a
bad idea, but it will likely require some code. The way you simply could do
this stuff is to just put "set(CMAKE_DEBUG_MESSAGES On)" at the beginning of
the subdir/module you want to debug and reset it at the end.

Eike

signature.asc
Description: This is a digitally signed message part.
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Re: [cmake-developers] Introducing: message(DEBUG)

2012-03-03 Thread Richard Wackerbarth
I that you are missing the fundamental usage case.
I would like to set up all of my CMake* files to enable the selection of 
various verbosity levels.
Then, by specifying particular command line options, I can vary the verbosity 
without changing any of the files.
Editing any of the files at build time is undesirable.

On Mar 3, 2012, at 8:05 AM, Rolf Eike Beer wrote:

> Am Samstag, 3. März 2012, 17:05:11 schrieb Yury G.  Kudryashov:
>> Rolf Eike Beer wrote:
>>> I have a small patch to CMake that looks like this:
>>> +  if (!this->Makefile->IsOn("CMAKE_DEBUG_MESSAGES"))
>> 
>> I propose to print message if one of the following holds:
>> * CMAKE_DEBUG_MESSAGES is true;
>> * CMAKE_DEBUG_MESSAGES_FileName is true, where FileName is
>> CMAKE_CURRENT_LIST_FILE's name without extension;
>> * Current list file is CMakeLists.txt and
>> CMAKE_DEBUG_MESSAGES_CurrentDirectory is true.
>> 
>> This will allow
>> 
>> # Turn all debug messages
>> -DCMAKE_DEBUG_MESSAGES=ON
>> # Turn all debug messages in FindBoost.cmake
>> -DCMAKE_DEBUG_MESSAGES_FindBoost=ON
>> # Turn all debug messages in mysubdir/CMakeLists.txt
>> -DCMAKE_DEBUG_MESSAGES_mysubdir=ON
>> # Turn all debug messages in **/CMakeLists.txt
>> -DCMAKE_DEBUG_MESSAGES_CMakeLists=ON
> 
> I'm not absolutely sure if this is worth the effort. Not that it is generally 
> a 
> bad idea, but it will likely require some code. The way you simply could do 
> this stuff is to just put "set(CMAKE_DEBUG_MESSAGES On)" at the beginning of 
> the subdir/module you want to debug and reset it at the end.
> 
> Eike--
> 
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at: 
> http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Introducing: message(DEBUG)

2012-03-03 Thread Rolf Eike Beer
> I have a small patch to CMake that looks like this:

For easier access I pushed the topic "debug-messages" to stage. I don't 
guarantee for stability here, so I may force-push at any time.

Eike

signature.asc
Description: This is a digitally signed message part.
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Re: [cmake-developers] Introducing: message(DEBUG)

2012-03-05 Thread Brad King

On 3/3/2012 5:25 AM, Rolf Eike Beer wrote:

+  else if (*i == "DEBUG")
+{

...

+status = true;


Rather than being a conditional version of STATUS I think full stack
information is useful for debugging.  Add to the cmake::MessageType
enumeration a DEBUG value and teach cmake::IssueMessage to handle it.
The output should look like an error or warning but with "CMake Debug"
as the header instead of "CMake Error" or "CMake Warning".

Once the decision to display the message has a cmListFileBacktrace
instance available for the context then you can have fancier rules
for deciding what messages to display.

-Brad
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Introducing: message(DEBUG)

2012-03-05 Thread Rolf Eike Beer
> On 3/3/2012 5:25 AM, Rolf Eike Beer wrote:
>> +  else if (*i == "DEBUG")
>> +{
> ...
>> +status = true;
>
> Rather than being a conditional version of STATUS I think full stack
> information is useful for debugging.  Add to the cmake::MessageType
> enumeration a DEBUG value and teach cmake::IssueMessage to handle it.
> The output should look like an error or warning but with "CMake Debug"
> as the header instead of "CMake Error" or "CMake Warning".

I would like to have that switchable in some way. E.g. for Boost_DEBUG I
don't have stack traces at the moment, but the contents are the
information I need. Stacktraces are useful, but not always.

> Once the decision to display the message has a cmListFileBacktrace
> instance available for the context then you can have fancier rules
> for deciding what messages to display.

I don't think I fully understand what you are trying to say here.

Eike
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Introducing: message(DEBUG)

2012-03-05 Thread Brad King

On 3/5/2012 10:22 AM, Rolf Eike Beer wrote:

Rather than being a conditional version of STATUS I think full stack
information is useful for debugging.  Add to the cmake::MessageType
enumeration a DEBUG value and teach cmake::IssueMessage to handle it.
The output should look like an error or warning but with "CMake Debug"
as the header instead of "CMake Error" or "CMake Warning".


I would like to have that switchable in some way. E.g. for Boost_DEBUG I
don't have stack traces at the moment, but the contents are the
information I need. Stacktraces are useful, but not always.


I'm not opposed to a switch but extra verbosity rarely hurts debug
output IMO.  Even a switch at the call site may be the wrong place
because it is up to the viewer of the message whether the full
context is important.  Perhaps the switch can be based on something
similar to the context filters (see below).


Once the decision to display the message has a cmListFileBacktrace
instance available for the context then you can have fancier rules
for deciding what messages to display.


I don't think I fully understand what you are trying to say here.


Elsewhere in this thread discussion proposed filters on messages
based on their context.  Filters based on the full backtrace
should be possible and would give a lot of control.

-Brad
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Introducing: message(DEBUG)

2012-03-05 Thread Eric Noulard
2012/3/5 Rolf Eike Beer :
>> On 3/3/2012 5:25 AM, Rolf Eike Beer wrote:
>>> +  else if (*i == "DEBUG")
>>> +    {
>> ...
>>> +    status = true;
>>
>> Rather than being a conditional version of STATUS I think full stack
>> information is useful for debugging.  Add to the cmake::MessageType
>> enumeration a DEBUG value and teach cmake::IssueMessage to handle it.
>> The output should look like an error or warning but with "CMake Debug"
>> as the header instead of "CMake Error" or "CMake Warning".
>
> I would like to have that switchable in some way. E.g. for Boost_DEBUG I
> don't have stack traces at the moment, but the contents are the
> information I need. Stacktraces are useful, but not always.

Then may be you can have a bunch of control var for that:
CMAKE_DEBUG_MESSAGES_STACKTRACE ON/OFF
CMAKE_DEBUG_MESSAGES_FILEPREFIX  ON/OFF
CMAKE_DEBUG_MESSAGES_USERPREFIX 

then you display some prefix depending on ON/OFF value and if
USERPREFIX is set.

>> Once the decision to display the message has a cmListFileBacktrace
>> instance available for the context then you can have fancier rules
>> for deciding what messages to display.
>
> I don't think I fully understand what you are trying to say here.

May be something like my previous proposal?

-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Introducing: message(DEBUG)

2012-03-05 Thread Eric Noulard
2012/3/5 Brad King :
> On 3/5/2012 10:22 AM, Rolf Eike Beer wrote:
>>>
>>> Rather than being a conditional version of STATUS I think full stack
>>> information is useful for debugging.  Add to the cmake::MessageType
>>> enumeration a DEBUG value and teach cmake::IssueMessage to handle it.
>>> The output should look like an error or warning but with "CMake Debug"
>>> as the header instead of "CMake Error" or "CMake Warning".
>>
>>
>> I would like to have that switchable in some way. E.g. for Boost_DEBUG I
>> don't have stack traces at the moment, but the contents are the
>> information I need. Stacktraces are useful, but not always.
>
>
> I'm not opposed to a switch but extra verbosity rarely hurts debug
> output IMO.  Even a switch at the call site may be the wrong place
> because it is up to the viewer of the message whether the full
> context is important.  Perhaps the switch can be based on something
> similar to the context filters (see below).
>
>
>>> Once the decision to display the message has a cmListFileBacktrace
>>> instance available for the context then you can have fancier rules
>>> for deciding what messages to display.
>>
>>
>> I don't think I fully understand what you are trying to say here.
>
>
> Elsewhere in this thread discussion proposed filters on messages
> based on their context.  Filters based on the full backtrace
> should be possible and would give a lot of control.

You mean something like a regex?
So that if the stacktrace and/or prefix (and/or the whole message)
matches the regex it is displayed ?

It may cost a lot at runtime?

-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Introducing: message(DEBUG)

2012-03-05 Thread Brad King

On 3/5/2012 10:33 AM, Eric Noulard wrote:

2012/3/5 Brad King:

Elsewhere in this thread discussion proposed filters on messages
based on their context.  Filters based on the full backtrace
should be possible and would give a lot of control.


You mean something like a regex?


I had no particular interface in mind and was just pointing out
what is possible.


So that if the stacktrace and/or prefix (and/or the whole message)
matches the regex it is displayed ?


That sounds reasonable.


It may cost a lot at runtime?


Possibly, but there should be a fast-path if DEBUG messages are
not turned on at all.  Once they are on then the runtime cost
may be worthwhile for such control.

-Brad
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Introducing: message(DEBUG)

2012-03-05 Thread Alexander Neundorf
On Monday 05 March 2012, Brad King wrote:
> On 3/5/2012 10:22 AM, Rolf Eike Beer wrote:
> >> Rather than being a conditional version of STATUS I think full stack
> >> information is useful for debugging.  Add to the cmake::MessageType
> >> enumeration a DEBUG value and teach cmake::IssueMessage to handle it.
> >> The output should look like an error or warning but with "CMake Debug"
> >> as the header instead of "CMake Error" or "CMake Warning".
> > 
> > I would like to have that switchable in some way. E.g. for Boost_DEBUG I
> > don't have stack traces at the moment, but the contents are the
> > information I need. Stacktraces are useful, but not always.
> 
> I'm not opposed to a switch but extra verbosity rarely hurts debug
> output IMO.  

Currently, if you use cmake --debug-output you already get a backtrace for 
each printed message.
So it's maybe not necessary to add them there additionally.

Alex
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Introducing: message(DEBUG)

2012-03-05 Thread Alexander Neundorf
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
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Introducing: message(DEBUG)

2012-03-05 Thread Brad King

On 3/5/2012 4:03 PM, Alexander Neundorf wrote:

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.


I'd rather not have too many magic modes of message().  Perhaps this
thread should instead propose a "cmake_debug" command which can have
all kinds of subcommands for specific use cases like this:

  cmake_debug(MESSAGE ...)
  cmake_debug(VARIABLES ...)

-Brad
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers