[CMake] passing a list to a CMake script

Philippe Poilbarbe Philippe.Poilbarbe at cls.fr
Thu Jul 13 05:58:48 EDT 2006


Sylvain Benner a écrit :
> Hi,
>
>> ${CMAKE_COMMAND} -DMYLIST="${whatever}" -P myscript.cmake
>>
>> MYLIST comes through as a string.  In myscript.cmake, I've been 
>> reconstructing the string into a list, on the risky assumption that 
>> blank spaces " "should be converted to semicolons ";" .  Is there a 
>> cleaner way to pass a list to a CMake script?
>
> You can check this command SEPARATE_ARGUMENTS :
>
> SEPARATE_ARGUMENTS
> ...
>        Convert the value of VARIABLE to a  semi-colon  separated  list.
>        All  spaces  are  replaced with ';'.  This helps with generating
>        command lines.
>
> Sylvain
Except when you give paths with spaces in them (typically containing 
"Program Files"
under windows or some KDE directories)

Philippe


More information about the CMake mailing list