[CMake] Access denied error with cmake 3.1.1 -E env option (MSVC 11)

dannyboy dan.zadeh at pathcore.ca
Sun Feb 8 02:32:05 EST 2015


Hello,

I recently discovered the "cmake -E env" option in the newly released 3.1
version of CMake. Fantastic contribution, thank you to all involved! This is
a great feature that is very useful for ExternalProject_Add as other have
pointed out.

However, I have now spent the better part of a day trying to recover from a
vague "Access is denied" error in Visual Studios while trying to use this
new feature. Any advice or helpful hints would be greatly appreciated.

Here is some code to demonstrate my issue. Everything goes smoothly until
the build command executes.

//
// ... other decelerations excluded for brevity
//

  FILE(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}/resources/windows" nasm_path )
  SET( env_paths "$ENV{PATH};${nasm_path}" )

  ExternalProject_Add( libjpeg
      PREFIX ${jpeg_prefix}
      URL ${jpeg_file}
      URL_MD5 ${jpeg_md5}
      PATCH_COMMAND ""
      BUILD_IN_SOURCE 1
      CONFIGURE_COMMAND
        COMMAND ${CMAKE_COMMAND} -E chdir ${jpeg_source}
                       ${CMAKE_COMMAND} -G "NMake Makefiles"
                                                    
-DCMAKE_BUILD_TYPE=Release ${jpeg_source}
      BUILD_COMMAND
        COMMAND ${CMAKE_COMMAND} -E chdir ${jpeg_source}
                      ${CMAKE_COMMAND} -E env "PATH=${env_paths}" nmake /f
Makefile

      INSTALL_COMMAND ""
      )

//
//  end of snippet
//


//
// Build output - cleaned up for brevity
//

2>------ Build started: Project: libjpeg
(ExternalProjectTargets\libjpeg\libjpeg), Configuration: RelWithDebInfo
Win32 ------
.
.
2>  Performing download step (download, verify and extract) for 'libjpeg'
.
.
2>  Performing configure step for 'libjpeg'
.
.
2>  Performing build step for 'libjpeg'
2>  Access is denied
2>  
2>C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(172,5):
error MSB6006: "cmd.exe" exited with code 1.
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


//
// Note 1: also tried this variant of the BUILD_COMMAND without success
//

      BUILD_COMMAND
        COMMAND ${CMAKE_COMMAND} -E chdir ${jpeg_source}
                       ${CMAKE_COMMAND} -E env "PATH=\"${env_paths}\"" nmake
/f Makefile


   which produces a difference but more promising error: "The system cannot
find the file specified", indicating there is a problem with escaping.....



//
// Note 2: Removing -E env option, the build command executes but ultimately
fails because the required components are not found
// 

//
// Note 3: Tried running VS in administrator mode without success
//



--
View this message in context: http://cmake.3232098.n2.nabble.com/Access-denied-error-with-cmake-3-1-1-E-env-option-MSVC-11-tp7589722.html
Sent from the CMake mailing list archive at Nabble.com.


More information about the CMake mailing list