基于构建配置的链接库[cmake] [英] Link library based on build configuration [cmake]

查看:123
本文介绍了基于构建配置的链接库[cmake]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

调试和发布库与CMAKE(VISUAL STUDIO)的链接

cmake newb在这里,我想告诉target_link_libraries链接调试库时使用调试配置和链接到发布lib时,在发布配置下编译。

cmake newb here, I would like to tell target_link_libraries to link a debug lib when using the debug configuration and link to a release lib when compiling under the release configuration.

如何告诉cmake为调试配置链接不同的lib文件?

How do I tell cmake to link a different lib file for the debug configuration?

推荐答案

是:

SET(LINK_LIBRARY optimized Foo debug Foo_d)
target_link_libraries(MyEXE ${LINK_LIBRARY})

这篇关于基于构建配置的链接库[cmake]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