[CMake] [BUG?] Setting environment variables with embedded blanks does not work with VERBATIM

Brad King brad.king at kitware.com
Wed Jan 6 12:48:59 EST 2010


On 1/3/2010 2:44 PM, Alan W. Irwin wrote:
> The PLplot test system assumes bash (either normal bash or win-bash) is
> available and uses environment variables specified on the command line.

CMake does not assume this.  We generate portable shell syntax.

> To solve this issue, VERBATIM should simply put the quotes around
> everything after the equal sign when there are embedded blanks, e.g.,
>
> DUMMY="/home/software/plplot svn/HEAD/build_dir/examples" printenv DUMMY

The command has no special knowledge of this shell syntax extension.
There is now way for it to know how to do this.

VERBATIM is documented to quote each argument so that it parses into
an argv[] array exactly.  It is doing that.  This is not a bug.

> is there some better way (other than the
> above clumsy non-VERBATIM workaround) to deal with embedded blanks in bash
> variable assignment statements?

VERBATIM COMMAND env DUMMY=${CMAKE_CURRENT_BINARY_DIR} printenv DUMMY
                  ^^^ more portable version of syntax

-Brad


More information about the CMake mailing list