[CMake] Running a function as a build target
Nils Gladitz
nilsgladitz at gmail.com
Mon Jun 9 17:03:37 EDT 2014
On 09.06.2014 12:58, Rick McGuire wrote:
> Is it possible to invoke a script function as part of a target? I
> have a build step where I need to process a bunch of variable values
> before building a particular target. All of the custom targets
> require a COMMAND, not a function. I thought maybe I could push this
> off to a script invoked by cmake -P, but a quick test revealed that
> the script does not inherit the variable environment and the variables
> I'm working with cannot be easily passed using -D values on the
> command line.
Script mode (-P) is the only way to invoke a cmake script function as
part of a custom target.
If passing values via -D is problematic perhaps you could generate the
scripts themselves (e.g. configure_file()) or generate an include file
for the script with the required values (and pass its path with -D).
Nils
More information about the CMake
mailing list