首页 > 其他分享 >Tool-CMake-vscode-cmake-tools

Tool-CMake-vscode-cmake-tools

时间:2023-05-27 12:44:13浏览次数:52  
标签:CMake no vscode Tool will build path cmake

Tool-CMake-vscode-cmake-tools

microsoft/vscode-cmake-tools

https://github.com/microsoft/vscode-cmake-tools/blob/HEAD/docs/cmake-settings.md

Configure CMake Tools settings

CMake Tools supports a variety of settings that can be set at the user, or workspace, level via VSCode's settings.json file. This topic covers the available options and how they are used.

Options that support substitution, in the table below, allow variable references to appear in their strings. See variable substitution, below, for more information about variable expansion.

CMake settings

Setting Description Default value Supports substitution
cmake.autoSelectActiveFolder If 'false', your active folder only changes if you manually run the CMake: Select Active Folder command. 'true' no
cmake.buildArgs An array of additional arguments to pass to cmake --build. [] (empty array-no additional arguments) yes
cmake.buildBeforeRun If true, build the launch/debug target before running the target. true no
cmake.buildDirectory Specify the build directory (i.e. the root directory where CMakeCache.txt will be generated.) ${workspaceFolder}/build yes
cmake.buildEnvironment An object containing key:value pairs of environment variables, which will be passed only to the compiler. null (no environment variables specified) yes
cmake.buildToolArgs An array of additional arguments to pass to the underlying build tool. [] (empty array-no additional arguments) yes
cmake.cacheInit Path, or list of paths, to cache-initialization files. Passed to CMake via the -C command-line argument. [] (empty array-no cache initializer files) no
cmake.cmakePath Specify location of the cmake executable. cmake (causes CMake Tools to search the PATH environment variable, as well as some hard-coded locations.) Supports substitution for workspaceRoot, workspaceFolder, workspaceRootFolderName, userHome, ${command:...} and ${env:...}. Other substitutions result in an empty string.
cmake.cmakeCommunicationMode Specifies the protocol for communicating between the extension and CMake automatic no
cmake.configureArgs Arguments to CMake that will be passed during the configure process. Prefer to use cmake.configureSettings or CMake variants.
It is not recommended to pass -D arguments using this setting.
[] (empty array-no arguments) yes
cmake.configureEnvironment An object containing key:value pairs of environment variables, which will be passed to CMake only when configuring. null (no environment variable pairs) yes
cmake.configureOnEdit Automatically configure CMake project directories when the path in the cmake.sourceDirectory setting is updated or when CMakeLists.txt or *.cmake files are saved. true no
cmake.configureOnOpen Automatically configure CMake project directories when they are opened. null (prompt for configure) no
cmake.configureSettings An object containing key:value pairs, which will be passed to CMake when configuring. The same as passing -DVAR_NAME=ON via cmake.configureArgs. NOTE: If you are setting an array argument within cmake.configureSettings, you should use array notation, i.e. "CONFIGURE_SETTINGS_LIST": [ "a", "b" ] null (no values) yes
cmake.copyCompileCommands If not null, copies the compile_commands.json file generated by CMake to the path specified by this setting whenever CMake successfully configures. null (do not copy the file) yes
cmake.defaultVariants Override the default set of variants that will be supplied when no variants file is present. See CMake variants. no
cmake.environment An object containing key:value pairs of environment variables, which will be available when configuring, building, debugging, running or testing with CTest. null (no environment variables) yes
cmake.generator Set to a string to override CMake Tools preferred generator logic. If set, CMake will unconditionally use it as the -G CMake generator command line argument. no
cmake.installPrefix If specified, sets a value for CMAKE_INSTALL_PREFIX when running CMake configure. If not set, no value will be passed.
If CMAKE_INSTALL_PREFIX is set via cmake.configureArgs or cmake.configureSettings, cmake.installPrefix will be ignored.
null (no value specified) yes
cmake.loggingLevel A string setting that specifies how much output CMake Tools produces in its output channel. Set to one of "trace", "debug", "info", "note", "warning", "error", or "fatal". "trace" is the most verbose.

