[CMake] execute_process, cmd /c and vcvarsall

Adam Rankin arankin at robarts.ca
Thu Jun 9 16:41:13 EDT 2016


Hello all,

I am trying to develop a execute_process command that will first load the env variables set by the appropriate vcvarsall, and then run a compile command. See here for my progress so far:

set(cuda_generation_command cmd /c "\"call \"$ENV{VS${VS_IDE_VERSION}0COMNTOOLS}../../VC/vcvarsall.bat\" x86_amd64 && \"${CUDA_NVCC_EXECUTABLE}\" \"${OpenCV_SOURCE_DIR}/cmake/checks/OpenCVDetectCudaArch.cu\" \"--run\"\"")

execute_process( COMMAND ${cuda_generation_command}
                 WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/"
                 RESULT_VARIABLE _nvcc_res OUTPUT_VARIABLE _nvcc_out
                 OUTPUT_STRIP_TRAILING_WHITESPACE)

When run at a command prompt, the command works as expected. When called from CMake, the output is:
The filename, directory name, or volume label syntax is incorrect.

Has anyone ever succeeded with something like this?

Cheers,
Adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160609/db38e67b/attachment.html>


More information about the CMake mailing list