简体   繁体   English

使用命令行在 Visual Studio 2019 中打开 CMake 项目

[英]Open CMake proejct in Visual Studio 2019 using command line

I use Visual Studio IDE to develop, VS C++ to compile, CMake to generate the project in VS and Ninja to build.我使用Visual Studio IDE开发,VS C++编译,CMake生成项目在VS和Ninja中构建。

I have a script that clone a project from git server and automate several steps I need to perform before start working on it.我有一个脚本,它可以从 git 服务器克隆一个项目,并在开始处理它之前自动执行我需要执行的几个步骤。

At the end of this script I would like to open the project in Visual Studio.在此脚本结束时,我想在 Visual Studio 中打开该项目。 Before I used to generate the VS solution instead and then use devenv with the sln file as a parameter to open it.之前我用生成VS解决方案,然后使用带有sln文件的devenv作为参数打开它。 But now that I use VS support for CMake if I use CMakeList.txt file as a parameter it only opens this file not the complete project.但是现在我使用 VS 支持 CMake 如果我使用 CMakeList.txt 文件作为参数,它只会打开这个文件而不是完整的项目。

Is there a way to do what I am trying to do??有没有办法做我想做的事情?

Thanks in advance.提前致谢。

Assuming your project's root CMakeLists.txt is located in C:\project\CMakeLists.txt you can call假设您项目的根 CMakeLists.txt 位于C:\project\CMakeLists.txt您可以调用

devenv "C:\project"

without the CMakeLists.txt.没有 CMakeLists.txt。

Note that currently there seems to be a bug in Visual Studio 16.7 that when opening a directory, all the views (eg solution explorer) are hidden by default.请注意,目前在 Visual Studio 16.7 中似乎存在一个错误,即在打开目录时,默认情况下所有视图(例如解决方案资源管理器)都是隐藏的。 ( https://developercommunity.visualstudio.com/content/problem/1140297/visual-studio-is-forgetting-docked-viewwindow-layo.html ) https://developercommunity.visualstudio.com/content/problem/1140297/visual-studio-is-forgetting-doked-viewwindow-layo.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 Visual Studio 2019 显示 CMake 的编译器命令行 - Show compiler command line of CMake with Visual Studio 2019 在Windows 7,Visual Studio 2010和命令行中使用CMake - Using CMake with Windows 7, Visual Studio 2010, and the command line cmake在命令行上创建visual studio解决方案 - cmake creating visual studio solution on the command line 在 Visual Studio 2019 中使用 NuGet 填充 CMake 依赖项 - Using NuGet to fill CMake dependencies in Visual Studio 2019 在 Visual Studio 2019 的 windows 中使用 CMake 构建 openCV 的问题 - Problems building openCV with contrib using CMake in windows for visual studio 2019 C++ - 无法使用 Visual Studio 2019/CMake 在 libyaml 中链接 - C++ - Unable to link in libyaml using Visual Studio 2019/CMake 在命令行或CMake上为Visual Studio代码分析指定规则集 - Specify ruleset for Visual Studio code analysis on command line or from CMake CMake&Visual Studio:如何快速,安静地命令行构建? - CMake & Visual Studio: How to get a quick, quiet command line build? 使用CMake将命令行参数传递给Visual Studio进行配置文件引导的优化 - Passing command line arguments to Visual Studio using CMake for profile guided optimization 用 CMake 和 Visual Studio 2019 编译 GLEW? - Compile GLEW with CMake and Visual Studio 2019?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM