[cmake-developers] Printing the origin of include dirs

Stephen Kelly steveire at gmail.com
Tue Dec 18 11:02:47 EST 2012


Brad King wrote:

> On 12/18/2012 10:29 AM, Stephen Kelly wrote: 
>> Note that the branch is work in progress. Currently the backtrace is not
>> always initialized correctly when include_directories() is used. What do
>> ya'll think of the idea?
> 
> Providing backtraces for debugging would be helpful for users.  Here
> are a few comments:
> 
> 1. The cmListFileBacktrace structure was originally created to pass
>    context for error messages.  IIRC it carries full strings for each
>    level on the stack.  This is pretty heavy to start keeping around
>    for everything and we've been accumulating it in more places.
>    We may need to "intern" strings to make backtraces lighter.

I didn't look into the implementation of it yet. By 'intern', you mean 
storing const char * instead of std::string with the cmListFileBacktrace 
object, and maintaining the strings elsewhere (globally?)?

> 
> 2. Properties other than INCLUDE_DIRECTORIES may benefit from this.
>    The infrastructure could be generalized somewhat and kept directly
>    in the property representation structures.

Yes. Do you have any idea of what you'd like to see generalized? The 
interception and struct for handling the INCLUDE_DIRECTORIES property 
itself?

> 
> 3. I do not like the name "CMAKE_PRINT_INCLUDE_DIR_ORIGINS" to get
>    the debug output.  We should establish a naming convention for
>    variables that activate debugging features.  

Yes. It's not a great name.

>    Perhaps
>    CMAKE_DEBUG_TARGET_PROPERTIES=INCLUDE_DIRECTORIES?

Do you mean 

 set(CMAKE_DEBUG_TARGET_PROPERTIES INCLUDE_DIRECTORIES)

?

That would be fine if the arg can be a list.

 set(CMAKE_DEBUG_TARGET_PROPERTIES 
    "INCLUDE_DIRECTORIES;COMPILE_DEFINITIONS"
 )

but then I don't think it's much better than:

 set(CMAKE_DEBUG_TARGET_INCLUDE_DIRECTORIES ON)
 set(CMAKE_DEBUG_TARGET_COMPILE_DEFINITIONS ON)


Thanks for the feedback,

Steve.




More information about the cmake-developers mailing list