码迷,mamicode.com
首页 > Windows程序 > 详细

Linking different libraries for Debug and Release builds in Cmake on windows?

时间:2015-07-19 11:46:32      阅读:229      评论:0      收藏:0      [点我收藏+]

标签:

问题叙述性说明:

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?


解决方法:

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) 


參考:

http://stackoverflow.com/questions/2209929/linking-different-libraries-for-debug-and-release-builds-in-cmake-on-windows


版权声明:本文博客原创文章,博客,未经同意,不得转载。

Linking different libraries for Debug and Release builds in Cmake on windows?

标签:

原文地址:http://www.cnblogs.com/gcczhongduan/p/4658341.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!