CMake Visual Studio“调试”文件夹
Visual Studio 坚持要求在使用 CMake 时必须在 bin/Debug/ 而不仅仅是 bin/ 中创建可执行文件。 有办法解决这个问题吗?
Visual Studio insists that it has to create executables in bin/Debug/ instead of just bin/, when using CMake.
Is there a way to fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,但不是很漂亮...
您需要更新 RUNTIME_OUTPUT_DIRECTORY,LIBRARY_OUTPUT_DIRECTORY 和 ARCHIVE_OUTPUT_DIRECTORY ALL
最简单的方法是使用其 CMAKE_... 等效项“全局”执行此操作。例如,检查以下示例,将 bin/ 和 lib/ 设置为“全局”二进制/库输出目录:
或者,您可以尝试运行所有可用目标并随后修改其属性...
请注意,这不会设置.pdb 文件的位置。我仍然没有找到一种令人满意的方法将所有相关的 .pdb 文件放入 bin/ 目录中。
Yes, but is not really pretty...
You will need to update the RUNTIME_OUTPUT_DIRECTORY, LIBRARY_OUTPUT_DIRECTORY and ARCHIVE_OUTPUT_DIRECTORY properties on ALL your targets. And you will need to do this for every configuration (Debug, RelWithDebInfo, etc.)
The easiest way is to do this "globally" with their CMAKE_... equivalents. E.g. check the following sample which sets bin/ and lib/ as the "global" binary/library output-directories:
Alternatively, you can try to run through all the available targets and modify its properties afterwards...
Note that this does not set the location of your .pdb files. I still have not found a satisfying way to put all the relevant .pdb files in the bin/ directory.