support false :use value for configure operations - close #93

This commit is contained in:
Josh Holtrop 2019-02-28 21:09:56 -05:00
parent f58744d31f
commit 06b9c98ed0
3 changed files with 32 additions and 9 deletions

View File

@ -0,0 +1,10 @@
configure do
check_lib "m", use: false
end
build do
Environment.new(echo: :command) do |env|
env.Copy("test1.c", "simple.c")
env.Program("test2.exe", "test1.c")
end
end

View File

@ -360,15 +360,19 @@ module Rscons
# @return [Hash] # @return [Hash]
# Configuration Hash for storing vars. # Configuration Hash for storing vars.
def store_common(options) def store_common(options)
usename = if options[:use] == false
if options[:use] {}
options[:use].to_s else
else usename =
"_default_" if options[:use]
end options[:use].to_s
cache = Cache.instance else
cache["configuration_data"]["vars"] ||= {} "_default_"
cache["configuration_data"]["vars"][usename] ||= {} end
cache = Cache.instance
cache["configuration_data"]["vars"] ||= {}
cache["configuration_data"]["vars"][usename] ||= {}
end
end end
# Perform processing common to several configure checks. # Perform processing common to several configure checks.

View File

@ -1806,6 +1806,15 @@ EOF
expect(result.stdout).to_not match /gcc.*test1.*-lm/ expect(result.stdout).to_not match /gcc.*test1.*-lm/
expect(result.stdout).to match /gcc.*test2.*-lm/ expect(result.stdout).to match /gcc.*test2.*-lm/
end end
it "does not link against the checked library if :use is set to false" do
test_dir "configure"
result = run_rscons(rsconscript: "check_lib_use_false.rb", op: "build")
expect(result.stderr).to eq ""
expect(result.status).to eq 0
expect(result.stdout).to match /Checking for library 'm'... found/
expect(result.stdout).to_not match /-lm/
end
end end
context "check_program" do context "check_program" do