Search code examples
visual-studiobuildcmakebuild-system

CMake - Accessing configuration parameters of multiple-configuration generators


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?


Solution

  • Please consult documentation for generator expressions

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