microsoft / microsoft/vscode-cmake-tools

[Feature] preset implements generator toolset

Open
#4,513 3 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

### Request Overview

I am trying to do some testing using Intel's `ifx` compiler. The default compiler is `ifort`.

Here is my preset:

```
"configurePresets": [
{
"name": "windows-ifx-debug",
"displayName": "Windows IFX Debug",
"description": "Debug build with Intel ifx on Windows",
"binaryDir": "${sourceDir}/build/windows-ifx-debug",
"generator": "Visual Studio 17 2022",
"cacheVariables": {
"CMAKE_Fortran_COMPILER": "ifx",
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_Fortran_FLAGS": "/nologo /extend-source:132 /fpp /standard-semantics /stand:f18 /libs:static /c /heap-arrays:512",
"CMAKE_Fortran_FLAGS_DEBUG": "/O0 /debug:full /warn:all /debug-parameters:all /check:stack /check:all /traceback /dbglibs /fpe:precise /simd-"
},
"toolset": {
"value": "fortran=ifx"
}
},
```

When I use the GUI to select the preset and `Configure`, I see this:

```
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" "-DCMAKE_Fortran_COMPILER=C:/Program Files (x86)/Intel/oneAPI/compiler/2023.1.0/windows/bin/ifx.exe" -DCMAKE_BUILD_TYPE=Debug "-DCMAKE_Fortran_FLAGS=/nologo /extend-source:132 /fpp /standard-semantics /stand:f18 /libs:static /c /heap-arrays:512" "-DCMAKE_Fortran_FLAGS_DEBUG=/O0 /debug:full /warn:all /debug-parameters:all /check:stack /check:all /traceback /dbglibs /fpe:precise /simd-" -S C:/Users/John.Runburg/Projects/ArrayAwarenessTool -B C:/Users/John.Runburg/Projects/ArrayAwarenessTool/build/windows-ifx-debug -G "Visual Studio 17 2022"
[cmake] -- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.26100.
[cmake] -- The Fortran compiler identification is Intel 2021.9.0.20230302
[cmake] -- Detecting Fortran compiler ABI info
[cmake] -- Detecting Fortran compiler ABI info - done
[cmake] -- Determine Intel Fortran Compiler Implicit Link Path
[cmake] -- Determine Intel Fortran Compiler Implicit Link Path - done
[cmake] -- Check for working Fortran compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/2023.1.0/windows/bin/intel64/ifort.exe - skipped
[cmake] -- Configuring done (16.0s)
[cmake] -- Generating done (0.2s)
[cmake] CMake Warning:
[cmake] Manually-specified variables were not used by the project:
[cmake]
[cmake] CMAKE_BUILD_TYPE
```
This *does not* use the correct compiler. It falls back to `ifort`.

But when I manually invoke the preset, I get:

```
C:\Users\John.Runburg\Projects\ArrayAwarenessTool>cmake --preset windows-ifx-debug -S . -B build/windows-ifx-debug
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.26100.
-- The Fortran compiler identification is IntelLLVM 2023.1.0 with MSVC-like command-line
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Determine Intel Fortran Compiler Implicit Link Path
-- Determine Intel Fortran Compiler Implicit Link Path - done
-- Check for working Fortran compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/2023.1.0/windows/bin/ifx.exe - skipped
-- Configuring done (15.8s)
-- Generating done (0.1s)
CMake Warning:
Manually-specified variables were not used by the project:

CMAKE_BUILD_TYPE

```

This correctly uses `ifx`. How can I get this behavior through the VS Code extension?

Contributor guide

Open the contributing guide

Research direction

Start by comparing the VS Code extension's Configure command with the manual `cmake --preset windows-ifx-debug` invocation shown in the report. Trace how the extension translates the preset's `toolset` and compiler settings into its command, then verify the fix by configuring through the extension and confirming that `ifx.exe`, rather than `ifort.exe`, is selected.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, typescript
Domain
build-system, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.