I am trying to interrogate the inclusion path of a series of addsubdirectories():
-projectA
-projectB
-projectC
In this setup, projectA
is adding ProjectB
as a subdirectory which in turn adds ProjectC
as a subdirectory. I want to let projectC
know about the hierarchy.
I can achieve this by recursive calls
get_directory_property(parent DIRECTORY ${cur_dir} PARENT_DIRECTORY)
which will return nothing when it reaches projectA
. That almost does it. It would be nice however, if I could read the ${PROJECT_NAME}
from these directories and return A-B-C
instead of projectA-projectB-projectC
.
So my question is: Is there any way of reading the variables from a directory that is already parsed?
Note that in this case, although projectC
would inherit variables from its parent, but the standard cache variables are replaced in the child projects, which is why I can't use them.