caveats: suggest setting CMAKE_PREFIX_PATH when appropriate

Inspired by Homebrew/homebrew-core#235513.

It doesn't quite fix that issue, because `libomp` does not ship CMake
config files, but this would probably still be useful for keg-only
formulae that do ship CMake config files.

While we're here, let's replace the `pkg-config` references with the
now-canonical name `pkgconf`.
This commit is contained in:
Carlo Cabrera 2025-08-30 02:40:17 +08:00 committed by Carlo Cabrera
parent 9219495eb0
commit b8acc73278
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0

View File

@ -95,11 +95,11 @@ class Caveats
s << " #{Utils::Shell.export_value("CPPFLAGS", "-I#{formula.opt_include}")}\n" if formula.include.directory?
if which("pkg-config", ORIGINAL_PATHS) &&
if which("pkgconf", ORIGINAL_PATHS) &&
((formula.lib/"pkgconfig").directory? || (formula.share/"pkgconfig").directory?)
s << <<~EOS
For pkg-config to find #{formula.name} you may need to set:
For pkgconf to find #{formula.name} you may need to set:
EOS
if (formula.lib/"pkgconfig").directory?
@ -110,6 +110,15 @@ class Caveats
s << " #{Utils::Shell.export_value("PKG_CONFIG_PATH", "#{formula.opt_share}/pkgconfig")}\n"
end
end
if which("cmake", ORIGINAL_PATHS) &&
((formula.lib/"cmake").directory? || (formula.share/"cmake").directory?)
s << <<~EOS
For cmake to find #{formula.name} you may need to set:
#{Utils::Shell.export_value("CMAKE_PREFIX_PATH", formula.opt_prefix.to_s)}
EOS
end
end
s << "\n" unless s.end_with?("\n")
s