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

Source: Internet
Author: User

Narrative description of the problem:

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 R Elease build (specifically the release or debug versions of those libraries). Is there a easy-to-do Cmake?


Workaround:

Target_link_libraries (<target> [LIB1 [LIB2 [...]] [[Debug|optimized|general] <lib>] A "Debug", "Optimized", or "general" keyword indicates that the library immediately following it's to being used only for th e corresponding build configuration.


So you should is able to does this:


Add_executable (Myexe ${sources})


Target_link_libraries (Myexe debug 3PDebugLib)

Target_link_libraries (Myexe optimized 3PReleaseLib)


References:

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


Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.