COMPILE_ONLY

This generator expression belongs to the Toolchain And Language Expressions family. See that section for related generator expressions.

Syntax

$<COMPILE_ONLY:...>

Added in version 3.27.

Content of ..., when collecting transitive compile properties, otherwise it is the empty string. This is intended for use in an INTERFACE_LINK_LIBRARIES and LINK_LIBRARIES target properties, typically populated via the target_link_libraries() command. Provides compilation usage requirements without any linking requirements.

Use cases include header-only usage where all usages are known to not have linking requirements (e.g., all-inline or C++ template libraries).

Note that for proper evaluation of this expression requires policy CMP0099 to be set to NEW.