CMake - Accessing configuration parameters of multiple-configuration generators

和自甴很熟 提交于 2019-12-11 02:40:06

问题


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.

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

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?


回答1:


Please consult documentation for generator expressions

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



来源:https://stackoverflow.com/questions/29045385/cmake-accessing-configuration-parameters-of-multiple-configuration-generators

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!