[cmake-developers] target_include_directories() accepts only absolute paths ?
Stephen Kelly
steveire at gmail.com
Mon Jan 28 12:27:32 EST 2013
Alexander Neundorf wrote:
> On Sunday 27 January 2013, Stephen Kelly wrote:
>> Alexander Neundorf wrote:
>> >> > Is there a reason why
>> >> > target_include_directories() should behave differently ?
>> >>
>> >> That results from the semantics of the INCLUDE_DIRECTORIES property
>> >> and http://public.kitware.com/Bug/view.php?id=13188
>> >
>> > Ok.
>> > This applies to setting the target property directly.
>> > But, I think target_include_directories() could still handle relative
>> > paths so that CMAKE_CURRENT_SOURCE_DIR is prepended before it is set as
>> > a target property.
>>
>> Yes. However code like this would be ambiguous until generate-time:
>>
>> target_include_directories(foo PRIVATE bar)
>>
>> Is bar a target or a directory? That means storing a longer string for
>> bar:
>
> Simply saying that an existing directory with the given name has priority
> over a target with the same name would not be ok ?
Currently we do the opposite. First check if 'bar' is a target name, and if
not, then treat it as a directory.
> This would mean that directories "shadow" targets (or only
> not-yet-existing targets), while the other way round targets shadow
> directories.
As directories should be set up front, that could be a good idea and could
indeed allow us to determine at configure-time if 'bar' is a directory or
might be a target.
>
>>
http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/5734/focu
>> s=5920
>>
>> https://gitorious.org/~steveire/cmake/steveires-
>> cmake/commit/6fcdd6e4d47d0469baad228a84ebb9269dceb488
>>
>> I don't know if that has a big impact but it's an unfortunately long
>> string to have to store for such a small input.
>>
>> We can also allow relative directories in a later release anyway. I'd
>> prefer at this point to be focussed on things which do have to be in this
>> release.
>
>
> Yes.
Although if we're going to change from
if (target) {} else if (directory) {}
to
if (directory) {} else if (target) {}
we should do that this release.
I can have a look later/tomorrow depending on whether anything gets merged
today. It would require refactoring which would conflict with my interface-
commands-lazy-target-check branch.
Thanks,
Steve.
More information about the cmake-developers
mailing list