mark_as_advanced: policy to not operate on non-cached names
This pattern:
set(SOME_EXE ...)
mark_as_advanced(SOME_EXE)
find_program(SOME_EXE ...)
breaks on the first run because SOME_EXE
does not exist as a cache entry so mark_as_advanced
creates one in a way that causes find_program
to erase it. On later runs SOME_EXE
retains the plain set()
value.
Just as !2155 (merged) and !2203 (merged) added a policy to teach option()
not to operate when a normal variable is set, we should introduce a similar policy for mark_as_advanced
.
See also #10967 (closed), #15448 (closed), and #18315 (closed).