Regardless of the logging level, CMake Tools writes all levels of logging to the CMake Tools log file. This file is useful if you need to troubleshoot CMake Tools
"info" no
cmake.skipConfigureIfCachePresent A boolean setting that allows users to skip the configure process if there is a CMake cache present false no
cmake.additionalCompilerSearchDirs List of paths to search for additional compilers, like a MinGW installation. This means that GCC does not need to be on your $PATH for it to be found via kit scanning. For example: ["C:\\MinGW\\bin"] (Search in C:\MinGW\bin for a MinGW installation) [] no
cmake.parallelJobs Specify the number of jobs run in parallel during the build. Using the value 1 will disable build parallelism. no
cmake.preferredGenerators A list of strings of generator names to try, in order, when configuring a CMake project for the first time. no
cmake.saveBeforeBuild If true (the default), saves open text documents when build or configure is invoked before running CMake. true no
cmake.sourceDirectory A directory or a list of directories where the root CMakeLists.txts are stored. ${workspaceFolder} yes
cmake.testEnvironment An object containing key:value pairs of environment variables, which will be available when debugging, running and testing with CTest. null (no environment variables) yes

Variable substitution

Some settings support the replacement of special values in their string value by using a ${variable} syntax. The following built-in variables are expanded:

Variable Expansion
${workspaceRoot} DEPRECATED. The full path to the workspace root directory.
${workspaceFolder} The full path to the workspace root directory.
${sourceDirectory} The full path to the root CMakeLists.txt. (not substituted for cmake.sourceDirectory, cmake.cmakePath, cmake.ctestPath, or in Kits)
${workspaceRootFolderName} The name of the leaf directory in the workspace directory path.
${buildType} The current CMake build type. For example: Debug, Release, MinSizeRel, RelWithDebInfo
${buildKit} The current CMake kit full name. For example: GCC 7.3.0
${buildKitVendor} The current CMake kit vendor name. Possible values: GCC, MSVC, Clang and so on
${buildKitTriple} The current CMake kit target triple. For example: arm-none-eabi
${buildKitVersion} The current CMake kit version. For example: 9.3.0
${buildKitHostOs} The current CMake kit host OS. Possible values: win32, osx, linux and so on, all in lowercase
${buildKitTargetOs} The current CMake kit target OS. Possible values: win32, osx, linux and so on, all in lowercase
${buildKitTargetArch} The current CMake kit target architecture. Possible values: x86, x64, arm, aarch64 and so on, all in lowercase
${buildKitVersionMajor} The current CMake kit major version. For example: 7
${buildKitVersionMinor} The current CMake kit minor version. For example: 3
${generator} The name of the CMake generator. For example: Ninja
${projectName}|DEPRECATED. Expands to the constant string "ProjectName" CMake does not consider there to be just one project name to use. The concept of a single project does not work in CMake. Use ${workspaceRootFolderName}, instead.
${userHome} The full path to the current user's home directory.

Environment variables

Environment variables are expanded using the ${env:VARNAME} and ${env.VARNAME} syntax, where VARNAME is the environment to variable to expand. If the named environment variable is undefined, the expansion is an empty string.

Variant substitution

Variant options are expanded using the ${variant:VARIANTNAME} syntax, where the name of the currently active choice of the provided VARIANTNAME variant option is expanded. If the variant option is undefined, the expansion is an empty string.

Command substitution

CMake Tools can expand VS Code commands. For example, you can expand the path to the launch target by using the syntax ${command:cmake.launchTargetPath}

Be careful with long-running commands because it isn't specified when, or how many times, CMake Tools will execute a command for a given expansion.

Supported commands for substitution:

command substitution
cmake.getLaunchTargetPath The full path to the target executable, including the filename. The existence of the target is not validated.
cmake.getLaunchTargetDirectory The full path to the target executable's directory. The existence of the directory is not validated.
cmake.getLaunchTargetFilename The name of the target executable file without any path information. The existence of the target is not validated.
cmake.launchTargetPath The full path to the target executable, including the filename. If cmake.buildBeforeRun is true, invoking this substitution will also start a build.
cmake.launchTargetDirectory The full path to the target executable's directory. If cmake.buildBeforeRun is true, invoking this substitution will also start a build.
cmake.launchTargetFilename The name of the target executable file without any path information. If cmake.buildBeforeRun is true, invoking this substitution will also start a build.
cmake.buildTargetName The current target selected for build.
cmake.buildType Same as ${buildType}. The current CMake build type.
cmake.buildKit Same as ${buildKit}. The current CMake kit name.
cmake.buildDirectory The full path to the directory where CMake cache files are located.
cmake.tasksBuildCommand The CMake command used to build your project based on the currently selected Kit + Variant + Target. Suitable for use within tasks.json.
cmake.activeFolderName The name of the active folder (e.g. in a multi-root workspace)
cmake.activeFolderPath The asolute path of the active folder (e.g. in a multi-root workspace)
cmake.activeConfigurePresetName The name of the active configure preset.
cmake.activeBuildPresetName The name of the active build preset.
cmake.activeTestPresetName The name of the active test preset.

