Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

formula: set CMAKE_PROGRAM_PATH to use shims #18742

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Library/Homebrew/formula.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1820,10 +1820,12 @@
install_prefix: T.any(String, Pathname),
install_libdir: T.any(String, Pathname),
find_framework: String,
program_path: T.nilable(T::Array[String]),
).returns(T::Array[String])
}
def std_cmake_args(install_prefix: prefix, install_libdir: "lib", find_framework: "LAST")
%W[
def std_cmake_args(install_prefix: prefix, install_libdir: "lib", find_framework: "LAST",
program_path: ENV["PATH"]&.split(File::PATH_SEPARATOR))
Comment on lines +1826 to +1827
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def std_cmake_args(install_prefix: prefix, install_libdir: "lib", find_framework: "LAST",
program_path: ENV["PATH"]&.split(File::PATH_SEPARATOR))
def std_cmake_args(install_prefix: prefix, install_libdir: "lib", find_framework: "LAST")

I suggest just using the contents of ENV["PATH"] unconditionally unless we know there are formulae that need to set this.

args = %W[
-DCMAKE_INSTALL_PREFIX=#{install_prefix}
-DCMAKE_INSTALL_LIBDIR=#{install_libdir}
-DCMAKE_BUILD_TYPE=Release
Expand All @@ -1833,6 +1835,12 @@
-Wno-dev
-DBUILD_TESTING=OFF
]
# Since we set CMAKE_PREFIX_PATH environment variable, find_program prioritizes
# those paths over PATH which causes shims (e.g. clang, ninja) to be skipped.
# We can't fix this in {Superenv} as CMAKE_PROGRAM_PATH environment variable has
# lower priority. Instead, we use the cache variable which has higher priority.
args << "-DCMAKE_PROGRAM_PATH=#{program_path.join(";")}" if program_path.present?
args

Check warning on line 1843 in Library/Homebrew/formula.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/formula.rb#L1843

Added line #L1843 was not covered by tests
end

# Standard parameters for configure builds.
Expand Down
Loading