[CMake] "Deep" variable expansion (or, replacing literal "${FOO}")

Braden McDaniel braden at endoframe.com
Fri Mar 29 16:58:55 EDT 2013


The value of the variable CMAKE_CFG_INTDIR is the literal string "${config}"
(that is, CMake does not expand this variable itself). I'd like to expand this
literal variable within CMake using a value I supply; that is, I'd like to
replace the literal string "${config}" with something else; say, "foo". Alas, I
have not been able to get this to work:

  string(REPLACE "\${config}" foo MY_OUTPUT_VAR ${CMAKE_CFG_INTDIR})

Why isn't this working? Is there some other way to accomplish what I want?

Braden




More information about the CMake mailing list