[CMake] arguments for EXECUTE_PROCESS

Fabian Wein fabian.wein at fau.de
Wed Jan 27 17:05:24 EST 2016


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}"
    WORKING_DIRECTORY "${CCSD}"
    ERROR_VARIABLE MATVIZ_ERROR
    RESULT_VARIABLE MATVIZ_RETVAL
  )

print sys.args in the python script then tells me that there is one argument with spaces
[‚…py‘, ‚—res 2 --type bulk2d']

separate_arguments(MATVIZ_ARGS_LIST UNIX_COMMAND „${MATVIZ_ARGS}“)
COMMAND "${MATVIZ_PY}" "${MATVIZ_ARGS_LIST}"
does also not work, it delivers
[‚.…py‘, '--res;2;--type;bulk2d']

Trying various ways did not help.

I do not know in advance how many arguments my MATVIZ_ARGS will hold.

Is there a way to achieve it? The only idea I have at the moment is to have a small python script
that gets all arguments in one argument and does a system call via python but I would prefer a 
clean cmake solution.

Thank you very much for any suggestion,

Fabian



More information about the CMake mailing list