X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=Debian%2FDebhelper%2FBuildsystem%2Fcmake.pm;h=d4a98f43be2dd592531fa4312ba0da9d437947c3;hb=cd7215f3fc6f01aea455a80240ab59ddc04f3a7f;hp=a30fbb03060e186364a029444849fecd90745fac;hpb=f72b0db0446788a867c5115845b28371ab5f0e9b;p=debhelper.git diff --git a/Debian/Debhelper/Buildsystem/cmake.pm b/Debian/Debhelper/Buildsystem/cmake.pm index a30fbb0..d4a98f4 100644 --- a/Debian/Debhelper/Buildsystem/cmake.pm +++ b/Debian/Debhelper/Buildsystem/cmake.pm @@ -1,5 +1,5 @@ -# A buildsystem plugin for handling CMake based projects. -# It enforces out of source tree building. +# A debhelper build system class for handling CMake based projects. +# It prefers out of source tree building. # # Copyright: © 2008-2009 Modestas Vainius # License: GPL-2+ @@ -16,16 +16,22 @@ sub DESCRIPTION { sub check_auto_buildable { my $this=shift; my ($step)=@_; - my $ret = -e $this->get_sourcepath("CMakeLists.txt"); - $ret &&= $this->SUPER::check_auto_buildable(@_) if $step ne "configure"; - return $ret; + if (-e $this->get_sourcepath("CMakeLists.txt")) { + my $ret = ($step eq "configure" && 1) || + $this->SUPER::check_auto_buildable(@_); + # Existence of CMakeCache.txt indicates cmake has already + # been used by a prior build step, so should be used + # instead of the parent makefile class. + $ret++ if ($ret && -e $this->get_buildpath("CMakeCache.txt")); + return $ret; + } + return 0; } sub new { my $class=shift; my $this=$class->SUPER::new(@_); - # Enforce out of source tree building. - $this->enforce_out_of_source_building(); + $this->prefer_out_of_source_building(@_); return $this; } @@ -35,14 +41,17 @@ sub configure { # Standard set of 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"; $this->mkdir_builddir(); - $this->doit_in_builddir("cmake", $this->get_source_rel2builddir(), @flags); + $this->doit_in_builddir("cmake", $this->get_source_rel2builddir(), @flags, @_); } -1; +sub test { + my $this=shift; + + $ENV{CTEST_OUTPUT_ON_FAILURE} = 1; + return $this->SUPER::test(@_); +} + +1