I am USing cmake 3.14, and part of the script it's calling another python script and giving it the build path as an argument but the python doesn't receive this argument
set(arg ${CMAKE_BINARY_DIR})
add_custom_command(TARGET res POST_BUILD
COMMAND ${PYTHON_TEST} ${CMAKE_BINARY_DIR}/../script.py ${arg}
DEPENDS ${arg}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Generating results"
)
python log :
Traceback (most recent call last):
File "script.py", line 8, in <module>
BuildPath = sys.argv[1]
IndexError: list index out of range
of course the python script is running ok if called from CMD .. when i looked on the cmake documentation it says it's ignoring the arguments indeed but i didn't understand what's to be done to pass arguments?

PYTHON_TEST? What does themessage("COMMAND ${PYTHON_TEST} ${CMAKE_BINARY_DIR}/../script.py ${arg}")command print, if inserted directly befor theadd_custom_command? What's the commandcmake --build ... --verboseprints?add_custom_commanddoesn't support DEPENDS keyword. You won't find that keyword in the documentation for that command flow.