]> git.donarmstrong.com Git - debhelper.git/blobdiff - Debian/Debhelper/Buildsystem/cmake.pm
cmake: Only pass CPPFLAGS in CFLAGS in v9.
[debhelper.git] / Debian / Debhelper / Buildsystem / cmake.pm
index 24f486fc27329e1acf54d9839c7a513b3dcd581c..f318b44b827e7609dc116fbb1f98131a74af449e 100644 (file)
@@ -43,15 +43,33 @@ sub configure {
        push @flags, "-DCMAKE_INSTALL_PREFIX=/usr";
        push @flags, "-DCMAKE_VERBOSE_MAKEFILE=ON";
 
+       # CMake doesn't respect CPPFLAGS, see #653916.
+       if ($ENV{CPPFLAGS} && ! compat(8)) {
+               $ENV{CFLAGS}   .= ' ' . $ENV{CPPFLAGS};
+               $ENV{CXXFLAGS} .= ' ' . $ENV{CPPFLAGS};
+       }
+
        $this->mkdir_builddir();
-       $this->doit_in_builddir("cmake", $this->get_source_rel2builddir(), @flags, @_);
+       eval { 
+               $this->doit_in_builddir("cmake", $this->get_source_rel2builddir(), @flags, @_);
+       };
+       if ($@) {
+               if (-e $this->get_buildpath("CMakeCache.txt")) {
+                       $this->doit_in_builddir("tail -v -n +0 CMakeCache.txt");
+               }
+               die $@;
+       }
 }
 
 sub test {
        my $this=shift;
 
+       # Unlike make, CTest does not have "unlimited parallel" setting (-j implies
+       # -j1). So in order to simulate unlimited parallel, allow to fork a huge
+       # number of threads instead.
+       my $parallel = ($this->get_parallel() > 0) ? $this->get_parallel() : 999;
        $ENV{CTEST_OUTPUT_ON_FAILURE} = 1;
-       return $this->test(@_);
+       return $this->SUPER::test(@_, "ARGS+=-j$parallel");
 }
 
 1