diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx index ab82b12411..3a5a27ca1b 100644 --- a/Source/cmFindCommon.cxx +++ b/Source/cmFindCommon.cxx @@ -507,6 +507,11 @@ void cmFindCommonDebugState::FailedAt(std::string const& path, this->FailedAtImpl(path, regexName); } +bool cmFindCommonDebugState::ShouldImplicitlyLogEvents() const +{ + return true; +} + void cmFindCommonDebugState::Write() { auto const* const fc = this->FindCommand; @@ -517,11 +522,13 @@ void cmFindCommonDebugState::Write() fc->Makefile->GetCMakeInstance()->GetConfigureLog()) { // Write event if any of: // - debug mode is enabled - // - the variable was not defined (first run) - // - the variable found state does not match the new found state (state - // transition) - if (fc->DebugModeEnabled() || !fc->IsDefined() || - fc->IsFound() != this->IsFound) { + // - implicit logging should happen and: + // - the variable was not defined (first run) + // - the variable found state does not match the new found state (state + // transition) + if (fc->DebugModeEnabled() || + (this->ShouldImplicitlyLogEvents() && + (!fc->IsDefined() || fc->IsFound() != this->IsFound))) { this->WriteEvent(*log, *fc->Makefile); } } diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h index c89e980a93..31f742ed70 100644 --- a/Source/cmFindCommon.h +++ b/Source/cmFindCommon.h @@ -185,6 +185,7 @@ protected: virtual void FoundAtImpl(std::string const& path, std::string regexName) = 0; virtual void FailedAtImpl(std::string const& path, std::string regexName) = 0; + virtual bool ShouldImplicitlyLogEvents() const; virtual void WriteDebug() const = 0; #ifndef CMAKE_BOOTSTRAP