Next steps

标签:CMake,no,vscode,Tool,will,build,path,cmake
From: https://www.cnblogs.com/yongchao/p/17436573.html

相关文章

  • 谷歌浏览器Vue-devtools安装过程
     Vue-devtools安装1、选择Vue-devtools下载目录,执行命令gitclonehttps://github.com/vuejs/vue-devtools.git2、进入vue-devtools,执行npminstall,安装项目所需要的npm包3、编译项目文件 npmrunbuild4、修改manifest.json文件,把"persistent":false改成true5、添加至chrome浏......
  • nvm安装多版本node,vscode不识别npm函数解决方案
    问题:npm:无法将“npm”项识别为cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次的解决方案解决办法:(首先确定cmd当中是能够正常显示node和npm版本问题) 1、第一种办法:设置管理员权限 2、第二种办法:在Vscode......
  • CMake vs Makefile: 如何选择适合你的项目构建工具
    在软件开发中,构建(build)是一个非常重要的过程。我们需要将源代码转换为可执行文件或库文件。为了完成此过程,我们通常使用构建工具来自动化构建过程。CMake和Makefile都是用于构建和管理软件项目的工具。CMake是一个跨平台的构建工具,它可以自动生成Makefile,而Makefile是一个GNU工具,......
  • CMake vs Makefile: 如何选择适合你的项目构建工具
    在软件开发中,构建(build)是一个非常重要的过程。我们需要将源代码转换为可执行文件或库文件。为了完成此过程,我们通常使用构建工具来自动化构建过程。CMake和Makefile都是用于构建和管理软件项目的工具。CMake是一个跨平台的构建工具,它可以自动生成Makefile,而Makefile是一个GNU工具......
  • geotools判断geom的数据类型
    参考1:https://blog.csdn.net/ylfmsn/article/details/107487776参考2:https://wenku.baidu.com/view/ad2bd16ae618964bcf84b9d528ea81c758f52ea0.html......
  • How to fix CMake error Could not find a package configuration file provided by
    CMakeErrorat/usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake:117(find_package):Couldnotfindapackageconfigurationfileprovidedby"boost_filesystem"(requestedversion1.71.0)withanyofthefollowingnames:boos......
  • 华为云Toolkit活动:领取云计算8大领域50本干货电子书!
    怎么更好使用华为云开发者生态工具?快来体验插件界的全家桶HuaweiCloudToolkit!【活动详情】即日起至【6月30日】,登录华为云账号并点击下方链接访问产品页面,可获取华为云云享书库8大领域50本技术领域干货电子书,同时还可以参与华为云周边礼包抽奖!没有注册华为云账号的请先注册账号哦......
  • 如何在ubuntu下安装Vscode并且运行C语言文件或者python文件
    要想在ubuntu中编写并运行C语言或python文件,有两种方法,第一种是直接用vim编写(在我之前的文章中有详细介绍)可以点击如下链接:如何在ubuntu安装C语言环境-代师-博客园(cnblogs.com)如何在Ubuntu中编写Python代码并运行-代师-博客园(cnblogs.com) 今天我要说的是用专......
  • vscode使用cmake命令
    1、下载cmake:Download|CMake,并添加进环境变量(勾选即可)2、vscode安装插件 3、VisualStudioCode中CMake插件的基本使用_vscode中cmake_henry_23的博客-CSDN博客4、 ......
  • CMakeLists --- add_subdirectory 添加子目录
    命令格式:#添加一个子目录并构建该子目录。add_subdirectory(source_dir[binary_dir][EXCLUDE_FROM_ALL])#source_dir:子项目的CMakeLists.txt所在的目录#binary_dir:子项目产物的生成目录#EXCLUDE_FROM_ALL:不生成子项目的目标命令解析:source_dir必选参数。该参数指定......