问题叙述性说明:

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?的更多相关文章

  1. What is the difference between Debug and Release in Visual Studio?

    "Debug" and "Release" are actually just two labels for a whole slew of settings ...

  2. VC Debug和Release区别

    https://msdn.microsoft.com/en-us/library/xz7ttk5s.aspx   Optimizing Your Code Visual Studio 2015 The ...

  3. 详解Qt,并举例说明动态编译(shared)和静态编译(static)以及debug and release 编译版本区别(可产生静态版的Debug版本,需要把-release 改为 –debug-and-release)

    作为初入Qt学习的新人,花了整整一两天时间,对Qt编译版本等问题进行了一步步探索,首先感谢网站博客中文章,开始也不是很明白一些几个问题: 1.Qt版本问题 作为初学者,可能下载时这么多版本,如何选择呢 ...

  4. 【VS开发】MFC运行时库与debug、release版本之间的配置关系

    参考内容: 前段时间从网上下来一个有意思的代码,用VS2010打开时需要将工程转换为2010的工程,转化后却出现了编译不通过的问题,类似这样的错误:c:\program files\microsoft ...

  5. 玩转Windows服务系列——Debug、Release版本的注册和卸载,及其原理

    Windows服务Debug版本 注册 Services.exe -regserver 卸载 Services.exe -unregserver Windows服务Release版本 注册 Servi ...

  6. .NET 的 Debug 和 Release build 对执行速度的影响

    这篇文章发布于我的 github 博客:原文 在真正开始讨论之前先定义一下 Scope. 本文讨论的范围限于执行速度,内存占用什么的不在评估的范围之内. 本文不讨论算法:编译器带来的优化基本上属于底层 ...

  7. VS2008 Debug与Release的本质区别(转)

    如何设置:工具栏“生成”→“配置管理器”→“活动解决方案配置” 对于VS2008的初次使用者来说,常会遇到的编译问题时,Debug版本运行正常,但在Release版本则不稳定或无法运行.以下是对Deb ...

  8. 区分debug和release生成文件的名称

    通常我们编译工程按照debug和release区分,且明确在Debug版本的生成文件中加入d标记.譬如: HelloWorld.exe 一般是release的生成文件,而debug版叫:HelloWo ...

  9. vs2010 创建预编译头 Debug 正常 Release Link Error问题解决

    问题:创建预编译头 Debug 正常 Release Link Error Main.obj : error LNK2005: ___@@_PchSym_@00@UmfilkilqUdrmzkkUki ...

随机推荐

  1. 细说HTML头部标签

    原文 简书原文:https://www.jianshu.com/p/4270b1d1037d 大纲 1.头部标签列表 2.头部标签详解 1.头部标签列表 <!DOCTYPE html> & ...

  2. Spring的任务调度@Scheduled注解——task:scheduler和task:executor的解析

    原文地址: https://blog.csdn.net/yx0628/article/details/80873774 一个简单的Spring定时任务的 demo,全部代码见下载地址:https:// ...

  3. python implementation for Qt's QDataStream(看一下QDataStream的结构)

    #!/usr/bin/env python # -*- coding: utf- -*- from __future__ import print_function from __future__ i ...

  4. Selector API用法

    java.nio.channels 类 Selector java.lang.Object java.nio.channels.Selector 直接已知子类: AbstractSelector pu ...

  5. Android 闹钟最终版

    以下是我发现的几点闹钟中重要的点,分享一下: (1)在闹钟中有AudioManager管理机制,这个机制可以申请和释放OnAudioFocusChangeListener监听. 还有mTelephon ...

  6. Linux环境下Apache ActiveMQ 基本安装

    原文链接:https://www.jianshu.com/p/1c017088aa95 在linux上安装mq,并映射到外网.1.Apache ActiveMQ安装基本条件请参考链接:2.下载Apac ...

  7. [CSS] Showing horizontal scrollbar always for the table

    table { display: block; overflow: scroll; width: 200px; height:95vh; }

  8. php实现二叉树遍历

    php实现二叉树遍历 一.总结 关注输入输出 二.php实现二叉树遍历 题目描述 编一个程序,读入用户输入的一串先序遍历字符串,根据此字符串建立一个二叉树(以指针方式存储). 例如如下的先序遍历字符串 ...

  9. gcc新版本号引起的编译错误(命令运行时的外部库输入位置)

    昨天,遇到一个比較bug的错误,用gcc来编译几个简单的文件出错,编译环境为x86_64的Ubuntu12.04.gcc版本号号例如以下: gcc (Ubuntu/Linaro 4.6.3-1ubun ...

  10. 前端,Java,产品经理,微信小程序,Python等资源合集大放送

    为了感恩大家长久以来的关注和支持,小编准备了一些福利,整理了包含前端,Java,产品经理,微信小程序,Python,网站源码,Android应用视频教程,微信公众平台开发教程及材料等资源合集大放送. ...