浏览代码

find_*: support suppressing implicit transition events

When projects explicitly unset variables, the transition detection can
end up reporting events when they are not desired.

See: #24833
Ben Boeckel 4 月之前
父节点
当前提交
c42d82d569
共有 31 个文件被更改,包括 825 次插入5 次删除
  1. 1 0
      Help/manual/cmake-variables.7.rst
  2. 3 1
      Help/release/dev/implicit-find-events.rst
  3. 26 0
      Help/variable/CMAKE_FIND_DEBUG_MODE_NO_IMPLICIT_CONFIGURE_LOG.rst
  4. 8 0
      Source/cmFindCommon.cxx
  5. 5 0
      Source/cmFindCommon.h
  6. 3 1
      Source/cmFindLibraryCommand.cxx
  7. 3 1
      Source/cmFindPackageCommand.cxx
  8. 3 1
      Source/cmFindPathCommand.cxx
  9. 4 1
      Source/cmFindProgramCommand.cxx
  10. 57 0
      Tests/RunCMake/find_file/ConfigureLogTransitionsSuppressed-config.txt
  11. 24 0
      Tests/RunCMake/find_file/ConfigureLogTransitionsSuppressed.cmake
  12. 1 0
      Tests/RunCMake/find_file/RunCMakeTest.cmake
  13. 57 0
      Tests/RunCMake/find_library/ConfigureLogTransitionsSuppressed-config.txt
  14. 24 0
      Tests/RunCMake/find_library/ConfigureLogTransitionsSuppressed.cmake
  15. 1 0
      Tests/RunCMake/find_library/RunCMakeTest.cmake
  16. 57 0
      Tests/RunCMake/find_package/ConfigureLogTransitionsConfig2Suppressed-config.txt
  17. 63 0
      Tests/RunCMake/find_package/ConfigureLogTransitionsConfig2Suppressed-stderr.txt
  18. 45 0
      Tests/RunCMake/find_package/ConfigureLogTransitionsConfig2Suppressed.cmake
  19. 57 0
      Tests/RunCMake/find_package/ConfigureLogTransitionsConfigSuppressed-config.txt
  20. 9 0
      Tests/RunCMake/find_package/ConfigureLogTransitionsConfigSuppressed-stdout.txt
  21. 45 0
      Tests/RunCMake/find_package/ConfigureLogTransitionsConfigSuppressed.cmake
  22. 57 0
      Tests/RunCMake/find_package/ConfigureLogTransitionsModule2Suppressed-config.txt
  23. 63 0
      Tests/RunCMake/find_package/ConfigureLogTransitionsModule2Suppressed-stderr.txt
  24. 42 0
      Tests/RunCMake/find_package/ConfigureLogTransitionsModule2Suppressed.cmake
  25. 3 0
      Tests/RunCMake/find_package/RunCMakeTest.cmake
  26. 57 0
      Tests/RunCMake/find_path/ConfigureLogTransitionsSuppressed-config.txt
  27. 24 0
      Tests/RunCMake/find_path/ConfigureLogTransitionsSuppressed.cmake
  28. 1 0
      Tests/RunCMake/find_path/RunCMakeTest.cmake
  29. 57 0
      Tests/RunCMake/find_program/ConfigureLogTransitionsSuppressed-config.txt
  30. 24 0
      Tests/RunCMake/find_program/ConfigureLogTransitionsSuppressed.cmake
  31. 1 0
      Tests/RunCMake/find_program/RunCMakeTest.cmake

+ 1 - 0
Help/manual/cmake-variables.7.rst

@@ -56,6 +56,7 @@ Variables that Provide Information
    /variable/CMAKE_EXECUTABLE_SUFFIX_LANG
    /variable/CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES
    /variable/CMAKE_FIND_DEBUG_MODE
+   /variable/CMAKE_FIND_DEBUG_MODE_NO_IMPLICIT_CONFIGURE_LOG
    /variable/CMAKE_FIND_PACKAGE_NAME
    /variable/CMAKE_FIND_PACKAGE_REDIRECTS_DIR
    /variable/CMAKE_FIND_PACKAGE_SORT_DIRECTION

+ 3 - 1
Help/release/dev/implicit-find-events.rst

@@ -4,4 +4,6 @@ implicit-find-events
 * The :manual:`cmake-configure-log(7)` will report events from ``find_``
   commands without any find-debug flags (e.g.,
   :variable:`CMAKE_FIND_DEBUG_MODE`) when they transition between "found" and
-  "not found" or when they are first defined.
+  "not found" or when they are first defined. The
+  :variable:`CMAKE_FIND_DEBUG_MODE_NO_IMPLICIT_CONFIGURE_LOG` variable will
+  suppress these events without any explicit request for a debug mode.

