Hello,

I'm trying to pass multiple arguments to a python script. The last arguments
are file names that are already in a cmake list (semicolon seperated
string).
Is it possible to pass the elements in this list to the python script as
separate arguments?

------------------
SET( sources s1.cpp s2.cpp s3.cpp )
SET( arguments "-c 2" )

#Add the source files
FOREACH( cpp ${sources } )
    SET( arguments "${arguments} ${cpp}" )
ENDFOREACH( cpp )
add_custom_command( TARGET test COMMAND "script.py" "${arguments}" )
--------------------

The above cmake script will call script.py with the "-c 2 s1.cpp s2.cpp
s3.cpp" as a single argument instead of 5 individual arguments

Manually typing them out as individual strings does solve the problem but
would be impractical:
add_custom_command( TARGET test COMMAND "script.py" "-c" "5" "s1.cpp"
"s2.cpp" )

Any help would be greatly appreciated,

Iman
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to