FIND_PROGRAM on Windows
Brad King
brad.king at kitware.com
Tue May 9 15:02:05 CEST 2006
William A. Hoffman wrote:
> To put a value with spaces in the path in a variable in cmake, you
> must double quote it.
>
> set(SOMEPATH "c:/program files/foobar")
> set(PATHVAR "${SOMEPATH}")
Correction: to pass a string with *literal* spaces you need quotes:
set(SOMEPATH "c:/program files/foobar")
When passing a string through a variable you need quotes only if the
value contains semicolons, so this will work fine for paths:
set(PATHVAR ${SOMEPATH})
In this case even if SOMEPATH contains semicolons it will be split into
multiple arguments, passed to the "set" command, and then recomposed by
the command and stored in PATHVAR as a list with semicolons so the value
will not change anyway. For other commands the splitting on semicolons
may make a difference, such as the "string" command. In these cases
double-quoting ensures that the value is passed as a single argument and
not split.
-Brad
More information about the Kde-buildsystem
mailing list