gpt4 book ai didi

visual-studio - 如何在 Visual Studio 的 CMake 支持下运行 INSTALL?

转载 作者:行者123 更新时间:2023-12-04 20:29:59 24 4
gpt4 key购买 nike

CMake support in Visual Studio ,如何运行安装构建?

enter image description here
从顶部工具栏中的 CMake 菜单中,我没有看到任何用于运行 INSTALL 项目的选择。

编辑:vre 建议的最低设置工作,安装选项出现在工具栏菜单中:

  • CMakeLists.txt
    # 3.9.2 is the current version the newest VS is using
    cmake_minimum_required(VERSION 3.9.2)
    project(test2017)
    add_executable(hello hello.cpp)
    install(TARGETS hello DESTINATION hello/bin)
  • 你好.cpp

  • 但是当我搬家时 hello.cpp到子文件夹,该选项消失了:
  • CMakeLists.txt
    cmake_minimum_required(VERSION 3.9.2)
    project(test2017)
    add_subdirectory("src")
  • 源代码/CMakeLists.txt
    add_executable(hello hello.cpp)
    install(TARGETS hello DESTINATION "hello/bin")
  • src/hello.cpp
  • 最佳答案

    好像有bug当使用子文件夹并且在当前 VS 15.5.5 中仍未修复时。

    解决方法是添加 install论据 buildCommandArgsCMakeSettings.json文件。例子:

    {
    "configurations": [
    {
    "name": "x86-Debug",
    "generator": "Ninja",
    "configurationType": "Debug",
    "inheritEnvironments": [ "msvc_x86" ],
    "buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
    "installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
    "cmakeCommandArgs": "",
    "buildCommandArgs": "-v install",
    "ctestCommandArgs": ""
    }
    ]
    }

    关于visual-studio - 如何在 Visual Studio 的 CMake 支持下运行 INSTALL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48471609/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com