summaryrefslogtreecommitdiff
path: root/Debian/Debhelper/Buildsystem/cmake.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Debian/Debhelper/Buildsystem/cmake.pm')
-rw-r--r--Debian/Debhelper/Buildsystem/cmake.pm44
1 files changed, 21 insertions, 23 deletions
diff --git a/Debian/Debhelper/Buildsystem/cmake.pm b/Debian/Debhelper/Buildsystem/cmake.pm
index 00f6be4d..026004a0 100644
--- a/Debian/Debhelper/Buildsystem/cmake.pm
+++ b/Debian/Debhelper/Buildsystem/cmake.pm
@@ -10,45 +10,43 @@ use strict;
use Debian::Debhelper::Dh_Lib;
use base 'Debian::Debhelper::Buildsystem::makefile';
-sub _add_cmake_flag {
- my ($self, $name, $val) = @_;
- push @{$self->{cmake_flags}}, "-D$name=$val";
-}
-
sub DESCRIPTION {
"support for building CMake based packages (outside-source tree only)"
}
-sub is_buildable {
- return -e "CMakeLists.txt";
+sub is_auto_buildable {
+ my $self=shift;
+ my ($action)=@_;
+ my $ret = -e "CMakeLists.txt";
+ $ret &&= $self->SUPER::is_auto_buildable(@_) if $action ne "configure";
+ return $ret;
}
sub new {
my $cls=shift;
my $self=$cls->SUPER::new(@_);
- # Enfore outside-source tree builds.
+ # Enforce outside-source tree builds.
$self->enforce_outside_source_building();
- $self->{cmake_flags} = [];
return $self;
}
-sub configure_impl {
+sub configure {
my $self=shift;
+ my @flags;
# Standard set of cmake flags
- $self->_add_cmake_flag("CMAKE_INSTALL_PREFIX", "/usr");
- $self->_add_cmake_flag("CMAKE_C_FLAGS", $ENV{CFLAGS}) if (exists $ENV{CFLAGS});
- $self->_add_cmake_flag("CMAKE_CXX_FLAGS", $ENV{CXXFLAGS}) if (exists $ENV{CXXFLAGS});
- $self->_add_cmake_flag("CMAKE_SKIP_RPATH", "ON");
- $self->_add_cmake_flag("CMAKE_VERBOSE_MAKEFILE", "ON");
- # TODO: LDFLAGS
- # XXX JEH why are we using a method and an object
- # field to build up a simple one-time-use list?
- # my @flags;
- # push @flags, ... if $foo
-
- # XXX JEH again a non-sequitor get_topdir.
- doit("cmake", $self->get_topdir(), @{$self->{cmake_flags}}, @_);
+ push @flags, "-DCMAKE_INSTALL_PREFIX=/usr";
+ push @flags, "-DCMAKE_C_FLAGS=$ENV{CFLAGS}" if (exists $ENV{CFLAGS});
+ push @flags, "-DCMAKE_CXX_FLAGS=$ENV{CXXFLAGS}" if (exists $ENV{CXXFLAGS});
+ push @flags, "-DCMAKE_LD_FLAGS=$ENV{LDFLAGS}" if (exists $ENV{LDFLAGS});
+ push @flags, "-DCMAKE_SKIP_RPATH=ON";
+ push @flags, "-DCMAKE_VERBOSE_MAKEFILE=ON";
+
+ # XXX JEH again a non-sequitor get_topdir.
+ # XXX MDX I cannot avoid it as I need to pass the path to the sourcedir
+ # to cmake which is relative to the builddir.
+ $self->mkdir_builddir();
+ $self->doit_in_builddir("cmake", $self->get_rel2builddir_path(), @flags);
}
1;