1 # A buildsystem plugin for handling CMake based projects.
2 # It enforces outside-source building.
4 # Copyright: © 2008-2009 Modestas Vainius
7 package Debian::Debhelper::Buildsystem::cmake;
10 use Debian::Debhelper::Dh_Lib;
11 use base 'Debian::Debhelper::Buildsystem::makefile';
14 "support for building CMake based packages (outside-source tree only)"
17 sub check_auto_buildable {
20 my $ret = -e "CMakeLists.txt";
21 $ret &&= $self->SUPER::check_auto_buildable(@_) if $action ne "configure";
27 my $self=$cls->SUPER::new(@_);
28 # Enforce outside-source tree builds.
29 $self->enforce_outside_source_building();
37 # Standard set of cmake flags
38 push @flags, "-DCMAKE_INSTALL_PREFIX=/usr";
39 push @flags, "-DCMAKE_C_FLAGS=$ENV{CFLAGS}" if (exists $ENV{CFLAGS});
40 push @flags, "-DCMAKE_CXX_FLAGS=$ENV{CXXFLAGS}" if (exists $ENV{CXXFLAGS});
41 push @flags, "-DCMAKE_LD_FLAGS=$ENV{LDFLAGS}" if (exists $ENV{LDFLAGS});
42 push @flags, "-DCMAKE_SKIP_RPATH=ON";
43 push @flags, "-DCMAKE_VERBOSE_MAKEFILE=ON";
45 $self->mkdir_builddir();
46 $self->doit_in_builddir("cmake", $self->get_rel2builddir_path(), @flags);