[cmake-developers] VS custom commands with VS variable containing space in executable path?

Robert Goulet Robert.Goulet at autodesk.com
Fri Aug 26 13:57:03 EDT 2016


Thanks, this worked:

COMMAND ${CMAKE_COMMAND} -E env "\"$(WindowsSdkDir)/bin/x64/makecert.exe\"" ...

I still believe that what I was trying to do was perfectly valid in the sense that it is using a VS environment variable $(WindowsSdkDir) that is not defined in the system environment variable, thus it exist only when command is executed from within VS. Normally we do use find_program(...) but this doesn't apply for this case because VS environment variables such as $(WindowsSdkDir) won't resolve outside of VS.

Thanks!

-----Original Message-----
From: Brad King [mailto:brad.king at kitware.com] 
Sent: Friday, August 26, 2016 1:30 PM
To: Robert Goulet <Robert.Goulet at autodesk.com>
Cc: cmake-developers at cmake.org
Subject: Re: [cmake-developers] VS custom commands with VS variable containing space in executable path?

On 08/26/2016 12:43 PM, Robert Goulet wrote:
>       COMMAND "$(WindowsSdkDir)/bin/x64/makecert.exe"
> 
> So how do we setup a custom command that uses a Visual Studio variable 
> that requires to be quoted to preserve spaces?

I don't think it is supported.  You could try adding a wrapper around the call so that it appears as an argument instead of in the command.

  COMMAND ${CMAKE_COMMAND} -E env "$(WindowsSdkDir)/bin/x64/makecert.exe" ...

OTOH you're trying to pierce CMake's abstract model of a command (which is why it's not supported).  Instead you could find_program the tools you need and reference them by absolute path.

-Brad



More information about the cmake-developers mailing list