[jhbuild] CMake on Windows/MSYS: use "MSYS Makefiles" as default generator



commit b29cfb92d8b981a276ac6b43f7c02ca0e2353a63
Author: Marcin Wojdyr <wojdyr gmail com>
Date:   Tue Jun 26 12:28:29 2012 +0100

    CMake on Windows/MSYS: use "MSYS Makefiles" as default generator
    
    Default CMake generator on Windows is VS project if VS is installed
    or NMake makefiles otherwise. Since they don't work with JHBuild
    MSYS Makefiles is a better guess for MinGW/MSYS.

 jhbuild/modtypes/cmake.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/jhbuild/modtypes/cmake.py b/jhbuild/modtypes/cmake.py
index 9297da8..6a20421 100644
--- a/jhbuild/modtypes/cmake.py
+++ b/jhbuild/modtypes/cmake.py
@@ -94,7 +94,13 @@ class CMakeModule(Package, DownloadableModule):
             raise CommandError(_('%s not found') % 'cmake')
         baseargs = '-DCMAKE_INSTALL_PREFIX=%s -DLIB_INSTALL_DIR=%s -Dlibdir=%s' % (
                         prefix, buildscript.config.libdir, buildscript.config.libdir)
-        cmd = 'cmake %s %s %s' % (baseargs, self.get_cmakeargs(), srcdir)
+        cmakeargs = self.get_cmakeargs()
+        # CMake on Windows generates VS projects or NMake makefiles by default.
+        # When using MSYS "MSYS Makefiles" is the best guess. "Unix Makefiles"
+        # and "MinGW Makefiles" could also work (each is a bit different).
+        if os.name == 'nt' and os.getenv("MSYSCON") and '-G' not in cmakeargs:
+            baseargs += ' -G "MSYS Makefiles"'
+        cmd = 'cmake %s %s %s' % (baseargs, cmakeargs, srcdir)
         if os.path.exists(os.path.join(builddir, 'CMakeCache.txt')):
             # remove that file, as it holds the result of a previous cmake
             # configure run, and would be reused unconditionnaly



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]