Rodolfo Schulz de Lima wrote:
Bill Hoffman escreveu:
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);

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.

No, I said that add_custom_command should run 'call_command' in project creation time, not in build time. This way it would execute 'execute_process', which would generate the required call according to the generator used.


Right, so you want the execute_process to be executed at build time, basically convert the lua/cmake to the right code for the generator. Really has nothing to do with the language used. You want the call_command function to run at build time. Your example is simple and does two things, calls execute_process and returns a value. However, you could have anything in the function, and it would all have to be converted to build time calls. The easiest way to do that would be to run cmake -S at build time. Anything else would be really hard...

Again, this has nothing to do with lua vs CMake language.


-Bill

_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to