问题
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