How to write a variable to the parents' parent scope in CMake?

安稳与你 提交于 2019-12-13 00:48:36

问题


I know that when I am in a function, I can set the variable in the calling scope by using:

set(MYVAR 1 PARENT_SCOPE)

What I want is to be able to set a variable in the grandparent scope (if it exists).

I know that if I redefine my function as a macro, then set(MYVAR 1 PARENT_SCOPE) effectively does what I need. But unfortunately, I cannot do that for unrelated reasons.

A solution would work for me as a walkaround for the problem in How to check if the variable is set in the parent scope, (as opposed to being inherited from grandparents) in CMake? .

来源:https://stackoverflow.com/questions/56295714/how-to-write-a-variable-to-the-parents-parent-scope-in-cmake

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!