ENH: fix borland make clean targets before build, add new generators for msys and mingw

This commit is contained in:
Bill Hoffman 2005-12-22 16:42:36 -05:00
parent 001bbb0d99
commit f6588b7919
16 changed files with 371 additions and 38 deletions

View File

@ -41,7 +41,7 @@ IF(NOT CMAKE_C_COMPILER)
SET(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_INIT} CACHE STRING "C compiler") SET(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_INIT} CACHE STRING "C compiler")
ENDIF(NOT CMAKE_C_COMPILER) ENDIF(NOT CMAKE_C_COMPILER)
MARK_AS_ADVANCED(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) FIND_PROGRAM(CMAKE_RANLIB NAMES ranlib)
IF(NOT CMAKE_RANLIB) IF(NOT CMAKE_RANLIB)

View File

@ -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)

View File

@ -0,0 +1,2 @@
FIND_PROGRAM(CMAKE_MAKE_PROGRAM mingw32-make.exe PATHS c:/MinGW/bin /MinGW/bin)
MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM)

View File

@ -168,6 +168,8 @@ IF (WIN32)
SET(SRCS ${SRCS} SET(SRCS ${SRCS}
cmGlobalBorlandMakefileGenerator.cxx cmGlobalBorlandMakefileGenerator.cxx
cmGlobalNMakeMakefileGenerator.cxx cmGlobalNMakeMakefileGenerator.cxx
cmGlobalMSYSMakefileGenerator.cxx
cmGlobalMinGWMakefileGenerator.cxx
cmGlobalVisualStudio6Generator.cxx cmGlobalVisualStudio6Generator.cxx
cmLocalVisualStudio6Generator.cxx cmLocalVisualStudio6Generator.cxx
cmGlobalBorlandMakefileGenerator.h cmGlobalBorlandMakefileGenerator.h

View File

@ -43,9 +43,11 @@ cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator()
lg->SetEchoNeedsQuote(false); lg->SetEchoNeedsQuote(false);
lg->SetIncludeDirective("!include"); lg->SetIncludeDirective("!include");
lg->SetWindowsShell(true); lg->SetWindowsShell(true);
lg->SetDefineWindowsNULL(true);
lg->SetMakefileVariableSize(32); lg->SetMakefileVariableSize(32);
lg->SetPassMakeflags(true); lg->SetPassMakeflags(true);
lg->SetGlobalGenerator(this); lg->SetGlobalGenerator(this);
lg->SetUnixCD(false);
return lg; return lg;
} }

View File

@ -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.";
}

View File

@ -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

View File

@ -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.";
}

View File

@ -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

View File

@ -38,11 +38,13 @@ cmLocalGenerator *cmGlobalNMakeMakefileGenerator::CreateLocalGenerator()
{ {
cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3; cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3;
lg->SetEchoNeedsQuote(false); lg->SetEchoNeedsQuote(false);
lg->SetDefineWindowsNULL(true);
lg->SetWindowsShell(true); lg->SetWindowsShell(true);
lg->SetMakeSilentFlag("/nologo"); lg->SetMakeSilentFlag("/nologo");
lg->SetGlobalGenerator(this); lg->SetGlobalGenerator(this);
lg->SetIgnoreLibPrefix(true); lg->SetIgnoreLibPrefix(true);
lg->SetPassMakeflags(true); lg->SetPassMakeflags(true);
lg->SetUnixCD(false);
return lg; return lg;
} }

View File

@ -51,27 +51,31 @@ void cmGlobalUnixMakefileGenerator3
cmSystemTools::Error(langComp.c_str(), " not set, after EnableLanguage"); cmSystemTools::Error(langComp.c_str(), " not set, after EnableLanguage");
continue; continue;
} }
const char* cc = mf->GetRequiredDefinition(langComp.c_str()); const char* name = mf->GetRequiredDefinition(langComp.c_str());
path = cmSystemTools::FindProgram(cc); if(!cmSystemTools::FileIsFullPath(name))
if(path.size() == 0) {
path = cmSystemTools::FindProgram(name);
}
else
{
path = name;
}
if(path.size() == 0 || !cmSystemTools::FileExists(path.c_str()))
{ {
std::string message = "your "; std::string message = "your ";
message += lang; message += lang;
message += " compiler: "; message += " compiler: \"";
if(cc) message += name;
{ message += "\" was not found. Please set ";
message += cc; message += langComp;
} message += " to a valid compiler path or name.";
else cmSystemTools::Error(message.c_str());
{ path = name;
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());
} }
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. // Write the do not edit header.
lg->WriteDisclaimer(makefileStream); lg->WriteDisclaimer(makefileStream);
// Write out the "special" stuff
lg->WriteSpecialTargetsTop(makefileStream);
// Write the main entry point target. This must be the VERY first // Write the main entry point target. This must be the VERY first
// target so that make with no arguments will run it. // target so that make with no arguments will run it.
// Just depend on the all target to drive the build. // Just depend on the all target to drive the build.

View File

