summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2005-12-22 21:42:36 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2005-12-22 21:42:36 (GMT)
commitf6588b7919a0da4e0d5bb89b7f527e3fe2687bc3 (patch)
tree4e64e8bb66e869ac393a25d758dda54d55838615
parent001bbb0d99aa8a02c5d211f5e55570ecc17e1fb0 (diff)
downloadCMake-f6588b7919a0da4e0d5bb89b7f527e3fe2687bc3.zip
CMake-f6588b7919a0da4e0d5bb89b7f527e3fe2687bc3.tar.gz
CMake-f6588b7919a0da4e0d5bb89b7f527e3fe2687bc3.tar.bz2
ENH: fix borland make clean targets before build, add new generators for msys and mingw
-rw-r--r--Modules/CMakeDetermineCCompiler.cmake2
-rw-r--r--Modules/CMakeMSYSFindMake.cmake2
-rw-r--r--Modules/CMakeMinGWFindMake.cmake2
-rw-r--r--Source/CMakeLists.txt2
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.cxx2
-rw-r--r--Source/cmGlobalMSYSMakefileGenerator.cxx82
-rw-r--r--Source/cmGlobalMSYSMakefileGenerator.h50
-rw-r--r--Source/cmGlobalMinGWMakefileGenerator.cxx76
-rw-r--r--Source/cmGlobalMinGWMakefileGenerator.h50
-rw-r--r--Source/cmGlobalNMakeMakefileGenerator.cxx2
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx41
-rw-r--r--Source/cmLocalGenerator.cxx20
-rw-r--r--Source/cmLocalGenerator.h1
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx54
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h15
-rw-r--r--Source/cmake.cxx8
16 files changed, 371 insertions, 38 deletions
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index 27e8b60..82b7c62 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -41,7 +41,7 @@ IF(NOT CMAKE_C_COMPILER)
SET(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_INIT} CACHE STRING "C compiler")
ENDIF(NOT CMAKE_C_COMPILER)
MARK_AS_ADVANCED(CMAKE_C_COMPILER)
-FIND_PROGRAM(CMAKE_AR NAMES ar )
+FIND_PROGRAM(CMAKE_AR NAMES ar PATHS /mingw/bin c:/mingw/bin /msys/1.0/bin c:/msys/1.0/bin )
FIND_PROGRAM(CMAKE_RANLIB NAMES ranlib)
IF(NOT CMAKE_RANLIB)
diff --git a/Modules/CMakeMSYSFindMake.cmake b/Modules/CMakeMSYSFindMake.cmake
new file mode 100644
index 0000000..83bd111
--- /dev/null
+++ b/Modules/CMakeMSYSFindMake.cmake
@@ -0,0 +1,2 @@
+FIND_PROGRAM(CMAKE_MAKE_PROGRAM make PATHS c:/msys/1.0/bin /msys/1.0/bin)
+MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM)
diff --git a/Modules/CMakeMinGWFindMake.cmake b/Modules/CMakeMinGWFindMake.cmake
new file mode 100644
index 0000000..1973d0f
--- /dev/null
+++ b/Modules/CMakeMinGWFindMake.cmake
@@ -0,0 +1,2 @@
+FIND_PROGRAM(CMAKE_MAKE_PROGRAM mingw32-make.exe PATHS c:/MinGW/bin /MinGW/bin)
+MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM)
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 19a5868..799bc2c 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -168,6 +168,8 @@ IF (WIN32)
SET(SRCS ${SRCS}
cmGlobalBorlandMakefileGenerator.cxx
cmGlobalNMakeMakefileGenerator.cxx
+ cmGlobalMSYSMakefileGenerator.cxx
+ cmGlobalMinGWMakefileGenerator.cxx
cmGlobalVisualStudio6Generator.cxx
cmLocalVisualStudio6Generator.cxx
cmGlobalBorlandMakefileGenerator.h
diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx
index 2693cc7..0b6b6c4 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.cxx
+++ b/Source/cmGlobalBorlandMakefileGenerator.cxx
@@ -43,9 +43,11 @@ cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator()
lg->SetEchoNeedsQuote(false);
lg->SetIncludeDirective("!include");
lg->SetWindowsShell(true);
+ lg->SetDefineWindowsNULL(true);
lg->SetMakefileVariableSize(32);
lg->SetPassMakeflags(true);
lg->SetGlobalGenerator(this);
+ lg->SetUnixCD(false);
return lg;
}
diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx
new file mode 100644
index 0000000..5c106d6
--- /dev/null
+++ b/Source/cmGlobalMSYSMakefileGenerator.cxx
@@ -0,0 +1,82 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#include "cmGlobalMSYSMakefileGenerator.h"
+#include "cmLocalUnixMakefileGenerator3.h"
+#include "cmMakefile.h"
+#include "cmake.h"
+
+cmGlobalMSYSMakefileGenerator::cmGlobalMSYSMakefileGenerator()
+{
+ m_FindMakeProgramFile = "CMakeMSYSFindMake.cmake";
+ m_ForceUnixPaths = true;
+}
+
+void cmGlobalMSYSMakefileGenerator::EnableLanguage(std::vector<std::string>const& l,
+ cmMakefile *mf)
+{
+ this->FindMakeProgram(mf);
+ std::string makeProgram = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
+ std::vector<std::string> locations;
+ locations.push_back(cmSystemTools::GetProgramPath(makeProgram.c_str()));
+ locations.push_back("c:/mingw/bin");
+ locations.push_back("/mingw/bin");
+ locations.push_back("/msys/1.0/bin");
+ locations.push_back("C:/msys/1.0/bin");
+ std::string gcc = "gcc.exe";
+ std::string gxx = "g++.exe";
+ std::string slash = "/";
+ for(std::vector<std::string>::iterator i = locations.begin();
+ i != locations.end(); ++i)
+ {
+ std::string tgcc = *i + slash + gcc;
+ std::string tgxx = *i + slash + gxx;
+ if(cmSystemTools::FileExists(tgcc.c_str()))
+ {
+ gcc = tgcc;
+ gxx = tgxx;
+ break;
+ }
+ }
+ mf->AddDefinition("CMAKE_GENERATOR_CC", gcc.c_str());
+ mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx.c_str());
+ this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf);
+ if(!mf->IsSet("CMAKE_AR") && !m_CMakeInstance->GetIsInTryCompile())
+ {
+ cmSystemTools::Error("CMAKE_AR was not found, please set to archive program. ",
+ mf->GetDefinition("CMAKE_AR"));
+ }
+}
+
+///! Create a local generator appropriate to this Global Generator
+cmLocalGenerator *cmGlobalMSYSMakefileGenerator::CreateLocalGenerator()
+{
+ cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3;
+ lg->SetWindowsShell(false);
+ lg->SetGlobalGenerator(this);
+ lg->SetIgnoreLibPrefix(true);
+ lg->SetPassMakeflags(false);
+ lg->SetUnixCD(true);
+ return lg;
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalMSYSMakefileGenerator::GetDocumentation(cmDocumentationEntry& entry) const
+{
+ entry.name = this->GetName();
+ entry.brief = "Generates MSYS makefiles.";
+ entry.full = "The makefiles use /bin/sh as the shell. They require msys to be installed on the machine.";
+}
diff --git a/Source/cmGlobalMSYSMakefileGenerator.h b/Source/cmGlobalMSYSMakefileGenerator.h
new file mode 100644
index 0000000..4905f70
--- /dev/null
+++ b/Source/cmGlobalMSYSMakefileGenerator.h
@@ -0,0 +1,50 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef cmGlobalMSYSMakefileGenerator_h
+#define cmGlobalMSYSMakefileGenerator_h
+
+#include "cmGlobalUNIXMakefileGenerator3.h"
+
+/** \class cmGlobalMSYSMakefileGenerator
+ * \brief Write a NMake makefiles.
+ *
+ * cmGlobalMSYSMakefileGenerator manages nmake build process for a tree
+ */
+class cmGlobalMSYSMakefileGenerator : public cmGlobalUnixMakefileGenerator3
+{
+public:
+ cmGlobalMSYSMakefileGenerator();
+ static cmGlobalGenerator* New() { return new cmGlobalMSYSMakefileGenerator; }
+ ///! Get the name for the generator.
+ virtual const char* GetName() const {
+ return cmGlobalMSYSMakefileGenerator::GetActualName();}
+ static const char* GetActualName() {return "MSYS 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();
+
+ /**
+ * Try to determine system infomation such as shared library
+ * extension, pthreads, byte order etc.
+ */
+ virtual void EnableLanguage(std::vector<std::string>const& languages, cmMakefile *);
+};
+
+#endif
diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx
new file mode 100644
index 0000000..1472458
--- /dev/null
+++ b/Source/cmGlobalMinGWMakefileGenerator.cxx
@@ -0,0 +1,76 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#include "cmGlobalMinGWMakefileGenerator.h"
+#include "cmLocalUnixMakefileGenerator3.h"
+#include "cmMakefile.h"
+
+cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator()
+{
+ m_FindMakeProgramFile = "CMakeMinGWFindMake.cmake";
+ m_ForceUnixPaths = true;
+
+}
+
+void cmGlobalMinGWMakefileGenerator::EnableLanguage(std::vector<std::string>const& l,
+ cmMakefile *mf)
+{
+ this->FindMakeProgram(mf);
+ std::string makeProgram = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
+ std::vector<std::string> locations;
+ locations.push_back(cmSystemTools::GetProgramPath(makeProgram.c_str()));
+ locations.push_back("c:/mingw/bin");
+ locations.push_back("/mingw/bin");
+ std::string gcc = "gcc.exe";
+ std::string gxx = "g++.exe";
+ std::string slash = "/";
+ for(std::vector<std::string>::iterator i = locations.begin();
+ i != locations.end(); ++i)
+ {
+ std::string tgcc = *i + slash + gcc;
+ std::string tgxx = *i + slash + gxx;
+ if(cmSystemTools::FileExists(tgcc.c_str()))
+ {
+ gcc = tgcc;
+ gxx = tgxx;
+ break;
+ }
+ }
+ mf->AddDefinition("CMAKE_GENERATOR_CC", gcc.c_str());
+ mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx.c_str());
+ this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf);
+}
+
+///! Create a local generator appropriate to this Global Generator
+cmLocalGenerator *cmGlobalMinGWMakefileGenerator::CreateLocalGenerator()
+{
+ cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3;
+ lg->SetWindowsShell(true);
+ lg->SetGlobalGenerator(this);
+ lg->SetIgnoreLibPrefix(true);
+ lg->SetPassMakeflags(false);
+ lg->SetUnixCD(true);
+ return lg;
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalMinGWMakefileGenerator::GetDocumentation(cmDocumentationEntry& entry) const
+{
+ entry.name = this->GetName();
+ entry.brief = "Generates a make file for use with mingw32-make.";
+ entry.full = "The makefiles generated use cmd.exe as the shell. "
+ "They do not require msys or a unix shell.";
+}
diff --git a/Source/cmGlobalMinGWMakefileGenerator.h b/Source/cmGlobalMinGWMakefileGenerator.h
new file mode 100644
index 0000000..79a7a25
--- /dev/null
+++ b/Source/cmGlobalMinGWMakefileGenerator.h
@@ -0,0 +1,50 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef cmGlobalMinGWMakefileGenerator_h
+#define cmGlobalMinGWMakefileGenerator_h
+
+#include "cmGlobalUNIXMakefileGenerator3.h"
+
+/** \class cmGlobalMinGWMakefileGenerator
+ * \brief Write a NMake makefiles.
+ *
+ * cmGlobalMinGWMakefileGenerator manages nmake build process for a tree
+ */
+class cmGlobalMinGWMakefileGenerator : public cmGlobalUnixMakefileGenerator3
+{
+public:
+ cmGlobalMinGWMakefileGenerator();
+ static cmGlobalGenerator* New() { return new cmGlobalMinGWMakefileGenerator; }
+ ///! Get the name for the generator.
+ virtual const char* GetName() const {
+ return cmGlobalMinGWMakefileGenerator::GetActualName();}
+ static const char* GetActualName() {return "MinGW 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();
+
+ /**
+ * Try to determine system infomation such as shared library
+ * extension, pthreads, byte order etc.
+ */
+ virtual void EnableLanguage(std::vector<std::string>const& languages, cmMakefile *);
+};
+
+#endif
diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx
index 3e6be38..024aa19 100644
--- a/Source/cmGlobalNMakeMakefileGenerator.cxx
+++ b/Source/cmGlobalNMakeMakefileGenerator.cxx
@@ -38,11 +38,13 @@ cmLocalGenerator *cmGlobalNMakeMakefileGenerator::CreateLocalGenerator()
{
cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3;
lg->SetEchoNeedsQuote(false);
+ lg->SetDefineWindowsNULL(true);
lg->SetWindowsShell(true);
lg->SetMakeSilentFlag("/nologo");
lg->SetGlobalGenerator(this);
lg->SetIgnoreLibPrefix(true);
lg->SetPassMakeflags(true);
+ lg->SetUnixCD(false);
return lg;
}
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 56dc39d..38ab153 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -51,27 +51,31 @@ void cmGlobalUnixMakefileGenerator3
cmSystemTools::Error(langComp.c_str(), " not set, after EnableLanguage");
continue;
}
- const char* cc = mf->GetRequiredDefinition(langComp.c_str());
- path = cmSystemTools::FindProgram(cc);
- if(path.size() == 0)
+ const char* name = mf->GetRequiredDefinition(langComp.c_str());
+ if(!cmSystemTools::FileIsFullPath(name))
+ {
+ path = cmSystemTools::FindProgram(name);
+ }
+ else
+ {
+ path = name;
+ }
+ if(path.size() == 0 || !cmSystemTools::FileExists(path.c_str()))
{
std::string message = "your ";
message += lang;
- message += " compiler: ";
- if(cc)
- {
- message += cc;
- }
- else
- {
- message += "(NULL)";
- }
- message += " was not found in your path. "
- "For CMake to correctly use try compile commands, the compiler must "
- "be in your path. Please add the compiler to your PATH environment,"
- " and re-run CMake.";
- cmSystemTools::Error(message.c_str());
+ message += " compiler: \"";
+ message += name;
+ message += "\" was not found. Please set ";
+ message += langComp;
+ message += " to a valid compiler path or name.";
+ cmSystemTools::Error(message.c_str());
+ path = name;
}
+ std::string doc = lang;
+ doc += " compiler.";
+ mf->AddCacheDefinition(langComp.c_str(), path.c_str(),
+ doc.c_str(), cmCacheManager::FILEPATH);
}
}
@@ -125,7 +129,8 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2()
// Write the do not edit header.
lg->WriteDisclaimer(makefileStream);
-
+ // Write out the "special" stuff
+ lg->WriteSpecialTargetsTop(makefileStream);
// Write the main entry point target. This must be the VERY first
// target so that make with no arguments will run it.
// Just depend on the all target to drive the build.
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 29503bc..57e0eea 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1604,10 +1604,26 @@ std::string cmLocalGenerator::Convert(const char* source,
}
// Now convert it to an output path.
- if (output == MAKEFILE || output == SHELL)
+ if (output == MAKEFILE)
{
result = cmSystemTools::ConvertToOutputPath(result.c_str());
}
-
+ if( output == SHELL)
+ {
+ // for shell commands if force unix is on, but m_WindowsShell
+ // is true, then turn off force unix paths for the output path
+ // so that the path is windows style and will work with windows
+ // cmd.exe.
+ bool forceOn = cmSystemTools::GetForceUnixPaths();
+ if(forceOn && m_WindowsShell)
+ {
+ cmSystemTools::SetForceUnixPaths(false);
+ }
+ result = cmSystemTools::ConvertToOutputPath(result.c_str());
+ if(forceOn && m_WindowsShell)
+ {
+ cmSystemTools::SetForceUnixPaths(true);
+ }
+ }
return result;
}
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 3c88e62..11b3e22 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -220,6 +220,7 @@ protected:
std::vector<cmLocalGenerator*> Children;
std::map<cmStdString, cmStdString> m_LanguageToIncludeFlags;
bool m_WindowsShell;
+ bool m_ForceUnixPath;
bool m_UseRelativePaths;
bool m_IgnoreLibPrefix;
bool Configured;
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 70627f3..482854d 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -47,6 +47,8 @@ cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3()
m_IgnoreLibPrefix = false;
m_PassMakeflags = false;
m_EchoNeedsQuote = true;
+ m_DefineWindowsNULL = false;
+ m_UnixCD = true;
}
//----------------------------------------------------------------------------
@@ -329,7 +331,7 @@ cmLocalUnixMakefileGenerator3
return;
}
this->WriteDisclaimer(ruleFileStream);
-
+ this->WriteSpecialTargetsTop(ruleFileStream);
this->WriteMakeVariables(ruleFileStream);
// Open the flags file. This should be copy-if-different because the
@@ -932,7 +934,7 @@ cmLocalUnixMakefileGenerator3
makefileStream
<< "# Set environment variables for the build.\n"
<< "\n";
- if(m_WindowsShell)
+ if(m_DefineWindowsNULL)
{
makefileStream
<< "!IF \"$(OS)\" == \"Windows_NT\"\n"
@@ -941,12 +943,17 @@ cmLocalUnixMakefileGenerator3
<< "NULL=nul\n"
<< "!ENDIF\n";
}
+ if(m_WindowsShell)
+ {
+ makefileStream
+ << "SHELL = C:\\WINDOWS\\system32\\cmd.exe\n";
+ }
else
{
- makefileStream
- << "# The shell in which to execute make rules.\n"
- << "SHELL = /bin/sh\n"
- << "\n";
+ makefileStream
+ << "# The shell in which to execute make rules.\n"
+ << "SHELL = /bin/sh\n"
+ << "\n";
}
if(m_Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"))
@@ -962,7 +969,7 @@ cmLocalUnixMakefileGenerator3
makefileStream
<< "# The CMake executable.\n"
<< "CMAKE_COMMAND = "
- << this->Convert(cmakecommand.c_str(), FULL, MAKEFILE).c_str()
+ << this->Convert(cmakecommand.c_str(), FULL, SHELL).c_str()
<< "\n"
<< "\n";
makefileStream
@@ -1392,10 +1399,15 @@ cmLocalUnixMakefileGenerator3
exeCleanFiles.push_back
(this->Convert(cleanFullRealName.c_str(),START_OUTPUT,MAKEFILE));
}
- }
- // Add a command to remove any existing files for this executable.
- this->AppendCleanCommand(commands, exeCleanFiles);
+ }
+ // Add a command to remove any existing files for this executable.
+ std::vector<std::string> commands1;
+ this->AppendCleanCommand(commands1, exeCleanFiles);
+ this->CreateCDCommand(commands1,m_Makefile->GetStartOutputDirectory(),
+ m_Makefile->GetHomeOutputDirectory());
+ commands.insert(commands.end(), commands1.begin(), commands1.end());
+ commands1.clear();
// Add the pre-build and pre-link rules.
this->AppendCustomCommands(commands, target.GetPreBuildCommands());
this->AppendCustomCommands(commands, target.GetPreLinkCommands());
@@ -1406,7 +1418,6 @@ cmLocalUnixMakefileGenerator3
linkRuleVar += "_LINK_EXECUTABLE";
std::string linkRule =
m_Makefile->GetRequiredDefinition(linkRuleVar.c_str());
- std::vector<std::string> commands1;
cmSystemTools::ExpandListArgument(linkRule, commands1);
this->CreateCDCommand(commands1,m_Makefile->GetStartOutputDirectory(),
m_Makefile->GetHomeOutputDirectory());
@@ -1737,17 +1748,19 @@ cmLocalUnixMakefileGenerator3
(this->Convert(cleanFullSharedName.c_str(),START_OUTPUT,MAKEFILE));
}
}
-
// Add a command to remove any existing files for this library.
- this->AppendCleanCommand(commands, libCleanFiles);
-
+ std::vector<std::string> commands1;
+ this->AppendCleanCommand(commands1, libCleanFiles);
+ this->CreateCDCommand(commands1,m_Makefile->GetStartOutputDirectory(),
+ m_Makefile->GetHomeOutputDirectory());
+ commands.insert(commands.end(), commands1.begin(), commands1.end());
+ commands1.clear();
// Add the pre-build and pre-link rules.
this->AppendCustomCommands(commands, target.GetPreBuildCommands());
this->AppendCustomCommands(commands, target.GetPreLinkCommands());
// Construct the main link rule.
std::string linkRule = m_Makefile->GetRequiredDefinition(linkRuleVar);
- std::vector<std::string> commands1;
cmSystemTools::ExpandListArgument(linkRule, commands1);
this->CreateCDCommand(commands1,m_Makefile->GetStartOutputDirectory(),
m_Makefile->GetHomeOutputDirectory());
@@ -2349,7 +2362,16 @@ cmLocalUnixMakefileGenerator3
for(unsigned int j=1; j < commandLine.size(); ++j)
{
cmd += " ";
+ bool forceOn = cmSystemTools::GetForceUnixPaths();
+ if(forceOn && m_WindowsShell)
+ {
+ cmSystemTools::SetForceUnixPaths(false);
+ }
cmd += cmSystemTools::EscapeSpaces(commandLine[j].c_str());
+ if(forceOn && m_WindowsShell)
+ {
+ cmSystemTools::SetForceUnixPaths(true);
+ }
}
commands1.push_back(cmd);
@@ -3015,7 +3037,7 @@ void cmLocalUnixMakefileGenerator3
return;
}
- if(m_WindowsShell)
+ if(!m_UnixCD)
{
// On Windows we must perform each step separately and then change
// back because the shell keeps the working directory between
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index b03d062..7288ed3 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -103,6 +103,19 @@ public:
void SetWindowsShell(bool v) {m_WindowsShell = v;}
/**
+ * If set to true, then NULL is set to nil for non Windows_NT.
+ * This uses make syntax used by nmake and borland.
+ * The default is false.
+ */
+ void SetDefineWindowsNULL(bool v) {m_DefineWindowsNULL = v;}
+
+ /**
+ * If set to true, cd dir && command is used to
+ * run commands in a different directory.
+ */
+ void SetUnixCD(bool v) {m_UnixCD = v;}
+
+ /**
* Set the string used to include one makefile into another default
* is include.
*/
@@ -345,6 +358,8 @@ private:
std::string m_MakeSilentFlag;
std::string m_ExecutableOutputPath;
std::string m_LibraryOutputPath;
+ bool m_DefineWindowsNULL;
+ bool m_UnixCD;
bool m_PassMakeflags;
//==========================================================================
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index e6fac5e..920291b 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -47,6 +47,8 @@
# endif
# include "cmGlobalBorlandMakefileGenerator.h"
# include "cmGlobalNMakeMakefileGenerator.h"
+# include "cmGlobalMSYSMakefileGenerator.h"
+# include "cmGlobalMinGWMakefileGenerator.h"
# include "cmWin32ProcessExecution.h"
#else
#endif
@@ -932,9 +934,9 @@ int cmake::CMakeCommand(std::vector<std::string>& args)
{
cmake cm;
cmGlobalGenerator *ggd = cm.CreateGlobalGenerator(args[2].c_str());
- ggd->SetCMakeInstance(&cm);
if (ggd)
{
+ ggd->SetCMakeInstance(&cm);
std::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator());
lgd->SetGlobalGenerator(ggd);
return lgd->ScanDependencies(args)? 0 : 2;
@@ -1541,6 +1543,10 @@ void cmake::AddDefaultGenerators()
&cmGlobalBorlandMakefileGenerator::New;
m_Generators[cmGlobalNMakeMakefileGenerator::GetActualName()] =
&cmGlobalNMakeMakefileGenerator::New;
+ m_Generators[cmGlobalMSYSMakefileGenerator::GetActualName()] =
+ &cmGlobalMSYSMakefileGenerator::New;
+ m_Generators[cmGlobalMinGWMakefileGenerator::GetActualName()] =
+ &cmGlobalMinGWMakefileGenerator::New;
#endif
m_Generators[cmGlobalUnixMakefileGenerator3::GetActualName()] =
&cmGlobalUnixMakefileGenerator3::New;