[CMake] Recursively include target include directories only

Stephen Kelly steveire at gmail.com
Sun Jun 21 12:11:19 EDT 2015


Petr Kmoch wrote:

> On Thu, Jun 18, 2015 at 1:43 AM, Robert Dailey
> <rcdailey.lists at gmail.com> wrote:
> 
>> On Wed, Jun 17, 2015 at 4:31 PM, Dan Liew
>> <dan at su-root.co.uk> wrote:
>> > On 17 June 2015 at 12:28, Robert Dailey
>> > <rcdailey.lists at gmail.com>
>> wrote:
>> >> Is there a way to only take (recursively) the include directiories
>> >> from a target or set of targets? I know that include directories
>> >> propagate when passing targets to target_link_libraries(), but I do
>> >> not want to link the libs; I only want the include directories.
>> >>
>> >> How can I do this? Thanks.
>>
> 
> I haven't tested this, but it should be possible to drag in the interface
> properties explicitly with generator expressions. Something like this:
> 
> add_executable(Depender ...)
> target_include_directories(Depender PRIVATE
>   $<TARGET_PROPERTY:Dependee1,INTERFACE_INCLUDE_DIRECTORIES>
>   $<TARGET_PROPERTY:Dependee2,INTERFACE_INCLUDE_DIRECTORIES>
> )
> 
> dtto for other INTERFACE_... properties you might need.


He seems to want INCLUDE_DIRECTORIES, not INTERFACE_INCLUDE_DIRECTORIES as 
he's compiling a file from the target.

Thanks,

Steve.




More information about the CMake mailing list