I installed msys2 on Windows10 and some packages (like toolchain, cmake, ninja and others) in UCRT64 environment. I use VSCode and CMakeTools for build and run c++ projects. When I start the build process in VSCode, the process stops with errors:
[main] Configuring project: prova gtk4
[proc] Executing command: C:\msys64\ucrt64\bin\cmake.EXE --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=C:\msys64\ucrt64\bin\gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\msys64\ucrt64\bin\g++.exe "-SC:/Users/archi/progetti_C++/prova gtk4" "-Bc:/Users/archi/progetti_C++/prova gtk4/build_Release" -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] CMake Error at CMakeLists.txt:6 (project):
[cmake] Running
[cmake]
[cmake] 'C:/msys64/mingw64/bin/ninja.exe' '--version'
[cmake]
[cmake] failed with:
[cmake]
[cmake] The system cannot find the file specified
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
[proc] The command: C:\msys64\ucrt64\bin\cmake.EXE --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=C:\msys64\ucrt64\bin\gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\msys64\ucrt64\bin\g++.exe "-SC:/Users/archi/progetti_C++/prova gtk4" "-Bc:/Users/archi/progetti_C++/prova gtk4/build_Release" -G Ninja exited with code: 1
CMakeLists.txt:
cmake_minimum_required(VERSION 3.10.0 FATAL_ERROR)
set(project_name "ProveGTKMM4")
project(${project_name})
set(CMAKE_CXX_STANDARD 20)
# ottengo tutti i sorgenti
file(GLOB my_sources *.cpp *.h)
# aggiungo eseguibile
add_executable(${project_name} ${my_sources})
# verifico l'esistenza delle librerie gtk4 necessarie
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTKMM REQUIRED IMPORTED_TARGET gtkmm-4.0 glibmm-2.68)
# collego le librerie con l'eseguibile
target_link_libraries(${project_name} PRIVATE PkgConfig::GTKMM)
The directory "C:/msys64/ucrt64/bin" is in the environment variable PATH, unlike "C:/msys64/mingw64/bin". In the environment variable PATH there is the directory "C:/msys64/usr/bin" too. Moreover, I had installed the packages in MINGW64 environment before I installed the same packages in UCRT64 environment.
I want to force Cmake to find Ninja in directory "C:/msys64/ucrt64/bin".