2015-09-17 15 views
6

Sto cercando un modo per interpretare una stringa come nome di variabile in cmake.CMake interpreta stringa come variabile

Dato:

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" 

risposta

7

Un secondo livello di unwrapping:

set(THE_VALUE "${${THE_NAME}}") 
Problemi correlati