Attached Files | CMDMakefiles.zip [^] (2,222 bytes) 2012-04-09 04:26
v2.8.7+0001-Add-CMD-Makefiles-generator-13112.patch [^] (6,451 bytes) 2012-04-10 11:08 [Show Content] [Hide Content]From aa5d6e3be974d567689ec2ddc44ba5c138f4dcd4 Mon Sep 17 00:00:00 2001
Message-Id: <aa5d6e3be974d567689ec2ddc44ba5c138f4dcd4.1334070450.git.brad.king@kitware.com>
From: "A. Saratow" <a@saratow.biz>
Date: Mon, 9 Apr 2012 04:26:00 -0400
Subject: [PATCH] Add "CMD Makefiles" generator (#13112)
It is already possible to use the 'Unix Makefiles' generator (using the
GNU Make for Windows package) on Windows systems together with the
Visual C++ compiler (cl.exe) instead of the GCC required by MSYS or
MinGW Makefiles.
Everything works fine except of the execution of custom build steps (Qt
QRC and UIC runs), because those executables are built as a part of the
solution and are located inside of the source root. CMake generates a
relative path for them (e.g. '../../Qt/bin/uic.exe') which breaks the
build at the according target, because cmd.exe fails to figure out how
to interpret the '/..' "option".
Add a new generator 'CMD Makefiles' (and documentation) and set the
WindowsShell flag on the created cmLocalGenerator instance to generate
backslash-separated paths.
---
Source/CMakeLists.txt | 2 +
Source/cmGlobalCMDMakefileGenerator.cxx | 38 ++++++++++++++++++++++++++++
Source/cmGlobalCMDMakefileGenerator.h | 41 +++++++++++++++++++++++++++++++
Source/cmake.cxx | 3 ++
4 files changed, 84 insertions(+), 0 deletions(-)
create mode 100644 Source/cmGlobalCMDMakefileGenerator.cxx
create mode 100644 Source/cmGlobalCMDMakefileGenerator.h
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index b5115b7..d12ce9f 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -297,6 +297,8 @@ IF (WIN32)
SET(SRCS ${SRCS}
cmGlobalBorlandMakefileGenerator.cxx
cmGlobalBorlandMakefileGenerator.h
+ cmGlobalCMDMakefileGenerator.cxx
+ cmGlobalCMDMakefileGenerator.h
cmGlobalMSYSMakefileGenerator.cxx
cmGlobalMinGWMakefileGenerator.cxx
cmGlobalNMakeMakefileGenerator.cxx
diff --git a/Source/cmGlobalCMDMakefileGenerator.cxx b/Source/cmGlobalCMDMakefileGenerator.cxx
new file mode 100644
index 0000000..1c7951c
--- /dev/null
+++ b/Source/cmGlobalCMDMakefileGenerator.cxx
@@ -0,0 +1,38 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#include "cmGlobalCMDMakefileGenerator.h"
+#include "cmLocalUnixMakefileGenerator3.h"
+#include "cmMakefile.h"
+#include "cmake.h"
+
+cmGlobalCMDMakefileGenerator::cmGlobalCMDMakefileGenerator()
+ : cmGlobalUnixMakefileGenerator3()
+{
+}
+
+///! Create a local generator appropriate to this Global Generator
+cmLocalGenerator *cmGlobalCMDMakefileGenerator::CreateLocalGenerator()
+{
+ cmLocalGenerator* lg = cmGlobalUnixMakefileGenerator3::CreateLocalGenerator();
+ dynamic_cast<cmLocalUnixMakefileGenerator3*>( lg )->SetWindowsShell(true);
+ return lg;
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalCMDMakefileGenerator
+::GetDocumentation(cmDocumentationEntry& entry) const
+{
+ entry.Name = this->GetName();
+ entry.Brief = "Generates Unix makefiles with DOS file paths.";
+ entry.Full = "The makefiles use cmd.exe as the shell. "
+ "They require GNU Make for Windows to be installed on the machine.";
+}
diff --git a/Source/cmGlobalCMDMakefileGenerator.h b/Source/cmGlobalCMDMakefileGenerator.h
new file mode 100644
index 0000000..2ccc7ab
--- /dev/null
+++ b/Source/cmGlobalCMDMakefileGenerator.h
@@ -0,0 +1,41 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmGlobalCMDMakefileGenerator_h
+#define cmGlobalCMDMakefileGenerator_h
+
+#include "cmGlobalUnixMakefileGenerator3.h"
+
+/** \class cmGlobalCMDMakefileGenerator
+ * \brief Write GNU Make makefiles with DOS/WIN32 CMD paths.
+ *
+ * cmGlobalCMDMakefileGenerator manages make build process for a tree
+ */
+class cmGlobalCMDMakefileGenerator : public cmGlobalUnixMakefileGenerator3
+{
+public:
+ cmGlobalCMDMakefileGenerator();
+ static cmGlobalGenerator* New() {
+ return new cmGlobalCMDMakefileGenerator; }
+
+ ///! Get the name for the generator.
+ virtual const char* GetName() const {
+ return cmGlobalCMDMakefileGenerator::GetActualName();}
+ static const char* GetActualName() {return "CMD Makefiles";}
+
+ /** Get the documentation entry for this generator. */
+ virtual void GetDocumentation(cmDocumentationEntry& entry) const;
+
+ ///! Create a local generator appropriate to this Global Generator
+ virtual cmLocalGenerator *CreateLocalGenerator();
+};
+
+#endif
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index d691f46..9abf857 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -77,6 +77,7 @@
# include "cmGlobalWatcomWMakeGenerator.h"
# define CMAKE_HAVE_VS_GENERATORS
# endif
+# include "cmGlobalCMDMakefileGenerator.h"
# include "cmGlobalMSYSMakefileGenerator.h"
# include "cmGlobalMinGWMakefileGenerator.h"
# include "cmWin32ProcessExecution.h"
@@ -2607,6 +2608,8 @@ void cmake::AddDefaultGenerators()
this->Generators[cmGlobalWatcomWMakeGenerator::GetActualName()] =
&cmGlobalWatcomWMakeGenerator::New;
# endif
+ this->Generators[cmGlobalCMDMakefileGenerator::GetActualName()] =
+ &cmGlobalCMDMakefileGenerator::New;
this->Generators[cmGlobalMSYSMakefileGenerator::GetActualName()] =
&cmGlobalMSYSMakefileGenerator::New;
this->Generators[cmGlobalMinGWMakefileGenerator::GetActualName()] =
--
1.7.8.3
|