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 "CMake (CMakeLists.txt)"
17 sub check_auto_buildable {
20 my $ret = -e "CMakeLists.txt";
21 $ret &&= $this->SUPER::check_auto_buildable(@_) if $action ne "configure";
27 my $this=$class->SUPER::new(@_);
28 # Enforce outside-source tree builds.
29 $this->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 $this->mkdir_builddir();
46 $this->doit_in_builddir("cmake", $this->get_rel2builddir_path(), @flags);