在仅标头的库中定义CMake变量并使它们在其依赖范围中可用的最佳方法是什么?
例如:
<#assign test = { "apple": "5", "banana": {"kiwi": 15 }} >
Directly access your key and display the value. (if you know the key)
${test.banana.kiwi}
Dynamically list the keys
<#list test.banana?keys as k>
${k}
</#list>
Dynamically list the values
<#list test.banana?values as v>
${v}
</#list>
Dynamically list the keys and values
<#list test.banana as k,v >
${k}: ${v}
</#list>
# Header-only library CMakeLists.txt
[...]
add_library(SomeLibrary INTERFACE)
set(FOO "Foo is defined" PARENT_SCOPE) # this doesn't work