vscode-cmake-tools: Intellisense fails to find Qt header files
Brief Issue Summary
cmake-tools fails to find Qt header files. It appears to be sending an empty browsePath to cpp-tools
To reproduce on macOS 11.6.2 with Xcode 13.2.1:
$ git clone git@github.com:rectalogic/vscode-cmake.git
$ cd vscode-cmake
$ ./install-qt  # this requires python3, e.g. from brew
Then open vscode-cmake in vscode and configure cmake-tools.
vscode can successfully build the project, but if you open main.cpp it fails to find the Qt <QApplication> header.

CMake Tools Diagnostics
{
  "os": "darwin",
  "vscodeVersion": "1.63.2",
  "cmtVersion": "1.9.2",
  "configurations": [
    {
      "folder": "/Users/aw/Projects/rectalogic/vscode-cmake",
      "cmakeVersion": "3.22.1",
      "configured": true,
      "generator": "Ninja",
      "usesPresets": false,
      "compilers": {
        "C": "/usr/bin/clang",
        "CXX": "/usr/bin/clang++"
      }
    }
  ],
  "cpptoolsIntegration": {
    "isReady": true,
    "hasCodeModel": true,
    "activeBuildType": "Debug",
    "buildTypesSeen": [
      "Debug"
    ],
    "requests": [
      "file:///Users/aw/Projects/rectalogic/vscode-cmake/main.cpp"
    ],
    "responses": [
      {
        "uri": "file:///Users/aw/Projects/rectalogic/vscode-cmake/main.cpp",
        "configuration": {
          "defines": [
            "QT_CORE_LIB",
            "QT_GUI_LIB",
            "QT_WIDGETS_LIB"
          ],
          "standard": "gnu++17",
          "includePath": [
            "/users/aw/projects/rectalogic/vscode-cmake/build/main_autogen/include",
            "/users/aw/projects/rectalogic/vscode-cmake/qt/6.2.2/macos/lib/qtcore.framework",
            "/users/aw/projects/rectalogic/vscode-cmake/qt/6.2.2/macos/lib/qtcore.framework/headers",
            "/users/aw/projects/rectalogic/vscode-cmake/qt/6.2.2/macos/mkspecs/macx-clang",
            "/users/aw/projects/rectalogic/vscode-cmake/qt/6.2.2/macos/include",
            "/users/aw/projects/rectalogic/vscode-cmake/qt/6.2.2/macos/lib/qtwidgets.framework",
            "/users/aw/projects/rectalogic/vscode-cmake/qt/6.2.2/macos/lib/qtwidgets.framework/headers",
            "/users/aw/projects/rectalogic/vscode-cmake/qt/6.2.2/macos/lib/qtgui.framework",
            "/users/aw/projects/rectalogic/vscode-cmake/qt/6.2.2/macos/lib/qtgui.framework/headers"
          ],
          "compilerPath": "/usr/bin/clang++",
          "compilerArgs": [
            "-g",
            "-isysroot",
            "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk",
            "-mmacosx-version-min=11.6",
            "-std=gnu++17"
          ]
        }
      }
    ],
    "partialMatches": [],
    "targetCount": 3,
    "executablesCount": 1,
    "librariesCount": 0,
    "targets": [
      {
        "name": "main",
        "type": "EXECUTABLE"
      },
      {
        "name": "main_autogen",
        "type": "UTILITY"
      },
      {
        "name": "main_autogen_timestamp_deps",
        "type": "UTILITY"
      }
    ]
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": true
    }
  ]
}
C/C++ Log Diagnostics
The Custom browse configuration has an empty browsePath, this may be the issue?
-------- Diagnostics - 1/13/2022, 6:20:38 PM
Version: 1.7.1
Current Configuration:
{
    "name": "Mac cmake",
    "configurationProvider": "ms-vscode.cmake-tools",
    "compilerPathIsExplicit": false,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": false,
    "intelliSenseModeIsExplicit": false,
    "includePath": [
        "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1",
        "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/include",
        "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include",
        "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include"
    ],
    "macFrameworkPath": [
        "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
    ],
    "compilerArgs": [],
    "cStandard": "c17",
    "cppStandard": "c++98",
    "intelliSenseMode": "macos-clang-x64",
    "mergeConfigurations": false,
    "compilerPath": "/usr/bin/clang",
    "browse": {
        "path": [
            "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1",
            "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/include",
            "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include",
            "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Custom browse configuration: 
{
    "browsePath": []
}
Custom configurations:
[ /Users/aw/Projects/rectalogic/vscode-cmake/main.cpp ]
{
    "defines": [
        "QT_CORE_LIB",
        "QT_GUI_LIB",
        "QT_WIDGETS_LIB"
    ],
    "standard": "gnu++17",
    "includePath": [
        "/users/aw/projects/rectalogic/vscode-cmake/build/main_autogen/include",
        "/users/aw/projects/rectalogic/vscode-cmake/qt/6.2.2/macos/lib/qtcore.framework",
        "/users/aw/projects/rectalogic/vscode-cmake/qt/6.2.2/macos/lib/qtcore.framework/headers",
        "/users/aw/projects/rectalogic/vscode-cmake/qt/6.2.2/macos/mkspecs/macx-clang",
        "/users/aw/projects/rectalogic/vscode-cmake/qt/6.2.2/macos/include",
        "/users/aw/projects/rectalogic/vscode-cmake/qt/6.2.2/macos/lib/qtwidgets.framework",
        "/users/aw/projects/rectalogic/vscode-cmake/qt/6.2.2/macos/lib/qtwidgets.framework/headers",
        "/users/aw/projects/rectalogic/vscode-cmake/qt/6.2.2/macos/lib/qtgui.framework",
        "/users/aw/projects/rectalogic/vscode-cmake/qt/6.2.2/macos/lib/qtgui.framework/headers"
    ],
    "compilerPath": "/usr/bin/clang++",
    "compilerArgs": [
        "-g",
        "-isysroot",
        "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk",
        "-mmacosx-version-min=11.6",
        "-std=gnu++17"
    ]
}
Translation Unit Mappings:
[ /Users/aw/Projects/rectalogic/vscode-cmake/main.cpp ]:
    /Users/aw/Projects/rectalogic/vscode-cmake/main.cpp
Translation Unit Configurations:
[ /Users/aw/Projects/rectalogic/vscode-cmake/main.cpp ]:
    Process ID: 34343
    Memory Usage: 4 MB
    Compiler Path: /usr/bin/clang++
    Includes:
        /Users/aw/Projects/rectalogic/vscode-cmake/build/main_autogen/include
        /Users/aw/Projects/rectalogic/vscode-cmake/qt/6.2.2/macos/lib/QtCore.framework
        /Users/aw/Projects/rectalogic/vscode-cmake/qt/6.2.2/macos/lib/QtCore.framework/Versions/A/Headers
        /Users/aw/Projects/rectalogic/vscode-cmake/qt/6.2.2/macos/mkspecs/macx-clang
        /Users/aw/Projects/rectalogic/vscode-cmake/qt/6.2.2/macos/include
        /Users/aw/Projects/rectalogic/vscode-cmake/qt/6.2.2/macos/lib/QtWidgets.framework
        /Users/aw/Projects/rectalogic/vscode-cmake/qt/6.2.2/macos/lib/QtWidgets.framework/Versions/A/Headers
        /Users/aw/Projects/rectalogic/vscode-cmake/qt/6.2.2/macos/lib/QtGui.framework
        /Users/aw/Projects/rectalogic/vscode-cmake/qt/6.2.2/macos/lib/QtGui.framework/Versions/A/Headers
        /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/include
        /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
    Frameworks:
        /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks
    Defines:
        QT_CORE_LIB
        QT_GUI_LIB
        QT_WIDGETS_LIB
    Standard Version: c++17
    IntelliSense Mode: macos-clang-x64
    Other Flags:
        --clang
        --clang_version=110000
Total Memory Usage: 4 MB
Debug Log
[main] Building folder: vscode-cmake 
[main] Saving open files before configure/build
[build] Starting build
[driver] Start build all
[proc] Executing command: /opt/local/bin/cmake --build /Users/aw/Projects/rectalogic/vscode-cmake/build --config Debug --target all -j 18 --
[build] [1/4  25% :: 0.509] Automatic MOC and UIC for target main
[build] [3/4  50% :: 0.644] Building CXX object CMakeFiles/main.dir/main_autogen/mocs_compilation.cpp.o
[build] [3/4  75% :: 2.144] Building CXX object CMakeFiles/main.dir/main.cpp.o
[build] [4/4 100% :: 2.329] Linking CXX executable main
[cmakefileapi-parser] Read reply folder: /Users/aw/Projects/rectalogic/vscode-cmake/build/.cmake/api/v1/reply
[cmakefileapi-parser] Found index files: ["cache-v2-db17aa5346b3063312c4.json","codemodel-v2-f9968e0ef990a41bb4f5.json","directory-.-Debug-f5ebdc15457944623624.json","index-2022-01-13T23-09-19-0193.json","target-main-Debug-e405c207129ca950dff6.json","target-main_autogen-Debug-71586aa8a38f069c3446.json","target-main_autogen_timestamp_deps-Debug-0c5f526a5cac1370cfef.json","toolchains-v1-248d8c0a238b331e6ecf.json"]
[driver] Run _refreshExpansions
[driver] Run _refreshExpansions cb
[cache] Reading CMake cache file /Users/aw/Projects/rectalogic/vscode-cmake/build/CMakeCache.txt
[cache] Parsing CMake cache string
[build] Build finished with exit code 0
[extension] [3702] cmake.build finished (returned 0)
About this issue
- Original URL
 - State: closed
 - Created 2 years ago
 - Comments: 16 (6 by maintainers)
 
@bobbrow Looks like that issue was recently resolved by a change to the CMake codemodel.
@rectalogic Thanks for pointing that out. We’ll work on incorporating the File API changes from CMake 3.27 in our 1.15 extension release.
This is my
c_cpp_properties.jsonand vscode can find<QApplication>and my version of cmake-tools is v1.13.45 and my qt is installed by homebrew.