cmake 构建目录,Windows VS macOS

发布于 2025-01-20 21:53:46 字数 354 浏览 2 评论 0原文

这里的典型cmake生产是:

cmake .. -DCMAKE_TOOLCHAIN_FILE=/path/to/vcpkg.cmake
cmake --build .

在Windows和MacOS上都可以使用。

Windows上的howver二进制二进制中的二进制文件放置在build/debug/mylib.dll下,在MacOS上,它直接放置在build> build/libmylib.dylib下。我如何也可以在MacOS上的build> build/debug/libmylib.dylib中进行操作?

Typical cmake produre here was:

cmake .. -DCMAKE_TOOLCHAIN_FILE=/path/to/vcpkg.cmake
cmake --build .

That worked on both Windows and macOS.

Howver on Windows the binary in placed under build/Debug/mylib.dll while on macOS it is placed directly under build/libmylib.dylib. How can I make it on build/Debug/libmylib.dylib on macOS too?

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

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

发布评论

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

评论(1

从此见与不见 2025-01-27 21:53:46

您可以在Mac上手动复制相同的目录结构。

但是,我肯定会确保将debug配置放在一个名为debug的目录中,以免您将来混淆自己:

mkdir Debug
cd Debug
cmake ../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=/path/to/vcpkg.cmake 
cmake --build .

You could simply manually reproduce the same directory structure yourself on the Mac.

However, I would definitely make sure to only put a Debug configuration in a directory called Debug, lest you confuse yourself in the future:

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