Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>CMake BetterNew to Visual Studio Code? Get it now.
CMake Better

CMake Better

luomo233

|
4 installs
| (0) | Free
Cross-platform CMake project wizard, dependency import, and toolchain management extension.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

CMake Better

CMake Better 是一个跨平台 VS Code 插件,提供接近 Visual Studio 的 CMake 项目体验:

  • 可视化新建 C++/CMake 项目(支持 C++11 及以上标准)
  • 一键导入第三方库(支持“库名 + 库目录”自动配置)
  • 一键下载安装当前平台工具链(GCC + GDB + CMake + Ninja)
  • 构建/运行/调试统一使用插件配置的工具链目录
  • 检测系统切换并提示重新链接依赖

开发

npm install
npm run compile

按 F5 启动扩展调试主机。

打包 VSIX

npm run package

第三方库导入(推荐流程)

  1. 点击 导入第三方库
  2. 选择 按库目录自动配置 (推荐)
  3. 输入库名称
  4. 选择库根目录
  5. 插件自动识别 include/lib/Config.cmake 并写入 CMakeLists.txt

若自动识别失败,可选择 高级手动配置。

工具链安装与使用

  1. 点击 安装工具链
  2. 选择安装位置
  3. 插件自动下载并解压当前平台工具链
  4. 安装完成后自动写入 cmakeBetter.toolchainInstallDir
  5. 安装成功后自动清理下载缓存(.downloads/.staging)

工具链目录会按平台生成子目录,例如:

  • <installDir>/cmake-better-toolchains/win32-x64
  • <installDir>/cmake-better-toolchains/linux-x64
  • <installDir>/cmake-better-toolchains/darwin-arm64
  • <installDir>/cmake-better-toolchains/darwin-x64

后续构建、运行、调试将优先使用该目录,不依赖系统默认编译器。

macOS 上 gdb 可能需要额外 codesign,详见: https://sourceware.org/gdb/wiki/PermissionsDarwin

下载镜像源

工具链下载支持镜像回退,配置项:

  • cmakeBetter.toolchainMirrorSource = auto(默认):清华 -> 中科大 -> 官方
  • cmakeBetter.toolchainMirrorSource = tuna:清华优先,再回退中科大、官方
  • cmakeBetter.toolchainMirrorSource = ustc:中科大优先,再回退清华、官方
  • cmakeBetter.toolchainMirrorSource = official:只使用官方源

说明:

  • GitHub Release 资源会按上述顺序尝试镜像 URL,失败自动回退。
  • Homebrew formula 元数据优先使用清华/中科大的 API 镜像,失败回退官方。
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft