[CMake] set_target_properties ( INTERFACE_INCLUDE_DIRECTORIES ...)
Craig Scott
craig.scott at crascit.com
Thu Sep 12 18:30:58 EDT 2019
On Fri, Sep 13, 2019 at 8:24 AM Theodore Hall <twhall at umich.edu> wrote:
> Greetings,
>
> set_target_properties(target PROPERTIES
> IMPORTED_LOCATION location
> IMPORTED_IMPLIB implib
> INTERFACE_INCLUDE_DIRECTORIES directory+
> )
>
> Is there a way to assign more than one directory to
> INTERFACE_INCLUDE_DIRECTORIES ? The property name is plural, but every
> attempt I've made to specify more than one directory has failed. CMake
> complains that either: I've passed the wrong number of arguments; or
> concatenates all of them into one path which of course doesn't exist.
>
> I've found a work-around using
>
> target_include_directories (target
> INTERFACE directory1
> INTERFACE directory2
> )
>
> It just seems odd that a property with a plural name accepts only a
> singular value. I feel like I'm missing something. I've tried wrapping
> multiple directories in various kinds of brackets and quotes and separating
> them with ; or , instead of whitespace. (This is Windows, so : isn't a
> path separator; the system PATH variable uses ; as the separator.)
>
OPTION A: Put quotes around a semi-colon separated string if using
set_target_properties():
set_target_properties(target PROPERTIES
IMPORTED_LOCATION location
IMPORTED_IMPLIB implib
INTERFACE_INCLUDE_DIRECTORIES "directory1;directory2"
)
OPTION B: List multiple directories after just one INTERFACE keyword if
using target_include_directories():
target_include_directories (target
INTERFACE directory1 directory2
)
Either option should work for all platforms, but note that option A will
overwrite any previous contents of INTERFACE_INCLUDED_DIRECTORIES whereas
option B will append to any previous contents. For that reason, I'd
generally recommend option B.
>
--
Craig Scott
Melbourne, Australia
https://crascit.com
Get the hand-book for every CMake user: Professional CMake: A Practical
Guide <https://crascit.com/professional-cmake/>
Consulting services (CMake, C++, build/release processes):
https://crascit.com/services
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190913/bcc7a166/attachment.html>
More information about the CMake
mailing list