@ -1604,10 +1604,26 @@ std::string cmLocalGenerator::Convert(const char* source,
} }
// Now convert it to an output path. // Now convert it to an output path.
if (output == MAKEFILE || output == SHELL) if (output == MAKEFILE)
{ {
result = cmSystemTools::ConvertToOutputPath(result.c_str()); 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; return result;
} }

View File

@ -220,6 +220,7 @@ protected:
std::vector<cmLocalGenerator*> Children; std::vector<cmLocalGenerator*> Children;
std::map<cmStdString, cmStdString> m_LanguageToIncludeFlags; std::map<cmStdString, cmStdString> m_LanguageToIncludeFlags;
bool m_WindowsShell; bool m_WindowsShell;
bool m_ForceUnixPath;
bool m_UseRelativePaths; bool m_UseRelativePaths;
bool m_IgnoreLibPrefix; bool m_IgnoreLibPrefix;
bool Configured; bool Configured;

View File

@ -47,6 +47,8 @@ cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3()
m_IgnoreLibPrefix = false; m_IgnoreLibPrefix = false;
m_PassMakeflags = false; m_PassMakeflags = false;
m_EchoNeedsQuote = true; m_EchoNeedsQuote = true;
m_DefineWindowsNULL = false;
m_UnixCD = true;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -329,7 +331,7 @@ cmLocalUnixMakefileGenerator3
return; return;
} }
this->WriteDisclaimer(ruleFileStream); this->WriteDisclaimer(ruleFileStream);
this->WriteSpecialTargetsTop(ruleFileStream);
this->WriteMakeVariables(ruleFileStream); this->WriteMakeVariables(ruleFileStream);
// Open the flags file. This should be copy-if-different because the // Open the flags file. This should be copy-if-different because the
@ -932,7 +934,7 @@ cmLocalUnixMakefileGenerator3
makefileStream makefileStream
<< "# Set environment variables for the build.\n" << "# Set environment variables for the build.\n"
<< "\n"; << "\n";
if(m_WindowsShell) if(m_DefineWindowsNULL)
{ {
makefileStream makefileStream
<< "!IF \"$(OS)\" == \"Windows_NT\"\n" << "!IF \"$(OS)\" == \"Windows_NT\"\n"
@ -941,12 +943,17 @@ cmLocalUnixMakefileGenerator3
<< "NULL=nul\n" << "NULL=nul\n"
<< "!ENDIF\n"; << "!ENDIF\n";
} }
if(m_WindowsShell)
{
makefileStream
<< "SHELL = C:\\WINDOWS\\system32\\cmd.exe\n";
}
else else
{ {
makefileStream makefileStream
<< "# The shell in which to execute make rules.\n" << "# The shell in which to execute make rules.\n"
<< "SHELL = /bin/sh\n" << "SHELL = /bin/sh\n"
<< "\n"; << "\n";
} }
if(m_Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE")) if(m_Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"))
@ -962,7 +969,7 @@ cmLocalUnixMakefileGenerator3
makefileStream makefileStream
<< "# The CMake executable.\n" << "# The CMake executable.\n"
<< "CMAKE_COMMAND = " << "CMAKE_COMMAND = "
<< this->Convert(cmakecommand.c_str(), FULL, MAKEFILE).c_str() << this->Convert(cmakecommand.c_str(), FULL, SHELL).c_str()
<< "\n" << "\n"
<< "\n"; << "\n";
makefileStream makefileStream
@ -1393,9 +1400,14 @@ cmLocalUnixMakefileGenerator3
(this->Convert(cleanFullRealName.c_str(),START_OUTPUT,MAKEFILE)); (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. // Add the pre-build and pre-link rules.
this->AppendCustomCommands(commands, target.GetPreBuildCommands()); this->AppendCustomCommands(commands, target.GetPreBuildCommands());
this->AppendCustomCommands(commands, target.GetPreLinkCommands()); this->AppendCustomCommands(commands, target.GetPreLinkCommands());
@ -1406,7 +1418,6 @@ cmLocalUnixMakefileGenerator3
linkRuleVar += "_LINK_EXECUTABLE"; linkRuleVar += "_LINK_EXECUTABLE";
std::string linkRule = std::string linkRule =
m_Makefile->GetRequiredDefinition(linkRuleVar.c_str()); m_Makefile->GetRequiredDefinition(linkRuleVar.c_str());
std::vector<std::string> commands1;
cmSystemTools::ExpandListArgument(linkRule, commands1); cmSystemTools::ExpandListArgument(linkRule, commands1);
this->CreateCDCommand(commands1,m_Makefile->GetStartOutputDirectory(), this->CreateCDCommand(commands1,m_Makefile->GetStartOutputDirectory(),
m_Makefile->GetHomeOutputDirectory()); m_Makefile->GetHomeOutputDirectory());
@ -1737,17 +1748,19 @@ cmLocalUnixMakefileGenerator3
(this->Convert(cleanFullSharedName.c_str(),START_OUTPUT,MAKEFILE)); (this->Convert(cleanFullSharedName.c_str(),START_OUTPUT,MAKEFILE));
} }
} }
// Add a command to remove any existing files for this library. // 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. // Add the pre-build and pre-link rules.
this->AppendCustomCommands(commands, target.GetPreBuildCommands()); this->AppendCustomCommands(commands, target.GetPreBuildCommands());
this->AppendCustomCommands(commands, target.GetPreLinkCommands()); this->AppendCustomCommands(commands, target.GetPreLinkCommands());
// Construct the main link rule. // Construct the main link rule.
std::string linkRule = m_Makefile->GetRequiredDefinition(linkRuleVar); std::string linkRule = m_Makefile->GetRequiredDefinition(linkRuleVar);
std::vector<std::string> commands1;
cmSystemTools::ExpandListArgument(linkRule, commands1); cmSystemTools::ExpandListArgument(linkRule, commands1);
this->CreateCDCommand(commands1,m_Makefile->GetStartOutputDirectory(), this->CreateCDCommand(commands1,m_Makefile->GetStartOutputDirectory(),
m_Makefile->GetHomeOutputDirectory()); m_Makefile->GetHomeOutputDirectory());
@ -2349,7 +2362,16 @@ cmLocalUnixMakefileGenerator3
for(unsigned int j=1; j < commandLine.size(); ++j) for(unsigned int j=1; j < commandLine.size(); ++j)
{ {
cmd += " "; cmd += " ";
bool forceOn = cmSystemTools::GetForceUnixPaths();
if(forceOn && m_WindowsShell)
{
cmSystemTools::SetForceUnixPaths(false);
}
cmd += cmSystemTools::EscapeSpaces(commandLine[j].c_str()); cmd += cmSystemTools::EscapeSpaces(commandLine[j].c_str());
if(forceOn && m_WindowsShell)
{
cmSystemTools::SetForceUnixPaths(true);
}
} }
commands1.push_back(cmd); commands1.push_back(cmd);
@ -3015,7 +3037,7 @@ void cmLocalUnixMakefileGenerator3
return; return;
} }
if(m_WindowsShell) if(!m_UnixCD)
{ {
// On Windows we must perform each step separately and then change // On Windows we must perform each step separately and then change
// back because the shell keeps the working directory between // back because the shell keeps the working directory between

View File

@ -102,6 +102,19 @@ public:
*/ */
void SetWindowsShell(bool v) {m_WindowsShell = v;} 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 * Set the string used to include one makefile into another default
* is include. * is include.
@ -345,6 +358,8 @@ private:
std::string m_MakeSilentFlag; std::string m_MakeSilentFlag;
std::string m_ExecutableOutputPath; std::string m_ExecutableOutputPath;
std::string m_LibraryOutputPath; std::string m_LibraryOutputPath;
bool m_DefineWindowsNULL;
bool m_UnixCD;
bool m_PassMakeflags; bool m_PassMakeflags;
//========================================================================== //==========================================================================

View File

@ -47,6 +47,8 @@
# endif # endif
# include "cmGlobalBorlandMakefileGenerator.h" # include "cmGlobalBorlandMakefileGenerator.h"
# include "cmGlobalNMakeMakefileGenerator.h" # include "cmGlobalNMakeMakefileGenerator.h"
# include "cmGlobalMSYSMakefileGenerator.h"
# include "cmGlobalMinGWMakefileGenerator.h"
# include "cmWin32ProcessExecution.h" # include "cmWin32ProcessExecution.h"
#else #else
#endif #endif
@ -932,9 +934,9 @@ int cmake::CMakeCommand(std::vector<std::string>& args)
{ {
cmake cm; cmake cm;
cmGlobalGenerator *ggd = cm.CreateGlobalGenerator(args[2].c_str()); cmGlobalGenerator *ggd = cm.CreateGlobalGenerator(args[2].c_str());
ggd->SetCMakeInstance(&cm);
if (ggd) if (ggd)
{ {
ggd->SetCMakeInstance(&cm);
std::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator()); std::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator());
lgd->SetGlobalGenerator(ggd); lgd->SetGlobalGenerator(ggd);
return lgd->ScanDependencies(args)? 0 : 2; return lgd->ScanDependencies(args)? 0 : 2;
@ -1541,6 +1543,10 @@ void cmake::AddDefaultGenerators()
&cmGlobalBorlandMakefileGenerator::New; &cmGlobalBorlandMakefileGenerator::New;
m_Generators[cmGlobalNMakeMakefileGenerator::GetActualName()] = m_Generators[cmGlobalNMakeMakefileGenerator::GetActualName()] =
&cmGlobalNMakeMakefileGenerator::New; &cmGlobalNMakeMakefileGenerator::New;
m_Generators[cmGlobalMSYSMakefileGenerator::GetActualName()] =
&cmGlobalMSYSMakefileGenerator::New;
m_Generators[cmGlobalMinGWMakefileGenerator::GetActualName()] =
&cmGlobalMinGWMakefileGenerator::New;
#endif #endif
m_Generators[cmGlobalUnixMakefileGenerator3::GetActualName()] = m_Generators[cmGlobalUnixMakefileGenerator3::GetActualName()] =
&cmGlobalUnixMakefileGenerator3::New; &cmGlobalUnixMakefileGenerator3::New;