Skip to content

Commit

Permalink
formula: set CMAKE_PROGRAM_PATH to use shims
Browse files Browse the repository at this point in the history
  • Loading branch information
cho-m committed Nov 9, 2024
1 parent 3b40ab6 commit 45ee2f5
Showing 1 changed file with 10 additions and 2 deletions.
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 @@ def std_cargo_args(root: prefix, path: ".")
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))
args = %W[
-DCMAKE_INSTALL_PREFIX=#{install_prefix}
-DCMAKE_INSTALL_LIBDIR=#{install_libdir}
-DCMAKE_BUILD_TYPE=Release
Expand All @@ -1833,6 +1835,12 @@ def std_cmake_args(install_prefix: prefix, install_libdir: "lib", find_framework
-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

0 comments on commit 45ee2f5

Please sign in to comment.