[英]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.