From 20ab54fd9f0853292bc88b768a3db3d12ed422fd Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Mon, 15 Mar 2021 03:22:41 +0000 Subject: [PATCH] formula_creator: use tool-agnostic cmake commands New versions of CMake know how to invoke the appropriate build tool (i.e. make or ninja), so let's try to leave that to CMake. This also builds out-of-tree, without having to deal with the `mkdir "build" do` business. --- Library/Homebrew/formula_creator.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/formula_creator.rb b/Library/Homebrew/formula_creator.rb index db78bdce52..81f6414dac 100644 --- a/Library/Homebrew/formula_creator.rb +++ b/Library/Homebrew/formula_creator.rb @@ -153,11 +153,14 @@ module Homebrew def install # ENV.deparallelize # if your formula fails when building in parallel <% if mode == :cmake %> - system "cmake", ".", *std_cmake_args + system "cmake", "-S", ".", "-B", "build", *std_cmake_args + system "cmake", "--build", "build" + system "cmake", "--install", "build" <% elsif mode == :autotools %> # Remove unrecognized options if warned by configure # https://rubydoc.brew.sh/Formula.html#std_configure_args-instance_method system "./configure", *std_configure_args, "--disable-silent-rules" + system "make", "install" # if this fails, try separate make/make install steps <% elsif mode == :crystal %> system "shards", "build", "--release" bin.install "bin/#{name}" @@ -206,10 +209,7 @@ module Homebrew # Remove unrecognized options if warned by configure # https://rubydoc.brew.sh/Formula.html#std_configure_args-instance_method system "./configure", *std_configure_args, "--disable-silent-rules" - # system "cmake", ".", *std_cmake_args - <% end %> - <% if mode == :autotools || mode == :cmake %> - system "make", "install" # if this fails, try separate make/make install steps + # system "cmake", "-S", ".", "-B", "build", *std_cmake_args <% end %> end