问题描述
所以我有一个正在编译的库,我需要根据它是调试版本还是发布版本(特别是这些库的发布版本或调试版本)来链接不同的第三方内容.在 Cmake 中有没有一种简单的方法可以做到这一点?
我应该注意我使用的是visual studio
根据 CMake 文档:
target_link_libraries( [lib1 [lib2 [...]]] [[debug|optimized|general] ] ...) <块引用>
调试"、优化"或常规"关键字表示库紧随其后使用仅适用于相应的构建配置.
所以你应该能够做到这一点:
add_executable( MyEXE ${SOURCES})target_link_libraries(MyEXE 调试 3PDebugLib)target_link_libraries(MyEXE优化的3PReleaseLib)So I've got a library I'm compiling and I need to link different third party things in depending on if it's the debug or release build (specifically the release or debug versions of those libraries). Is there an easy way to do this in Cmake?
Edit: I should note I'm using visual studio
According to the CMake documentation:
target_link_libraries(<target> [lib1 [lib2 [...]]] [[debug|optimized|general] <lib>] ...)
A "debug", "optimized", or "general" keyword indicates that the library immediately following it is to be used only for the corresponding build configuration.
So you should be able to do this:
add_executable( MyEXE ${SOURCES})
target_link_libraries( MyEXE debug 3PDebugLib)
target_link_libraries( MyEXE optimized 3PReleaseLib)
这篇关于在 Windows 上的 Cmake 中为调试和发布构建链接不同的库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)