[CMake] Re: Ignoring command return code in add_custom_command
Bill Hoffman
bill.hoffman at kitware.com
Fri Dec 14 10:46:07 EST 2007
Rodolfo Schulz de Lima wrote:
>
> function call_command()
> {
> -- I think that passing 'COMMAND' is not needed, but it's ok if
> -- one cares about maintaining the cmake script syntax.
> ret = execute_process(COMMAND, "whatever");
> -- do something with ret
> return true; -- or false, to make the build stop
> }
>
> add_custom_command(OUTPUT, "text.cpp" COMMAND call_command);
>
> Although you have a point by saying that cmake should not run during the
> build, the above construction allows it to generate the correct projects
> without needing cmake during build. The function add_custom_command
> would call 'call_command' during project creation (not build time) and
> setup the process call and its return value processing.
>
So, how would the above work? The custom command would have to run
call_command at build time. That means Xcode, VS, and make would all
have to run call_command. I would think that would have to be done by
running a script. Unless you want to translate the lua function into
make, Xcode, VS, etc. Again, I think this is more of a feature request,
that moving to lua would have no impact on. You want to put cmake/lua
code into a custom command and have it run during the build.
-Bill
More information about the CMake
mailing list