2015-09-17 18 views
6

私は文字列をcmakeの変数名として解釈する方法を探しています。CMakeは文字列を変数として解釈します

考える:アンラップの

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" 

答えて

7

第二レベル:

set(THE_VALUE "${${THE_NAME}}") 
関連する問題