In buildem_cmake_recipe.cmake, I saw an expression:
externalproject_add_step(${_name} BuildOtherConfig
COMMAND ${CMAKE_COMMAND} --bui
That's a CMake generator expression. You can follow the link for a full discussion of what these are and what they can do. In short, it's a piece of text which CMake will evaluate at generate time (when it's done parsing all CMakeLists and is generating the buildsystem); it can evaluate to a different value for each configuration.
The one you have there means roughly this (pseudo-code):
if current_configuration == "Debug"
output "Release"
if current_configuration == "Release"
output "Debug"
So, if the current configuration is Debug, the whole expression will evaluate to Release
. If the current configuration's Release, it will evaluate to Debug
. Notice that the step being added is called "BuildOtherConfig," so this inverted logic makes sense.
How it works, in a little more detail:
$
This will evaluate to a 1
if the current config is Debug
, and to a 0
otherwise.
$<1:X>
Evaluates to X
.
$<0:X>
Evaluates to an empty string (no value).
Putting it together, we have $<$
. When the current config is Debug
, it evaluates like this:
$<$:Release>
$<1:Release>
Release
When the current config is not Debug
, it evaluates like this:
$<$:Release>
$<0:Release>