[CMake] arguments for EXECUTE_PROCESS

Albrecht Schlosser AlbrechtS.fltk at online.de
Wed Jan 27 17:59:23 EST 2016


On 27.01.2016 23:05 Fabian Wein wrote:
> For my a test suite I want to test a Python script,
> I have the arguments in a variable like
>
> SET(MATVIZ_ARGS „—res 2 —type bulk2d’")
>
> and call it similar to
>
> EXECUTE_PROCESS(
>      COMMAND "${MATVIZ_PY}" "${MATVIZ_ARGS}"

Suggestion: do not quote the argument variable here:

        COMMAND "${MATVIZ_PY}" ${MATVIZ_ARGS}

>      WORKING_DIRECTORY "${CCSD}"
>      ERROR_VARIABLE MATVIZ_ERROR
>      RESULT_VARIABLE MATVIZ_RETVAL
>    )

or do something like this:

SET(MATVIZ_ARGS "—res 2" "—type bulk2d")

EXECUTE_PROCESS(
COMMAND "${MATVIZ_PY}" ${MATVIZ_ARGS}
...

If you need arguments with spaces, you might have to double quote the 
arguments in the SET command.



More information about the CMake mailing list