lib/autobuild/packages/cmake.rb in autobuild-1.4.1 vs lib/autobuild/packages/cmake.rb in autobuild-1.4.2

- old
+ new

@@ -11,17 +11,41 @@ def builddir=(new) raise ConfigException, "absolute builddirs are not supported" if (Pathname.new(new).absolute?) raise ConfigException, "builddir must be non-nil and non-empty" if (new.nil? || new.empty?) @builddir = new end + + attr_writer :full_reconfigures + def full_reconfigures? + @full_reconfigures + end end + @full_reconfigures = true # a key => value association of defines for CMake attr_reader :defines # If true, always run cmake before make during the build attr_accessor :always_reconfigure + # If true, we always remove the CMake cache before reconfiguring. + # + # See #full_reconfigures? for more details + attr_writer :full_reconfigures + # If true, we always remove the CMake cache before reconfiguring. This + # is to workaround the aggressive caching behaviour of CMake, and is set + # to true by default. + # + # See CMake.full_reconfigures? and CMake.full_reconfigures= for a global + # setting + def full_reconfigures? + if @full_reconfigures.nil? + CMake.full_reconfigures? + else + @full_reconfigures + end + end + def configurestamp; File.join(builddir, "CMakeCache.txt") end def initialize(options) @defines = Hash.new super @@ -124,9 +148,12 @@ command << "-D#{name}=#{value}" end command << srcdir Autobuild.progress "generating and configuring build system for #{name}" + if full_reconfigures? + FileUtils.rm_f configurestamp + end Subprocess.run(name, 'configure', *command) super end end