如何使用cmake在指定的构建目录中生成Visual Studio

发布于 2024-09-13 06:58:35 字数 278 浏览 4 评论 0原文

我有cmake 2.8.2。和一个具有如下目录的项目:在存储库中,我有 bin 目录来存储构建的二进制文件。我可以在 bin 文件夹中生成 Visual Studio 解决方案文件,而使用 cmake-gui 不会出现任何问题。但我想使用命令行版本的 cmake 生成解决方案文件。

我在 bin 目录中尝试了 cmake -G "Visual Studio 9 2008" .. ,但解决方案文件是在存储库目录中生成的。

I have cmake 2.8.2. and a project with directory like this: In the repository, I have bin directory to store built binary files. I can generate visual studio solution files in bin folder without any problem with cmake-gui. But I'd like to generate solution file using the command line version of cmake.

I tried cmake -G "Visual Studio 9 2008" .. in bin directory, but solution file is generated in the repository directory.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

带上头具痛哭 2024-09-20 06:58:35

一般情况下,只需运行
cmake -G“Visual Studio 9 2008”..
而在你的 bin 目录中应该可以工作。

但是,如果仍然存在早期“源内”构建中的 CMakeCache.txt 文件,则此操作将不起作用。 ..目录下有CMakeCache.txt吗?是这样吗,删除后重试...

Under normal circumstances, simply running
cmake -G"Visual Studio 9 2008" ..
while in your bin directory should work.

However, if there is still a CMakeCache.txt file from earlier "in-source" build, this will not work. Is there a CMakeCache.txt in the .. directory? Is so, remove it and try again...

來不及說愛妳 2024-09-20 06:58:35

假设您已经

Repository/CMakeLists.txt
Repository/srcs...

在存储库中创建了一个 bin 目录:

cd Repository
mkdir bin
cd bin

然后您可以执行您想要的操作:

cmake -G "Visual Studio 9 2008" ..

并且它将起作用。

lets say you have

Repository/CMakeLists.txt
Repository/srcs...

and you create a bin directory in Repository:

cd Repository
mkdir bin
cd bin

then you can do what you want:

cmake -G "Visual Studio 9 2008" ..

and it will work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文