+ 26 - 0
Help/variable/CMAKE_FIND_DEBUG_MODE_NO_IMPLICIT_CONFIGURE_LOG.rst

@@ -0,0 +1,26 @@
+CMAKE_FIND_DEBUG_MODE_NO_IMPLICIT_CONFIGURE_LOG
+-----------------------------------------------
+
+.. versionadded:: 4.1
+
+The following commands will report configure log events when they experience a
+transition between found and not-found states or when the result is first
+defined:
+
+* :command:`find_program`
+* :command:`find_library`
+* :command:`find_file`
+* :command:`find_path`
+* :command:`find_package`
+
+The ``CMAKE_FIND_DEBUG_MODE_NO_IMPLICIT_CONFIGURE_LOG`` boolean variable
+suppresses these implicit events from the configure log when set to a true
+value.
+
+.. code-block:: cmake
+
+  set(CMAKE_FIND_DEBUG_MODE_NO_IMPLICIT_CONFIGURE_LOG TRUE)
+  find_program(...)
+  set(CMAKE_FIND_DEBUG_MODE_NO_IMPLICIT_CONFIGURE_LOG FALSE)
+
+Default is unset.

+ 8 - 0
Source/cmFindCommon.cxx

@@ -116,6 +116,14 @@ bool cmFindCommon::ComputeIfDebugModeWanted(std::string const& var)
     this->Makefile->GetCMakeInstance()->GetDebugFindOutput(var);
 }
 
+bool cmFindCommon::ComputeIfImplicitDebugModeSuppressed()
+{
+  // XXX(find-events): In the future, mirror the `ComputeIfDebugModeWanted`
+  // methods if more control is desired.
+  return this->Makefile->IsOn(
+    "CMAKE_FIND_DEBUG_MODE_NO_IMPLICIT_CONFIGURE_LOG");
+}
+
 void cmFindCommon::InitializeSearchPathGroups()
 {
   std::vector<PathLabel>* labels;

+ 5 - 0
Source/cmFindCommon.h

@@ -125,6 +125,11 @@ protected:
   bool ComputeIfDebugModeWanted();
   bool ComputeIfDebugModeWanted(std::string const& var);
 
+  /** The `InitialPass` functions of the child classes should not initialize
+     `DebugState` if there is not a debug mode wanted and these return `true`.
+   */
+  bool ComputeIfImplicitDebugModeSuppressed();
+
   // Path arguments prior to path manipulation routines
   std::vector<std::string> UserHintsArgs;
   std::vector<std::string> UserGuessArgs;

+ 3 - 1
Source/cmFindLibraryCommand.cxx

@@ -44,8 +44,10 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn)
     return false;
   }
 
-  this->DebugState = cm::make_unique<cmFindBaseDebugState>(this);
   this->FullDebugMode = this->ComputeIfDebugModeWanted(this->VariableName);
+  if (this->FullDebugMode || !this->ComputeIfImplicitDebugModeSuppressed()) {
+    this->DebugState = cm::make_unique<cmFindBaseDebugState>(this);
+  }
 
   if (this->IsFound()) {
     this->NormalizeFindResult();

+ 3 - 1
Source/cmFindPackageCommand.cxx

@@ -726,8 +726,10 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
 
   // Process debug mode
   cmMakefile::DebugFindPkgRAII debugFindPkgRAII(this->Makefile, this->Name);
-  this->DebugState = cm::make_unique<cmFindPackageDebugState>(this);
   this->FullDebugMode = this->ComputeIfDebugModeWanted();
+  if (this->FullDebugMode || !this->ComputeIfImplicitDebugModeSuppressed()) {
+    this->DebugState = cm::make_unique<cmFindPackageDebugState>(this);
+  }
 
   // Parse the arguments.
   enum Doing

+ 3 - 1
Source/cmFindPathCommand.cxx

@@ -38,8 +38,10 @@ bool cmFindPathCommand::InitialPass(std::vector<std::string> const& argsIn)
     return false;
   }
 
-  this->DebugState = cm::make_unique<cmFindBaseDebugState>(this);
   this->FullDebugMode = this->ComputeIfDebugModeWanted(this->VariableName);
