[Solved] cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:1104 (file): file failed to open for reading (Permission denied)

I have download cmake-3.31.4-windows-x86_64 here: Release v3.31.4 · Kitware/CMake · GitHub I unzipped it and I added the bin path to the PATH: E:\Program Files\cmake-3.31.4-windows-x86_64\bin

I try to config my project but I see the following errors and this message:

image

Errors:

>config-win

E:\_Projects\OpenGL\SDL3\hagrid\hagrid-hip-hop-dancing-web-win-opengles20-sdl3-cpp>cmake -G "MinGW Makefiles" -S . -B dist/win -Dpugixml_DIR=E:/libs/pugixml-1.14-prefix/win/lib/cmake/pugixml -DSDL3_DIR=E:/libs/sdl-3.1.6-prefix/win/lib/cmake/SDL3 -DCMAKE_BUILD_TYPE=Debug
CMake Error at E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:977 (file):
  file STRINGS file
  "E:/_Projects/OpenGL/SDL3/hagrid/hagrid-hip-hop-dancing-web-win-opengles20-sdl3-cpp/dist/win/CMakeFiles/3.31.4/CompilerIdC/a.exe"
  cannot be read.
Call Stack (most recent call first):
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:13 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCCompiler.cmake:123 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:3 (project)


CMake Error at E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:1091 (file):
  file failed to open for reading (Permission denied):

    E:/_Projects/OpenGL/SDL3/hagrid/hagrid-hip-hop-dancing-web-win-opengles20-sdl3-cpp/dist/win/CMakeFiles/3.31.4/CompilerIdC/a.exe
Call Stack (most recent call first):
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:13 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCCompiler.cmake:123 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:3 (project)


CMake Error at E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:1094 (string):
  string begin index: 1 is out of range 0 - 0
Call Stack (most recent call first):
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:13 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCCompiler.cmake:123 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:3 (project)


CMake Error at E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:1102 (math):
  math cannot parse the expression: " * 16 + ": syntax error, unexpected
  exp_TIMES (2).
Call Stack (most recent call first):
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:13 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCCompiler.cmake:123 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:3 (project)


CMake Error at E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:1104 (file):
  file failed to open for reading (Permission denied):

    E:/_Projects/OpenGL/SDL3/hagrid/hagrid-hip-hop-dancing-web-win-opengles20-sdl3-cpp/dist/win/CMakeFiles/3.31.4/CompilerIdC/a.exe
Call Stack (most recent call first):
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:13 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCCompiler.cmake:123 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:3 (project)


CMake Error at E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:1153 (file):
  file failed to open for reading (Permission denied):

    E:/_Projects/OpenGL/SDL3/hagrid/hagrid-hip-hop-dancing-web-win-opengles20-sdl3-cpp/dist/win/CMakeFiles/3.31.4/CompilerIdC/a.exe
Call Stack (most recent call first):
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:13 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCCompiler.cmake:123 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:3 (project)


-- The C compiler identification is GNU 14.2.0
CMake Error at E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:977 (file):
  file STRINGS file
  "E:/_Projects/OpenGL/SDL3/hagrid/hagrid-hip-hop-dancing-web-win-opengles20-sdl3-cpp/dist/win/CMakeFiles/3.31.4/CompilerIdCXX/a.exe"
  cannot be read.
Call Stack (most recent call first):
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:13 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCXXCompiler.cmake:126 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:3 (project)


CMake Error at E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:1091 (file):
  file failed to open for reading (Permission denied):

    E:/_Projects/OpenGL/SDL3/hagrid/hagrid-hip-hop-dancing-web-win-opengles20-sdl3-cpp/dist/win/CMakeFiles/3.31.4/CompilerIdCXX/a.exe
Call Stack (most recent call first):
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:13 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCXXCompiler.cmake:126 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:3 (project)


CMake Error at E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:1094 (string):
  string begin index: 1 is out of range 0 - 0
Call Stack (most recent call first):
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:13 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCXXCompiler.cmake:126 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:3 (project)


CMake Error at E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:1102 (math):
  math cannot parse the expression: " * 16 + ": syntax error, unexpected
  exp_TIMES (2).
Call Stack (most recent call first):
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:13 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCXXCompiler.cmake:126 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:3 (project)


CMake Error at E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:1104 (file):
  file failed to open for reading (Permission denied):

    E:/_Projects/OpenGL/SDL3/hagrid/hagrid-hip-hop-dancing-web-win-opengles20-sdl3-cpp/dist/win/CMakeFiles/3.31.4/CompilerIdCXX/a.exe
Call Stack (most recent call first):
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:13 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)
  E:/Program Files/cmake-3.31.4-windows-x86_64/share/cmake-3.31/Modules/CMakeDetermineCXXCompiler.cmake:126 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:3 (project)


-- The CXX compiler identification is GNU 14.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/mingw64/bin/cc.exe
-- Check for working C compiler: C:/mingw64/bin/cc.exe - works
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: C:/mingw64/bin/c++.exe
-- Check for working CXX compiler: C:/mingw64/bin/c++.exe - works
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring incomplete, errors occurred!

When I disable antivirus it works without problems.

My solution is to add the path to the build folder to the exclusions:

image

The better way is to add a more general path to the exclusions:

image