[CMake] debug/optimized include directories

David Cole david.cole at kitware.com
Fri Nov 4 14:03:27 EDT 2011


On Fri, Nov 4, 2011 at 12:23 PM, Alexander Neundorf
<a.neundorf-work at gmx.net> wrote:
> On Friday 04 November 2011, David Cole wrote:
>> On Wed, Nov 2, 2011 at 8:30 PM, Stephen Kelly <steveire at gmail.com> wrote:
>> > David Cole wrote:
>> >> On Tue, Nov 1, 2011 at 4:33 PM, Robert Dailey
>> >>
>> >> <rcdailey at gmail.com> wrote:
>> >>> On Tue, Nov 1, 2011 at 3:32 PM, David Cole
>> >>>
>> >>> <david.cole at kitware.com> wrote:
>> >>>> Not yet
>> >>>
>> >>> Meaning there are plans in the works to add such functionality in the
>> >>> near future?
>> >>> For now I guess I could actually hard code VS environment variables in
>> >>> my include directory strings, such as $(Configuration).
>> >>
>> >> There is a feature planned to add per-target include directories (as a
>> >> target property). As part of that work, we will probably naturally
>> >> also add per-configuration values of that new target property. It is
>> >> not yet added as a feature request in the bug tracker, but there are
>> >> related ones that I may "borrow" for the purpose. Stay tuned for more
>> >> info, but it is not coming in the next week or two. Hopefully, in time
>> >> for 2.8.7, but it depends on timing at this point.... so no promises.
>> >
>> > Hi David,
>> >
>> > I'm interested in this feature. I'd like to get it into CMake 2.8.7.
>> >
>> > It came up in the recent thread about how Qt5Config.cmake should work:
>> >
>> > http://thread.gmane.org/gmane.comp.lib.qt.project.devel/79/focus=226
>> >
>> > You mentioned that there are some side-line relevant bugs in the CMake
>> > tracker for this. Could you point me to them? Could you also indicate the
>> > approximate location in the code to look to for starting to work on this
>> > (cmTarget.cxx?).
>>
>> See these bugs (and probably others, too, but these looked like the
>> most relevant ones when I searched for "include_directories"...)
>>
>>   http://public.kitware.com/Bug/view.php?id=1968
>>   http://public.kitware.com/Bug/view.php?id=6269
>>   http://public.kitware.com/Bug/view.php?id=6493
>>   http://public.kitware.com/Bug/view.php?id=8189
>>
>> I think the main thing we want is a new target property named
>> "INCLUDE_DIRECTORIES" - There's already a directory property with that
>> name; the include_directories command is implemented in terms of that
>> directory property. Along with that, we will also want
>> per-configuration variants of the property, similar to the many
>> existing target properties that have per-config variants.
>>
>> If you look at the code, you'll see that use of the existing
>> INCLUDE_DIRECTORIES property triggers a call to
>> cmMakefile::SetIncludeDirectories, which just saves it in a data
>> member for later use. You can grep the code for GetIncludeDirectories
>> for callers, or for just IncludeDirectories to see the direct usage in
>> cmMakefile.cxx itself.
>>
>> The interesting bits here are going to be in deciding how to make
>> these per-target include_directories behave. Should they be additive?
>> Or should they override the directory-level includes entirely?
>>
>> There is quite some discussion to be had here and some decisions to
>> make. (Which is why I hesitate to promise that this will definitely be
>> ready by 2.8.7...)
>
> Looks like the first step to assigning include directories to libraries, so
> they are used automatically when linking against them.
> Is this also already in planning ?
>
> Alex
>

No, not in "planning" so much as in "wishing."

That sounds like another separate target property that may or may not
have the same exact value as the INCLUDE_DIRECTORIES property. Not all
clients will need all the same include_directories as the target
itself... Perhaps an additional property named
AUTO_INCLUDE_DIRECTORIES (or something similar that indicates it is
automatic) should be used for that purpose.


More information about the CMake mailing list