+  if (this->FullDebugMode || !this->ComputeIfImplicitDebugModeSuppressed()) {
+    this->DebugState = cm::make_unique<cmFindBaseDebugState>(this);
+  }
 
   if (this->IsFound()) {
     this->NormalizeFindResult();

+ 4 - 1
Source/cmFindProgramCommand.cxx

@@ -199,8 +199,11 @@ bool cmFindProgramCommand::InitialPass(std::vector<std::string> const& argsIn)
   if (!this->ParseArguments(argsIn)) {
     return false;
   }
-  this->DebugState = cm::make_unique<cmFindBaseDebugState>(this);
+
   this->FullDebugMode = this->ComputeIfDebugModeWanted(this->VariableName);
+  if (this->FullDebugMode || !this->ComputeIfImplicitDebugModeSuppressed()) {
+    this->DebugState = cm::make_unique<cmFindBaseDebugState>(this);
+  }
 
   if (this->IsFound()) {
     this->NormalizeFindResult();

+ 57 - 0
Tests/RunCMake/find_file/ConfigureLogTransitionsSuppressed-config.txt

@@ -0,0 +1,57 @@
+^
+---
+events:(
+  -
+    kind: "find-v1"(
+    [^
+]*)+|
++  -
+    kind: "message-v1"
+    backtrace:(
+      - "[^"]+")+
+    message: \|(
++      [^
+]*)*)*
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsSuppressed.cmake:[0-9]+ \(message\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      NotDefined -> NotFound
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsSuppressed.cmake:[0-9]+ \(find_file\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      NotFound -> NotFound
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsSuppressed.cmake:[0-9]+ \(find_file\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      NotDefined -> Found
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsSuppressed.cmake:[0-9]+ \(find_file\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      Found -> Found
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsSuppressed.cmake:[0-9]+ \(find_file\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      Found -> NotFound
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsSuppressed.cmake:[0-9]+ \(find_file\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      NotFound -> Found
+...

+ 24 - 0
Tests/RunCMake/find_file/ConfigureLogTransitionsSuppressed.cmake

@@ -0,0 +1,24 @@
+set(CMAKE_FIND_DEBUG_MODE_NO_IMPLICIT_CONFIGURE_LOG 1)
+
+set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
+
+message(CONFIGURE_LOG "NotDefined -> NotFound")
+find_file(NOEXIST_FILE NAMES NoExist.h)
+
+message(CONFIGURE_LOG "NotFound -> NotFound")
+find_file(NOEXIST_FILE NAMES NoExist.h)
+
+message(CONFIGURE_LOG "NotDefined -> Found")
+find_file(PREFIX_IN_PATH NAMES PrefixInPATH.h)
+
+message(CONFIGURE_LOG "Found -> Found")
+find_file(PREFIX_IN_PATH NAMES PrefixInPATH.h)
+
+message(CONFIGURE_LOG "Found -> NotFound")
+unset(PREFIX_IN_PATH CACHE)
+unset(CMAKE_PREFIX_PATH)
+find_file(PREFIX_IN_PATH NAMES PrefixInPATH.h)
+
+message(CONFIGURE_LOG "NotFound -> Found")
+set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
+find_file(PREFIX_IN_PATH NAMES PrefixInPATH.h)

+ 1 - 0
Tests/RunCMake/find_file/RunCMakeTest.cmake

@@ -1,6 +1,7 @@
 include(RunCMake)
 
 run_cmake(ConfigureLogTransitions)
+run_cmake(ConfigureLogTransitionsSuppressed)
 run_cmake(FromPATHEnv)
 run_cmake(FromPrefixPath)
 run_cmake(PrefixInPATH)

+ 57 - 0
Tests/RunCMake/find_library/ConfigureLogTransitionsSuppressed-config.txt

@@ -0,0 +1,57 @@
+^
+---
+events:(
+  -
+    kind: "find-v1"(
+    [^
+]*)+|
++  -
+    kind: "message-v1"
+    backtrace:(
+      - "[^"]+")+
+    message: \|(
++      [^
+]*)*)*
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsSuppressed.cmake:[0-9]+ \(message\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      NotDefined -> NotFound
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsSuppressed.cmake:[0-9]+ \(find_library\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      NotFound -> NotFound
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsSuppressed.cmake:[0-9]+ \(find_library\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      NotDefined -> Found
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsSuppressed.cmake:[0-9]+ \(find_library\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      Found -> Found
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsSuppressed.cmake:[0-9]+ \(find_library\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      Found -> NotFound
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsSuppressed.cmake:[0-9]+ \(find_library\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      NotFound -> Found
+...

+ 24 - 0
Tests/RunCMake/find_library/ConfigureLogTransitionsSuppressed.cmake

@@ -0,0 +1,24 @@
+set(CMAKE_FIND_DEBUG_MODE_NO_IMPLICIT_CONFIGURE_LOG 1)
+
+set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
+
+message(CONFIGURE_LOG "NotDefined -> NotFound")
+find_library(NOEXIST_FILE NAMES NoExist)
+
+message(CONFIGURE_LOG "NotFound -> NotFound")
+find_library(NOEXIST_FILE NAMES NoExist)
+
+message(CONFIGURE_LOG "NotDefined -> Found")
+find_library(PREFIX_IN_PATH NAMES PrefixInPATH)
+
+message(CONFIGURE_LOG "Found -> Found")
+find_library(PREFIX_IN_PATH NAMES PrefixInPATH)
+
+message(CONFIGURE_LOG "Found -> NotFound")
+unset(PREFIX_IN_PATH CACHE)
+unset(CMAKE_PREFIX_PATH)
+find_library(PREFIX_IN_PATH NAMES PrefixInPATH)
+
+message(CONFIGURE_LOG "NotFound -> Found")
+set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
+find_library(PREFIX_IN_PATH NAMES PrefixInPATH)

+ 1 - 0
Tests/RunCMake/find_library/RunCMakeTest.cmake

@@ -1,6 +1,7 @@
 include(RunCMake)
 
 run_cmake(ConfigureLogTransitions)
+run_cmake(ConfigureLogTransitionsSuppressed)
 run_cmake(Created)
 run_cmake(FromPrefixPath)
 run_cmake(FromPATHEnv)

+ 57 - 0
Tests/RunCMake/find_package/ConfigureLogTransitionsConfig2Suppressed-config.txt

@@ -0,0 +1,57 @@
+^
+---
+events:(
+  -
+    kind: "find-v1"(
+    [^
+]*)+|
++  -
+    kind: "message-v1"
+    backtrace:(
+      - "[^"]+")+
+    message: \|(
++      [^
+]*)*)*
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsConfig2Suppressed.cmake:[0-9]+ \(message\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      NotDefined -> NotFound
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsConfig2Suppressed.cmake:[0-9]+ \(message\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      NotFound -> NotFound
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsConfig2Suppressed.cmake:[0-9]+ \(message\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: \|
+      NotFound -> Found
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsConfig2Suppressed.cmake:[0-9]+ \(message\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: \|
+      Found -> Found
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsConfig2Suppressed.cmake:[0-9]+ \(message\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: \|
+      Found -> NotFound
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsConfig2Suppressed.cmake:[0-9]+ \(message\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: \|
+      END
+\.\.\.$

+ 63 - 0
Tests/RunCMake/find_package/ConfigureLogTransitionsConfig2Suppressed-stderr.txt

@@ -0,0 +1,63 @@
+^NotDefined -> NotFound
+CMake Warning at ConfigureLogTransitionsConfig2Suppressed.cmake:[0-9]+ \(find_package\):
+  By not providing "FindViaConfig.cmake" in CMAKE_MODULE_PATH this project
+  has asked CMake to find a package configuration file provided by
+  "ViaConfig", but CMake did not find one.
+
+  Could not find a package configuration file provided by "ViaConfig" with
+  any of the following names:
+
+    ViaConfigConfig.cmake
+    viaconfig-config.cmake
+
+  Add the installation prefix of "ViaConfig" to CMAKE_PREFIX_PATH or set
+  "ViaConfig_DIR" to a directory containing one of the above files.  If
+  "ViaConfig" provides a separate development package or SDK, be sure it has
+  been installed.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:[0-9]+ \(include\)
+
+
+NotFound -> NotFound
+CMake Warning at ConfigureLogTransitionsConfig2Suppressed.cmake:[0-9]+ \(find_package\):
+  By not providing "FindViaConfig.cmake" in CMAKE_MODULE_PATH this project
+  has asked CMake to find a package configuration file provided by
+  "ViaConfig", but CMake did not find one.
+
+  Could not find a package configuration file provided by "ViaConfig" with
+  any of the following names:
+
+    ViaConfigConfig.cmake
+    viaconfig-config.cmake
+
+  Add the installation prefix of "ViaConfig" to CMAKE_PREFIX_PATH or set
+  "ViaConfig_DIR" to a directory containing one of the above files.  If
+  "ViaConfig" provides a separate development package or SDK, be sure it has
+  been installed.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:[0-9]+ \(include\)
+
+
+NotFound -> Found
+Found -> Found
+Found -> NotFound
+CMake Warning at ConfigureLogTransitionsConfig2Suppressed.cmake:[0-9]+ \(find_package\):
+  By not providing "FindViaConfig.cmake" in CMAKE_MODULE_PATH this project
+  has asked CMake to find a package configuration file provided by
+  "ViaConfig", but CMake did not find one.
+
+  Could not find a package configuration file provided by "ViaConfig" with
+  any of the following names:
+
+    ViaConfigConfig.cmake
+    viaconfig-config.cmake
+
+  Add the installation prefix of "ViaConfig" to CMAKE_PREFIX_PATH or set
+  "ViaConfig_DIR" to a directory containing one of the above files.  If
+  "ViaConfig" provides a separate development package or SDK, be sure it has
+  been installed.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:[0-9]+ \(include\)
+
+
+END

+ 45 - 0
Tests/RunCMake/find_package/ConfigureLogTransitionsConfig2Suppressed.cmake

@@ -0,0 +1,45 @@
+set(CMAKE_FIND_DEBUG_MODE_NO_IMPLICIT_CONFIGURE_LOG 1)
+
+# Stable sorting for predictable behaviors.
+set(CMAKE_FIND_PACKAGE_SORT_ORDER NAME)
+
+# Unset search variables for more predictable output.
+unset(CMAKE_FRAMEWORK_PATH)
+unset(CMAKE_APPBUNDLE_PATH)
+unset(ENV{CMAKE_PREFIX_PATH})
+unset(ENV{CMAKE_FRAMEWORK_PATH})
+unset(ENV{CMAKE_APPBUNDLE_PATH})
+
+message("NotDefined -> NotFound")
+message(CONFIGURE_LOG "NotDefined -> NotFound")
+find_package(ViaConfig)
+
+message("NotFound -> NotFound")
+message(CONFIGURE_LOG "NotFound -> NotFound")
+find_package(ViaConfig)
+
+list(INSERT CMAKE_MODULE_PATH 0
+  "${CMAKE_CURRENT_LIST_DIR}/ConfigureLog/cmake")
+list(INSERT CMAKE_PREFIX_PATH 0
+  "${CMAKE_CURRENT_LIST_DIR}/ConfigureLog")
+
+message("NotFound -> Found")
+message(CONFIGURE_LOG "NotFound -> Found")
+find_package(ViaConfig)
+
+message("Found -> Found")
+message(CONFIGURE_LOG "Found -> Found")
+find_package(ViaConfig)
+
+message("Found -> NotFound")
+message(CONFIGURE_LOG "Found -> NotFound")
+list(REMOVE_AT CMAKE_PREFIX_PATH 0)
+list(REMOVE_AT CMAKE_MODULE_PATH 0)
+set_property(CACHE ViaConfig_DIR
+  PROPERTY
+    VALUE "${CMAKE_CURRENT_SOURCE_DIR}")
+
+find_package(ViaConfig)
+
+message("END")
+message(CONFIGURE_LOG "END")

+ 57 - 0
Tests/RunCMake/find_package/ConfigureLogTransitionsConfigSuppressed-config.txt

@@ -0,0 +1,57 @@
+^
+---
+events:(
+  -
+    kind: "find-v1"(
+    [^
+]*)+|
++  -
+    kind: "message-v1"
+    backtrace:(
+      - "[^"]+")+
+    message: \|(
++      [^
+]*)*)*
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsConfigSuppressed.cmake:[0-9]+ \(message\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      NotDefined -> NotFound
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsConfigSuppressed.cmake:[0-9]+ \(message\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      NotFound -> NotFound
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsConfigSuppressed.cmake:[0-9]+ \(message\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: \|
+      NotFound -> Found
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsConfigSuppressed.cmake:[0-9]+ \(message\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: \|
+      Found -> Found
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsConfigSuppressed.cmake:[0-9]+ \(message\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: \|
+      Found -> NotFound
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsConfigSuppressed.cmake:[0-9]+ \(message\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: \|
+      END
+\.\.\.$

+ 9 - 0
Tests/RunCMake/find_package/ConfigureLogTransitionsConfigSuppressed-stdout.txt

@@ -0,0 +1,9 @@
+-- NotDefined -> NotFound
+-- Could NOT find ViaConfig \(missing: ViaConfig_DIR\)
+-- NotFound -> NotFound
+-- Could NOT find ViaConfig \(missing: ViaConfig_DIR\)
+-- NotFound -> Found
+-- Found -> Found
+-- Found -> NotFound
+-- Could NOT find ViaConfig \(missing: ViaConfig_DIR\)
+-- END

+ 45 - 0
Tests/RunCMake/find_package/ConfigureLogTransitionsConfigSuppressed.cmake

@@ -0,0 +1,45 @@
+set(CMAKE_FIND_DEBUG_MODE_NO_IMPLICIT_CONFIGURE_LOG 1)
+
+# Stable sorting for predictable behaviors.
+set(CMAKE_FIND_PACKAGE_SORT_ORDER NAME)
+
+# Unset search variables for more predictable output.
+unset(CMAKE_FRAMEWORK_PATH)
+unset(CMAKE_APPBUNDLE_PATH)
+unset(ENV{CMAKE_PREFIX_PATH})
+unset(ENV{CMAKE_FRAMEWORK_PATH})
+unset(ENV{CMAKE_APPBUNDLE_PATH})
+
+message(STATUS "NotDefined -> NotFound")
+message(CONFIGURE_LOG "NotDefined -> NotFound")
+find_package(ViaConfig CONFIG)
+
+message(STATUS "NotFound -> NotFound")
+message(CONFIGURE_LOG "NotFound -> NotFound")
+find_package(ViaConfig CONFIG)
+
+list(INSERT CMAKE_MODULE_PATH 0
+  "${CMAKE_CURRENT_LIST_DIR}/ConfigureLog/cmake")
+list(INSERT CMAKE_PREFIX_PATH 0
+  "${CMAKE_CURRENT_LIST_DIR}/ConfigureLog")
+
+message(STATUS "NotFound -> Found")
+message(CONFIGURE_LOG "NotFound -> Found")
+find_package(ViaConfig CONFIG)
+
+message(STATUS "Found -> Found")
+message(CONFIGURE_LOG "Found -> Found")
+find_package(ViaConfig CONFIG)
+
+message(STATUS "Found -> NotFound")
+message(CONFIGURE_LOG "Found -> NotFound")
+list(REMOVE_AT CMAKE_PREFIX_PATH 0)
+list(REMOVE_AT CMAKE_MODULE_PATH 0)
+set_property(CACHE ViaConfig_DIR
+  PROPERTY
+    VALUE "${CMAKE_CURRENT_SOURCE_DIR}")
+
+find_package(ViaConfig CONFIG)
+
+message(STATUS "END")
+message(CONFIGURE_LOG "END")

+ 57 - 0
Tests/RunCMake/find_package/ConfigureLogTransitionsModule2Suppressed-config.txt

@@ -0,0 +1,57 @@
+^
+---
+events:(
+  -
+    kind: "find-v1"(
+    [^
+]*)+|
++  -
+    kind: "message-v1"
+    backtrace:(
+      - "[^"]+")+
+    message: \|(
++      [^
+]*)*)*
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsModule2Suppressed.cmake:[0-9]+ \(message\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: \|
+      NotDefined -> NotFound
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsModule2Suppressed.cmake:[0-9]+ \(message\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: \|
+      NotFound -> NotFound
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsModule2Suppressed.cmake:[0-9]+ \(message\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: \|
+      NotFound -> Found
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsModule2Suppressed.cmake:[0-9]+ \(message\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: \|
+      Found -> Found
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsModule2Suppressed.cmake:[0-9]+ \(message\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: \|
+      Found -> NotFound
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsModule2Suppressed.cmake:[0-9]+ \(message\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: \|
+      END
+\.\.\.$

+ 63 - 0
Tests/RunCMake/find_package/ConfigureLogTransitionsModule2Suppressed-stderr.txt

@@ -0,0 +1,63 @@
+^NotDefined -> NotFound
+CMake Warning at ConfigureLogTransitionsModule2Suppressed.cmake:[0-9]+ \(find_package\):
+  By not providing "FindViaModule.cmake" in CMAKE_MODULE_PATH this project
+  has asked CMake to find a package configuration file provided by
+  "ViaModule", but CMake did not find one.
+
+  Could not find a package configuration file provided by "ViaModule" with
+  any of the following names:
+
+    ViaModuleConfig.cmake
+    viamodule-config.cmake
+
+  Add the installation prefix of "ViaModule" to CMAKE_PREFIX_PATH or set
+  "ViaModule_DIR" to a directory containing one of the above files.  If
+  "ViaModule" provides a separate development package or SDK, be sure it has
+  been installed.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:[0-9]+ \(include\)
+
+
+NotFound -> NotFound
+CMake Warning at ConfigureLogTransitionsModule2Suppressed.cmake:[0-9]+ \(find_package\):
+  By not providing "FindViaModule.cmake" in CMAKE_MODULE_PATH this project
+  has asked CMake to find a package configuration file provided by
+  "ViaModule", but CMake did not find one.
+
+  Could not find a package configuration file provided by "ViaModule" with
+  any of the following names:
+
+    ViaModuleConfig.cmake
+    viamodule-config.cmake
+
+  Add the installation prefix of "ViaModule" to CMAKE_PREFIX_PATH or set
+  "ViaModule_DIR" to a directory containing one of the above files.  If
+  "ViaModule" provides a separate development package or SDK, be sure it has
+  been installed.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:[0-9]+ \(include\)
+
+
+NotFound -> Found
+Found -> Found
+Found -> NotFound
+CMake Warning at ConfigureLogTransitionsModule2Suppressed.cmake:[0-9]+ \(find_package\):
+  By not providing "FindViaModule.cmake" in CMAKE_MODULE_PATH this project
+  has asked CMake to find a package configuration file provided by
+  "ViaModule", but CMake did not find one.
+
+  Could not find a package configuration file provided by "ViaModule" with
+  any of the following names:
+
+    ViaModuleConfig.cmake
+    viamodule-config.cmake
+
+  Add the installation prefix of "ViaModule" to CMAKE_PREFIX_PATH or set
+  "ViaModule_DIR" to a directory containing one of the above files.  If
+  "ViaModule" provides a separate development package or SDK, be sure it has
+  been installed.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:[0-9]+ \(include\)
+
+
+END$

+ 42 - 0
Tests/RunCMake/find_package/ConfigureLogTransitionsModule2Suppressed.cmake

@@ -0,0 +1,42 @@
+set(CMAKE_FIND_DEBUG_MODE_NO_IMPLICIT_CONFIGURE_LOG 1)
+
+# Stable sorting for predictable behaviors.
+set(CMAKE_FIND_PACKAGE_SORT_ORDER NAME)
+
+# Unset search variables for more predictable output.
+unset(CMAKE_FRAMEWORK_PATH)
+unset(CMAKE_APPBUNDLE_PATH)
+unset(ENV{CMAKE_PREFIX_PATH})
+unset(ENV{CMAKE_FRAMEWORK_PATH})
+unset(ENV{CMAKE_APPBUNDLE_PATH})
+
+message("NotDefined -> NotFound")
+message(CONFIGURE_LOG "NotDefined -> NotFound")
+find_package(ViaModule)
+
+message("NotFound -> NotFound")
+message(CONFIGURE_LOG "NotFound -> NotFound")
+find_package(ViaModule)
+
+list(INSERT CMAKE_MODULE_PATH 0
+  "${CMAKE_CURRENT_LIST_DIR}/ConfigureLog/cmake")
+list(INSERT CMAKE_PREFIX_PATH 0
+  "${CMAKE_CURRENT_LIST_DIR}/ConfigureLog")
+
+message("NotFound -> Found")
+message(CONFIGURE_LOG "NotFound -> Found")
+find_package(ViaModule)
+
+message("Found -> Found")
+message(CONFIGURE_LOG "Found -> Found")
+find_package(ViaModule)
+
+message("Found -> NotFound")
+message(CONFIGURE_LOG "Found -> NotFound")
+list(REMOVE_AT CMAKE_PREFIX_PATH 0)
+list(REMOVE_AT CMAKE_MODULE_PATH 0)
+
+find_package(ViaModule)
+
+message("END")
+message(CONFIGURE_LOG "END")

+ 3 - 0
Tests/RunCMake/find_package/RunCMakeTest.cmake

@@ -9,9 +9,12 @@ run_cmake(ConfigureLog)
 run_cmake(ConfigureLogParameters1)
 run_cmake(ConfigureLogParameters2)
 run_cmake(ConfigureLogTransitionsConfig) # with `CONFIG`
+run_cmake(ConfigureLogTransitionsConfigSuppressed)
 run_cmake(ConfigureLogTransitionsConfig2) # without `CONFIG`, finding config
+run_cmake(ConfigureLogTransitionsConfig2Suppressed)
 run_cmake(ConfigureLogTransitionsModule) # with `MODULE`
 run_cmake(ConfigureLogTransitionsModule2) # without `MODULE`, finding module
+run_cmake(ConfigureLogTransitionsModule2Suppressed)
 run_cmake(EmptyRoots)
 run_cmake(FromPATHEnv)
 run_cmake_with_options(FromPATHEnvDebugPkg --debug-find-pkg=Resolved)

+ 57 - 0
Tests/RunCMake/find_path/ConfigureLogTransitionsSuppressed-config.txt

@@ -0,0 +1,57 @@
+^
+---
+events:(
+  -
+    kind: "find-v1"(
+    [^
+]*)+|
++  -
+    kind: "message-v1"
+    backtrace:(
+      - "[^"]+")+
+    message: \|(
++      [^
+]*)*)*
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsSuppressed.cmake:[0-9]+ \(message\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      NotDefined -> NotFound
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsSuppressed.cmake:[0-9]+ \(find_path\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      NotFound -> NotFound
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsSuppressed.cmake:[0-9]+ \(find_path\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      NotDefined -> Found
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsSuppressed.cmake:[0-9]+ \(find_path\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      Found -> Found
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsSuppressed.cmake:[0-9]+ \(find_path\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      Found -> NotFound
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsSuppressed.cmake:[0-9]+ \(find_path\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      NotFound -> Found
+...

+ 24 - 0
Tests/RunCMake/find_path/ConfigureLogTransitionsSuppressed.cmake

@@ -0,0 +1,24 @@
+set(CMAKE_FIND_DEBUG_MODE_NO_IMPLICIT_CONFIGURE_LOG 1)
+
+set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
+
+message(CONFIGURE_LOG "NotDefined -> NotFound")
+find_path(NOEXIST_FILE NAMES NoExist.h)
+
+message(CONFIGURE_LOG "NotFound -> NotFound")
+find_path(NOEXIST_FILE NAMES NoExist.h)
+
+message(CONFIGURE_LOG "NotDefined -> Found")
+find_path(PREFIX_IN_PATH NAMES PrefixInPATH.h)
+
+message(CONFIGURE_LOG "Found -> Found")
+find_path(PREFIX_IN_PATH NAMES PrefixInPATH.h)
+
+message(CONFIGURE_LOG "Found -> NotFound")
+unset(PREFIX_IN_PATH CACHE)
+unset(CMAKE_PREFIX_PATH)
+find_path(PREFIX_IN_PATH NAMES PrefixInPATH.h)
+
+message(CONFIGURE_LOG "NotFound -> Found")
+set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
+find_path(PREFIX_IN_PATH NAMES PrefixInPATH.h)

+ 1 - 0
Tests/RunCMake/find_path/RunCMakeTest.cmake

@@ -1,6 +1,7 @@
 include(RunCMake)
 
 run_cmake(ConfigureLogTransitions)
+run_cmake(ConfigureLogTransitionsSuppressed)
 run_cmake(EmptyOldStyle)
 run_cmake(FromPATHEnv)
 run_cmake(PrefixInPATH)

+ 57 - 0
Tests/RunCMake/find_program/ConfigureLogTransitionsSuppressed-config.txt

@@ -0,0 +1,57 @@
+^
+---
+events:(
+  -
+    kind: "find-v1"(
+    [^
+]*)+|
++  -
+    kind: "message-v1"
+    backtrace:(
+      - "[^"]+")+
+    message: \|(
++      [^
+]*)*)*
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsSuppressed.cmake:[0-9]+ \(message\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      NotDefined -> NotFound
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsSuppressed.cmake:[0-9]+ \(find_program\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      NotFound -> NotFound
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsSuppressed.cmake:[0-9]+ \(find_program\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      NotDefined -> Found
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsSuppressed.cmake:[0-9]+ \(message\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      Found -> Found
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsSuppressed.cmake:[0-9]+ \(find_program\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      Found -> NotFound
+  -
+    kind: "message-v1"
+    backtrace:
+      - "ConfigureLogTransitionsSuppressed.cmake:[0-9]+ \(find_program\)"
+      - "CMakeLists.txt:[0-9]+ \(include\)"
+    message: |
+      NotFound -> Found
+...

+ 24 - 0
Tests/RunCMake/find_program/ConfigureLogTransitionsSuppressed.cmake

@@ -0,0 +1,24 @@
+set(CMAKE_FIND_DEBUG_MODE_NO_IMPLICIT_CONFIGURE_LOG 1)
+
+set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Prefix")
+
+message(CONFIGURE_LOG "NotDefined -> NotFound")
+find_program(NOEXIST_FILE NAMES NoExist)
+
+message(CONFIGURE_LOG "NotFound -> NotFound")
+find_program(NOEXIST_FILE NAMES NoExist)
+
+message(CONFIGURE_LOG "NotDefined -> Found")
+find_program(PREFIX_IN_PATH NAMES prog)
+
+message(CONFIGURE_LOG "Found -> Found")
+find_program(PREFIX_IN_PATH NAMES prog)
+
+message(CONFIGURE_LOG "Found -> NotFound")
+unset(PREFIX_IN_PATH CACHE)
+unset(CMAKE_PREFIX_PATH)
+find_program(PREFIX_IN_PATH NAMES prog)
+
+message(CONFIGURE_LOG "NotFound -> Found")
+set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
+find_program(PREFIX_IN_PATH NAMES prog)

+ 1 - 0
Tests/RunCMake/find_program/RunCMakeTest.cmake

@@ -1,6 +1,7 @@
 include(RunCMake)
 
 run_cmake(ConfigureLogTransitions)
+run_cmake(ConfigureLogTransitionsSuppressed)
 run_cmake(EnvAndHints)
 run_cmake(DirsPerName)
 run_cmake(NamesPerDir)