[CMake] Generator expressions: Identifying when they're used in a custom command?

Alan W. Irwin irwin at beluga.phys.uvic.ca
Sun Feb 18 17:09:49 EST 2018


On 2018-02-18 03:49-0700 Sam Edwards wrote:

> However, when it came time to actually set this IS_INTERROGATE property, I
> could find no way to apply it to a custom command. I guess this makes sense
> - custom commands aren't targets, after all. But I couldn't convert my
> custom command to a custom target, because it produces a C++ source file
> and I need to use OUTPUT to let CMake know where that source file comes
> from, and you can't use OUTPUT and TARGET together in add_custom_command.

Hi Sam:

It's quite common for each custom command to have a corresponding
custom target that DEPENDS on the OUTPUT of the custom command.  So
building the target part of that pair means the custom command is
executed *only if* the OUTPUT from it is out of date.

If you used that paradigm for the custom commands you refer to
above (where each such custom command is paired with a unique target
via the DEPENDS of the latter) could you not set the IS_INTERROGATE
property for the custom target part of of each pair whenever that
property is relevant?

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list