The configuration provider sends msvc intelliSenseMode for IAR compiler
See original GitHub issueBrief Issue Summary
When a compiler cmake-tools is not familiar with is used by CMake (e.g. an embedded compiler with a custom toolchain file), it ignores all other settings and defaults to the MSVC Intellisense mode on Windows. This is usually undesirable, since embedded code is not generally compatible with MSVC.
Expected:
There should be a way to manually override the intellisense settings on a project basis (possibly in cmake-kits.json?) so it can be used as a configuration provider even if the compiler being used by cmake is not supported.
C/C++ log file
In the log below it can be seen that the settings specified in c_cpp_properties.json are not respected and msvc intellisense mode is used when the IAR compiler is specified by a cmake toolchain.
-------- Diagnostics - 2/25/2020, 2:51:31 PM
Version: 0.26.3
Current Configuration:
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"${workspaceFolder}/drivers/Include/**",
"${workspaceFolder}/drivers/netx_drv/Include/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "C:\\Program Files (x86)\\GNU Tools Arm Embedded\\9 2019-q4-major\\bin\\arm-none-eabi-gcc.exe",
"intelliSenseMode": "gcc-x64",
"compilerArgs": [
"-mthumb ",
"-mcpu=cortex-m4"
],
"configurationProvider": "vector-of-bool.cmake-tools",
"browse": {
"path": [
"${workspaceFolder}/**",
"${workspaceFolder}/drivers/Include/**",
"${workspaceFolder}/drivers/netx_drv/Include/**"
],
"limitSymbolsToIncludedHeaders": true
}
}
Translation Unit Configurations:
[ C:\Users\pfox\ESeries\Firmware\firmware\CMSIS\Include\cmsis_iccarm.h ]:
Process ID: 28372
Memory Usage: 16 MB
Compiler Path: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe
Includes:
C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.24.28314/include/*
C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.24.28314/atlmfc/include/*
C:/Program Files (x86)/Windows Kits/10/Include/10.0.18362.0/um
C:/Program Files (x86)/Windows Kits/10/Include/10.0.18362.0/ucrt
C:/Program Files (x86)/Windows Kits/10/Include/10.0.18362.0/shared
C:/Program Files (x86)/Windows Kits/10/Include/10.0.18362.0/winrt
C:/Program Files (x86)/Windows Kits/10/Include/10.0.18362.0/cppwinrt
Standard Version: ms_c++17
IntelliSense Mode: msvc-x64
Other Flags:
--header_only_fallback
Total Memory Usage: 16 MB
Other Notes/Information
Clang may be a better fallback if the compiler can’t be identified, since it’s probably the most broadly compatible.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:11 (6 by maintainers)
Top GitHub Comments
What you may need to do for the time being is use
compile_commands.json
instead of the configuration provider. CMake Tools should generate this file for you. When you usecompile_commands.json
, you can override the compiler with the value incompilerPath
and hopefully that will get things to start working for you until we come up with a plan for IAR.Sorry, yes, I actually did try to specify the arm-none-eabi-gcc compiler in my c_cpp_properties.json in hopes that it would use that as a fallback, but it only appears to do that sometimes.
It looks like if I change that after doing the CMake config, it takes until the next time I configure or reopen VS Code, so I think cmake-tools is overriding that setting with the IAR compiler path, which doesn’t configure correctly.
What I’d like to be able to do is to have cmake-tools fall back to a manual configuration for the compiler if the compiler is not supported instead of pushing an unsupported config which will break Intellisense.