CMake的 - 访问多个配置发电机的配置参数 [英] CMake - Accessing configuration parameters of multiple-configuration generators

查看:159
本文介绍了CMake的 - 访问多个配置发电机的配置参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的CMake生成Visual Studio解决方案。我想我的解决方案有多种配置 - 86调试/发布和x86_64调试/发布

I'm using CMake to generate a Visual Studio solution. I want my solution to have multiple configurations - x86 Debug/Release and x86_64 Debug/Release.

对于这些配置,我需要我的项目针对不同的版本我的依赖关系(即我需要对单元测试库的64位,调试版本的64位,调试版本)链接。

For each of these configurations, I need to link my project against different versions of my dependencies (i.e. I need the 64-bit, debug build against the 64-bit, debug version of the unit test library).

下面是我想做到这一点:我把依赖的二进制版本到文件夹名称的配置后,例如:

Here is how I want to do it: I'll place the binary versions of dependencies into folders names after the configurations, for example:

<project root>/deps/x86_64_debug/library.lib

现在的问题是,我怎么能告诉CMake的寻找图书馆在相应的文件夹?是否有任何的CMake变量指示用于多配置发电机目标平台和当前配置的释放/调试状态?

The question is, how can I tell CMake to look for libraries in the appropriate folder? Are there any CMake variables that indicate the target platform and release/debug status of the "current configuration" for a multi-config generator?

推荐答案

请为的发电机前pressions

发电机前pressions进行评估,以
  产生具体到每个生成的配置信息。

Generator expressions are evaluated during build system generation to produce information specific to each build configuration.

这篇关于CMake的 - 访问多个配置发电机的配置参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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