Skip to content

Commit 7889cac

Browse files
bgilbertjpakkane
authored andcommitted
Log non-fatally if CMake doesn't find a package
If CMake fails to find a package, we should log it in meson-log.txt, but shouldn't bother the user unless there are details to report. In addition, we were calling mlog.warning() without fatal=False, so if msetup was called with --fatal-meson-warnings we'd fail the entire setup in this case, even for optional dependencies. Log a notice with fatal=False if CMake reported an error, and a debug message otherwise. Notably, the "even though Meson's preliminary check succeeded" case can occur when a dependency is missing but its Find*.cmake is shipped with CMake itself. Fixes: 92c517e ("output PACKAGE_NOT_FOUND_MESSAGE as warning when CMake package is not found")
1 parent 9589549 commit 7889cac

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mesonbuild/dependencies/cmake.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,11 +416,11 @@ def _detect_dep(self, name: str, package_version: str, modules: T.List[T.Tuple[s
416416
if not self.is_found:
417417
not_found_message = self.traceparser.get_cmake_var('PACKAGE_NOT_FOUND_MESSAGE')
418418
if len(not_found_message) > 0:
419-
mlog.warning(
419+
mlog.notice(
420420
'CMake reported that the package {} was not found with the following reason:\n'
421-
'{}'.format(name, not_found_message[0]))
421+
'{}'.format(name, not_found_message[0]), fatal=False)
422422
else:
423-
mlog.warning(
423+
mlog.debug(
424424
'CMake reported that the package {} was not found, '
425425
'even though Meson\'s preliminary check succeeded.'.format(name))
426426
raise self._gen_exception('PACKAGE_FOUND is false')

0 commit comments

Comments
 (0)