Output a better error when pkg-config is not found - close #169
This commit is contained in:
parent
b490daa480
commit
a7b962c11a
5
build_tests/configure/check_cfg_no_pkg_config.rb
Normal file
5
build_tests/configure/check_cfg_no_pkg_config.rb
Normal file
@ -0,0 +1,5 @@
|
||||
ENV["PATH"] = ""
|
||||
|
||||
configure do
|
||||
check_cfg package: "mypackage"
|
||||
end
|
||||
@ -125,7 +125,12 @@ module Rscons
|
||||
elsif program = options[:program]
|
||||
Ansi.write($stdout, "Checking '", :cyan, program, :reset, "'... ")
|
||||
end
|
||||
program ||= "pkg-config"
|
||||
unless program
|
||||
program = "pkg-config"
|
||||
unless Util.find_executable(program)
|
||||
raise RsconsError.new("Error: executable '#{program}' not found")
|
||||
end
|
||||
end
|
||||
args = options[:args] || %w[--cflags --libs]
|
||||
command = [program, *args, package].compact
|
||||
stdout, _, status = log_and_test_command(command)
|
||||
|
||||
@ -2369,6 +2369,13 @@ EOF
|
||||
expect(result.stdout).to_not match /gcc.*-o.*myconfigtest1.*-DMYPACKAGE/
|
||||
expect(result.stdout).to match /gcc.*-o.*myconfigtest2.*-DMYPACKAGE/
|
||||
end
|
||||
|
||||
it "indicates that pkg-config command cannot be found" do
|
||||
test_dir "configure"
|
||||
result = run_rscons(args: %w[-f check_cfg_no_pkg_config.rb configure])
|
||||
expect(result.stderr).to match /Error: executable 'pkg-config' not found/
|
||||
expect(result.status).to_not eq 0
|
||||
end
|
||||
end
|
||||
|
||||
context "when passed a program" do
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user