CMake interpretation string as a variable

I am looking for a way to interpret a string as a variable name in cmake.

Given:

set(MY_SECRET_VAR "foo") # later only the name of the variable is known. set(THE_NAME "MY_SECRET_VAR") # Now i'm looking for a way to get the value "foo" from the name # something like: set(THE_VALUE "${THE_NAME}") # THE_VALUE should be "foo" 
+6
source share
1 answer

Second scan level:

 set(THE_VALUE "${${THE_NAME}}") 
+7
source

All Articles