Hello,

I am trying to use a custom command to generate test certificate for a 
Universal Windows Platform app, and I can't find how to properly quote the 
executable paths from CMake. Here is how we add the custom command:

set(WIN64UWP_CERT_NAME "${PROJECT_NAME}_TemporaryKey")
add_custom_command(
OUTPUT "${PROJECT_BINARY_DIR}/${WIN64UWP_CERT_NAME}.pfx"
      COMMAND "$(WindowsSdkDir)/bin/x64/makecert.exe" -cy end -eku 
1.3.6.1.5.5.7.3.3 -r -n "CN=${PRODUCT_COMPANY}" -sv 
${RESOURCES_DIR}/${WIN64UWP_CERT_NAME}.pvk ${WIN64UWP_CERT_NAME}.cer
      COMMAND "$(WindowsSdkDir)/bin/x64/PVK2PFX.exe" -pvk 
${RESOURCES_DIR}/${WIN64UWP_CERT_NAME}.pvk -spc ${WIN64UWP_CERT_NAME}.cer -pfx 
${WIN64UWP_CERT_NAME}.pfx -f
            WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
            COMMENT "Generating Test Certificate..."
)

Because $(WindowsSdkDir) points within C:\Program Files\... Visual Studio is 
unable to execute these commands since the .vcxproj does not contain quotes 
around the executable paths.

First I tried using \" around the command, but CMake refuses to escape quotes 
on the command with error "COMMAND may not contain literal quotes".

Then I tried XML escaped character " but then CMake translate the ; as it 
if was a different element of an array surrounding both sides with quotes.

Then I tried %22 but CMake outputs % as %% in the vcxproj file.

So how do we setup a custom command that uses a Visual Studio variable that 
requires to be quoted to preserve spaces?

Thanks!
-- 

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

Reply via email to