lib/autobuild/packages/cmake.rb in autobuild-1.5.53.rc1 vs lib/autobuild/packages/cmake.rb in autobuild-1.5.53

- old
+ new

@@ -3,10 +3,11 @@ module Autobuild def self.cmake(options, &block) CMake.new(options, &block) end + # Handler class to build CMake-based packages class CMake < Configurable class << self def builddir; @builddir || Configurable.builddir end def builddir=(new) raise ConfigException, "absolute builddirs are not supported" if (Pathname.new(new).absolute?) @@ -17,10 +18,17 @@ attr_writer :full_reconfigures def full_reconfigures? @full_reconfigures end + # Global default for the CMake generator to use. If nil (the + # default), the -G option will not be given at all. Will work only + # if the generator creates makefiles + # + # It can be overriden on a per-package basis with CMake.generator= + attr_accessor :generator + attr_reader :module_path end @module_path = [] @full_reconfigures = true @@ -30,10 +38,21 @@ attr_accessor :always_reconfigure # If true, we always remove the CMake cache before reconfiguring. # # See #full_reconfigures? for more details attr_writer :full_reconfigures + # Sets a generator explicitely for this component. See #generator and + # CMake.generator + attr_writer :generator + # The CMake generator to use. You must choose one that generates + # Makefiles. If not set for this package explicitely, it is using the + # global value CMake.generator. + def generator + if @generator then @generator + else CMake.generator + end + end # 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. # @@ -283,9 +302,12 @@ command = [ "cmake", "-DCMAKE_INSTALL_PREFIX=#{prefix}", "-DCMAKE_MODULE_PATH=#{CMake.module_path.join(";")}" ] defines.each do |name, value| command << "-D#{name}=#{value}" + end + if generator + command << "-G#{generator}" end command << srcdir progress "configuring CMake build system for %s" if full_reconfigures?