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.k...@kitware.com] Sent: Friday, August 26, 2016 1:30 PM To: Robert Goulet <robert.gou...@autodesk.com> Cc: cmake-developers@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 -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers