本页内容

CMakeQt Creator 供应商预设

请在CMakePresets.jsonCMakeUserPresets.json 的“vendor ”部分中指定Qt Creator 首选项。

CMake 配置预设

下表总结了可用的预设。

预设描述阅读更多
AutorunCMake当您在项目中编辑CMakeLists.txt 配置文件时,会运行 CMake 以刷新项目信息。此外,在构建项目时也会刷新项目信息。查看 CMake 项目内容
AskBeforePresetsReload当您进入Build 并选择Reload CMake Presets 时,系统会在执行操作前进行确认。CMake 预设
AskReConfigureInitialParams当您选择“Re-configure with Initial Variables ”时,会在执行操作前进行确认。使用初始变量重新配置
PackageManagerAutoSetup设置Conanvcpkg包管理器,以便与 CMake 配合使用。在包管理器中使用 CMake
ShowAdvancedOptionsByDefault默认在Initial ConfigurationCurrent Configuration 中显示所有CMake变量。查看高级变量
ShowSourceSubfolders在“Projects ”视图中隐藏子文件夹名称,并根据源组对文件进行排列。在“项目”视图中隐藏子文件夹名称
UseJunctionsForSourceAndBuildDirectories在 Windows 上,使用连接点(junction points)进行 CMake 的配置、构建和安装操作。在 Windows 上使用连接点

CMake 配置预设示例:

"vendor": {
  "qt.io/QtCreator/1.0": {
    "AskBeforePresetsReload": false,
    "AskReConfigureInitialParams": false,
    "AutorunCMake": false,
    "PackageManagerAutoSetup": false,
    "ShowAdvancedOptionsByDefault": true,
    "ShowSourceSubFolders": false,
    "UseJunctionsForSourceAndBuildDirectories": true
  }
}

编译器预设

下表总结了可用的预设。

有关编译器首选项的更多信息,请参阅“添加编译器”。

预设描述
cC 编译器的安装文件夹路径。
cxxC++ 编译器安装文件夹的路径。

Qt Creator 编译器预设示例:

"vendor": {
  "qt.io/QtCreator/1.0": {
    "compiler": {
      "c" : "$env{HOME}/llvm/mac/bin/clang",
      "cxx" : "$env{HOME}/llvm/mac/bin/clang++"
    }
  }
}

调试器预设

下表总结了可用的预设。

有关调试器首选项的更多信息,请参阅“添加调试器”。

预设描述
Abis以逗号分隔的系统架构定义列表。
Binary调试器可执行文件的路径。可以是绝对路径、值auto 或 ABI。当Qt Creator 无法识别二进制文件路径时,用于为 MSVC 工具链查找合适的调试器。
DisplayName调试器的名称。
EngineType调试器引擎类型:
  • 1 表示 GDB
  • 4 表示 CDB
  • 8 表示 PDB
  • 256 表示 LLDB
  • 512 表示 GDB DAP
  • LLDB DAP 为 1024
  • uVision 调试器:4096
Version调试器的版本号。

Qt Creator 调试器预设示例:

"vendor": {
  "qt.io/QtCreator/1.0": {
    "debugger": {
      "DisplayName": "GNU gdb 11.2.0 for MinGW 11.2.0 64-bit",
      "Abis": ["x86-windows-msys-pe-64bit"],
      "Binary": "C:/Qt/Tools/mingw1120_64/bin/gdb.exe",
      "EngineType": 1,
      "Version": "11.2.0"
    }
  }
}

Qt 版本预设

下表总结了可用的预设。

有关 Qt 版本首选项的更多信息,请参阅“添加 Qt 版本”。

预设描述
qtQt 安装文件夹的路径。

Qt Creator Qt XML 版本预设的示例:

"vendor": {
  "qt.io/QtCreator/1.0": {
    "qt": "$env{HOME}/Qt/6.11.0/macos/bin/qmake"
  }
}

另请参阅 《操作指南:使用 CMake 构建》、《使用 CMake 构建项目》、《CMake》、《CMake 预设》和《SDK 工具》。

Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.