代码之家  ›  专栏  ›  技术社区  ›  BullyWiiPlaza

使用CMake将命令行参数传递给Visual Studio以进行概要文件引导优化

  •  0
  • BullyWiiPlaza  · 技术社区  · 7 年前

    我正在使用 CMake 暂时 C++ 项目我想用 profile guided optimization 因此,我还需要将命令行参数传递给 Release 我的二进制文件的模式版本。 Visual Studio 需要此项来创建性能配置文件。我已经有一个 launch.vs.json 系统的配置 Debug

    {
      "version": "0.2.1",
      "defaults": {},
      "configurations": [
        {
          "name": "MyProject",
          "project": "CMakeLists.txt",
          "projectTarget": "MyProject.exe",
          "type": "default",
          "args": [
            "...", "..."
          ]
        }
      ]
    }
    

    当我切换到 释放 模式并选择 MyProject Visual Studio 显示以下错误消息:

    Unable to start debugging. The startup project could not be launched.
    

    为什么不这样做呢?我也无法设置另一个配置文件并使 Visual Studio 从中认出它 释放 模式,但在 模式

    1 回复  |  直到 7 年前
        1
  •  1
  •   BullyWiiPlaza    7 年前

    我现在通过添加另一个条目成功地做到了这一点:

    {
      "version": "0.2.1",
      "defaults": {},
      "configurations": [
        {
          "name": "MyProject",
          "project": "CMakeLists.txt",
          "projectTarget": "MyProject.exe",
          "type": "default",
          "args": ["...", "..."]
        },
        {
          "name": "MyProject (Release\\MyProject.exe)",
          "project": "CMakeLists.txt",
          "projectTarget": "MyProject.exe (Release\\MyProject.exe)",
          "type": "default",
          "args": ["...", "..."]
        }
      ]
    }