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

标签 cmake visual-studio-2019 devenv

我使用Visual Studio IDE进行开发,VS C++进行编译,CMake在VS中生成项目,Ninja进行构建。

我有一个脚本,可以从 git 服务器克隆一个项目,并自动执行在开始处理它之前需要执行的几个步骤。

在此脚本结束时,我想在 Visual Studio 中打开该项目。之前我习惯生成 VS 解决方案,然后使用 devenv 和 sln 文件作为参数来打开它。但现在我使用 VS 对 CMake 的支持,如果我使用 CMakeList.txt 文件作为参数,它只会打开此文件而不是完整的项目。

有办法做我想做的事吗?

提前致谢。

最佳答案

假设您项目的根 CMakeLists.txt 位于 C:\project\CMakeLists.txt 您可以调用

devenv "C:\project"

没有 CMakeLists.txt。

请注意,目前 Visual Studio 16.7 中似乎存在一个错误,即打开目录时,默认情况下会隐藏所有 View (例如解决方案资源管理器)。 (https://developercommunity.visualstudio.com/content/problem/1140297/visual-studio-is-forgetting-docked-viewwindow-layo.html)

关于cmake - 使用命令行在 Visual Studio 2019 中打开 CMake 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61480996/

相关文章:

c++ - CMake 是否总是为所有可能的项目配置生成配置?

c++ - Boost.Python 1.54(调试版本)对 Windows 上 Python27.lib 的令人费解的依赖性

compilation - 使用 CMake 编译和链接子项目库

c++ - ROS下使用CMakeList编译OpenCV

rendering - 如何修复模糊的 VS2019

带有 SSIS 的 Azure SDK

command-line - buildbot C++ 在 Windows : use devenv. com、vcbuild.exe 或 MSBuild.exe 上构建?

msbuild - 使用 devenv.exe 在第一次编译错误时自动停止 Visual C++ 2008 命令行批处理构建?

.net - 验证时发生错误。 H结果 = '8000000A'

c++ - Visual Studio 2019 C++ 无法识别模板 friend