-
Notifications
You must be signed in to change notification settings - Fork 468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] Generate WRONG configurePresets of Clang or GCC compilers on Windows. #2773
Comments
About MinGW compilers, I found a successfull template for reference, which comes from this topic in CMake Discourse. {
"version": 5,
"configurePresets": [
{
"name": "win32-gcc-x64-mingw-debug",
"displayName": "Windows GCC x64 (MinGW Makefiles) Debug",
"description": "Using GCC x64 compiler with \"MinGW Makefiles\" geneartor on Windows - Debug",
"generator": "MinGW Makefiles",
"binaryDir": "${sourceDir}/build/${presetName}",
"installDir": "${sourceDir}/install/${presetName}",
"environment": {
"PATH": "C:/msys64/mingw64/bin;$penv{PATH}"
},
"cacheVariables": {
"CMAKE_C_COMPILER": "gcc.exe",
"CMAKE_CXX_COMPILER": "g++.exe",
"CMAKE_BUILD_TYPE": "Debug"
}
}
],
"buildPresets": [
{
"name": "win32-gcc-x64-mingw-debug",
"displayName": "Windows GCC x64 (MinGW Makefiles) Debug",
"configurePreset": "win32-gcc-x64-mingw-debug"
}
]
} |
Thank you for reporting this issue. I can reproduce this issue. We will work on a fix for it. |
Besides the cache variables "environment": {
"PATH": "C:/msys64/mingw64/bin;$penv{PATH}"
}, |
The following is the Configure Preset generated by selecting MinGW compiler after updating CMake Tools to version v1.13.14. Click to expand{
"version": 4,
"configurePresets": [
{
"name": "win32-gcc-x64",
"displayName": "GCC 12.2.0 x86_64-w64-mingw32",
"description": "Using compilers: C = C:\\msys64\\mingw64\\bin\\gcc.exe, CXX = C:\\msys64\\mingw64\\bin\\g++.exe",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"cacheVariables": {
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}",
"CMAKE_C_COMPILER": "C:\\msys64\\mingw64\\bin\\gcc.exe",
"CMAKE_CXX_COMPILER": "C:\\msys64\\mingw64\\bin\\g++.exe",
"CMAKE_BUILD_TYPE": "Debug"
}
}
]
} However, it's still NOT working. After some analysis, I sum up the following problems:
Since we already add {
"version": 4,
"configurePresets": [
{
"name": "win32-gcc-x64",
"displayName": "GCC 12.2.0 x86_64-w64-mingw32",
"description": "Using compilers: C = C:\\msys64\\mingw64\\bin\\gcc.exe, CXX = C:\\msys64\\mingw64\\bin\\g++.exe",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"generator": "MinGW Makefiles",
"environment": {
"PATH": "C:/msys64/mingw64/bin;$env{PATH}"
},
"cacheVariables": {
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}",
"CMAKE_C_COMPILER": "gcc.exe",
"CMAKE_CXX_COMPILER": "g++.exe",
"CMAKE_BUILD_TYPE": "Debug"
}
}
]
} And the following is its Debug Log: Click to expand the Debug Log[main] Configuring folder: cmake-preset-mingw
[main] Saving open files before configure/build
[driver] Start configure
[driver] Running pre-configure checks and steps
[cmakefileapi-driver] Configuring using preset
[cmakefileapi-driver] Invoking CMake C:\Program Files\CMake\bin\cmake.EXE with arguments ["-DCMAKE_INSTALL_PREFIX=F:/GitRepo/cmake-preset-mingw/out/install/win32-gcc-x64","-DCMAKE_C_COMPILER=gcc.exe","-DCMAKE_CXX_COMPILER=g++.exe","-DCMAKE_BUILD_TYPE=Debug","-SF:/GitRepo/cmake-preset-mingw","-BF:/GitRepo/cmake-preset-mingw/out/build/win32-gcc-x64","-G","MinGW Makefiles"]
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" -DCMAKE_INSTALL_PREFIX=F:/GitRepo/cmake-preset-mingw/out/install/win32-gcc-x64 -DCMAKE_C_COMPILER=gcc.exe -DCMAKE_CXX_COMPILER=g++.exe -DCMAKE_BUILD_TYPE=Debug -SF:/GitRepo/cmake-preset-mingw -BF:/GitRepo/cmake-preset-mingw/out/build/win32-gcc-x64 -G "MinGW Makefiles"
[cmake] -- The C compiler identification is GNU 12.2.0
[cmake] -- The CXX compiler identification is GNU 12.2.0
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - done
[cmake] -- Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe - skipped
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Check for working CXX compiler: C:/msys64/mingw64/bin/g++.exe - skipped
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- Configuring done
[cmake] -- Generating done
[cmake] -- Build files have been written to: F:/GitRepo/cmake-preset-mingw/out/build/win32-gcc-x64
[cmakefileapi-parser] Read reply folder: F:\GitRepo\cmake-preset-mingw\out\build\win32-gcc-x64\.cmake\api\v1\reply
[cmakefileapi-parser] Found index files: ["cache-v2-a9b629d3a8a3b327cc3a.json","cmakeFiles-v1-00b762bd79c67dad4fc4.json","codemodel-v2-2cab838cc85a14464811.json","directory-.-Debug-d0094a50bb2071803777.json","index-2022-10-19T04-36-24-0397.json","toolchains-v1-754e0fc8575f63e75ef2.json"]
[cache] Reading CMake cache file F:/GitRepo/cmake-preset-mingw/out/build/win32-gcc-x64/CMakeCache.txt
[cache] Parsing CMake cache string
[extension] [8073] cmake.configure finished (returned 0) |
Brief Issue Summary
I typed "CMake: Add Configure Preset" in the command palette, and choose "Create from Compilers", and then choose GCC or Clang compilers that I installed. However, the generated
configurePreset
seems NOT suitable and NOT usable.Environments and Versions
CMake Tools Diagnostics
No response
Debug Log
No response
Additional Information
For example,
CMAKE_C_COMPILER
andCMAKE_CXX_COMPILER
usecl.exe
.If I choose
Clang 12.0.0 (GNU CLI) for MSVC 16.11.32901.82 (Visual Studio Community 2019 Release - amd64)
, then it generates:If I choose
GCC 12.2.0 x86_64-w64-mingw32
, then it generates:Screenshots
The text was updated successfully, but these errors were encountered: