【CMake】1. VSCode 开发环境安装与运行

CMake 示例工程代码

https://github.com/LABELNET/cmake-simple

插件

使用 VSCode 开发C++项目,安装 CMake 插件

  • CMake
  • CMake Tools
  • CMake Language Support (建议,语法提示)

1. 配置

CMake Language Support , Windows 配置 donet 环境

这样 CMakeLists.txt 文件就有代码提示了

2. 工程目录

示例代码工程参考:https://github.com/LABELNET/cmake-simple

项目结构推荐使用下面格式

复制代码
$ .SIMPLE      
│   CMakeLists.txt                 # 项目根 CMakeLists.txt , 用于项目配置
│   README.md                      # 说明文档,无关
├───.vscode                        # 头文件路径配置
│       c_cpp_properties.json
├───cmake                          # 第三方依赖文件夹
├───build                          # CMake 编译输出
└───demo                           # 主模块
    │   CMakeLists.txt             # 主模块 CMakeLists.txt                    
    ├───include                    # 源码:头文件文件夹
    │       demo_utils.h
    └───src                        # 源码: 代码文件夹
            demo_utils.cc
            main.cc

3. 运行

点击 vscode 底部状态栏进行运行即可,Build 可进行 CMake 编译

相关推荐
NoteStream5 小时前
【c语言基础】C语言常见概念
c语言·开发语言·编辑器
布鲁飞丝10 小时前
从零实现富文本编辑器#-浏览器选区与编辑器选区模型同步
java·前端·编辑器
计算机内卷的N天11 小时前
CMake与Visual Studio的使用
c++·ide·visual studio
咱入行浅11 小时前
一款实用的 Visual Studio 发布部署插件,助力提高部署效率!
ide·visual studio
谢斯12 小时前
[vscode] 使用unity打开vscode的取消.csproj的显示
ide·vscode·unity
2501_916007471 天前
SwiftUI 声明式语法与 Xcode 预览功能详解
ide·vscode·ios·swiftui·个人开发·xcode·敏捷流程
呐抹倾1 天前
【译】Visual Studio 停用:针对旧版本 Visual Studio 的支持提醒
ide·visual studio
爱就是恒久忍耐1 天前
使用VSCode开发STM32 (通用版本)
ide·vscode·stm32
FlightYe1 天前
音视频修炼之视频基础(一):视频基础理论
android·c++·vscode·音视频·androidx·android runtime
我要见SA姐11 天前
VsCode 使用指南(配置 + 美化)
ide·vscode·编辑器