[cmake-developers] Printing the origin of include dirs (Was Setting include directories via target_link_libraries() ?)

Brad King brad.king at kitware.com
Tue Dec 18 10:53:03 EST 2012


On 12/18/2012 10:29 AM, Stephen Kelly wrote:
> Or we can add a way to print where include directories come from. That's 
> something that's been on the plans since the beginning, and some of the code 
> and API is already in master for it. 
> 
> More of the useful code for that was in my branch, but it's independent of 
> this whole command API question, so I've cherry-picked it out of there and 
> put it in the include-dirs-debugging branch of my clone. 
> 
> I think it's useful on its own, so I think we should get something like it 
> into 2.8.11.
> 
> 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.

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

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.  Perhaps
   CMAKE_DEBUG_TARGET_PROPERTIES=INCLUDE_DIRECTORIES?

-Brad



More information about the cmake-developers mailing list