Skip to content

GenEx: Fix COMPATIBLE_INTERFACE_ evaluation outside usage requirements

Brad King requested to merge brad.king/cmake:genex-compatible-interface into master

In commit ff6c4013 (cmTarget: Add interface for compatible numeric properties, 2013-10-22, v3.0.0-rc1~460^2) the condition

dagCheckerParent && !dagCheckerParent->EvaluatingLinkLibraries()

was written that way to avoid a nullptr dereference, but is actually meant to say "is not evaluating link libraries". That can also be true when there is no dagCheckerParent, such as when evaluating a generator expression outside of usage requirements, e.g., for add_custom_target. The original commit tried to account for that by duplicating the implementation in another code path, but that did not work in all cases.

Fix the condition, remove the duplication, and add tests for the now-supported cases.

Merge request reports