STYLE: fix line length

This commit is contained in:
Ken Martin 2006-05-12 12:29:09 -04:00
parent 7dc8a92246
commit 47c7108111
9 changed files with 236 additions and 139 deletions

View File

@ -126,8 +126,8 @@ bool cmMacroHelperCommand::InvokeInitialPass
newLFF.Name = this->Functions[c].Name; newLFF.Name = this->Functions[c].Name;
newLFF.FilePath = this->Functions[c].FilePath; newLFF.FilePath = this->Functions[c].FilePath;
newLFF.Line = this->Functions[c].Line; newLFF.Line = this->Functions[c].Line;
const char* def = const char* def = this->Makefile->GetDefinition
this->Makefile->GetDefinition("CMAKE_MACRO_REPORT_DEFINITION_LOCATION"); ("CMAKE_MACRO_REPORT_DEFINITION_LOCATION");
bool macroReportLocation = false; bool macroReportLocation = false;
if(def && !cmSystemTools::IsOff(def)) if(def && !cmSystemTools::IsOff(def))
{ {

View File

@ -163,7 +163,8 @@ protected:
typedef std::map<cmStdString, cmStdString> FileToPathMapType; typedef std::map<cmStdString, cmStdString> FileToPathMapType;
typedef std::map<cmStdString, FileToPathMapType> typedef std::map<cmStdString, FileToPathMapType>
DirectoryToFileToPathMapType; DirectoryToFileToPathMapType;
typedef std::map<cmStdString, cmDependInformation*> DependInformationMapType; typedef std::map<cmStdString, cmDependInformation*>
DependInformationMapType;
DependInformationMapType DependInformationMap; DependInformationMapType DependInformationMap;
DirectoryToFileToPathMapType DirectoryToFileToPathMap; DirectoryToFileToPathMapType DirectoryToFileToPathMap;
}; };

View File

@ -73,9 +73,11 @@ cmMakefile::cmMakefile()
#if defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_BUILD_WITH_CMAKE)
this->AddSourceGroup("", "^.*$"); this->AddSourceGroup("", "^.*$");
this->AddSourceGroup("Source Files", this->AddSourceGroup
"\\.(C|M|c|c\\+\\+|cc|cpp|cxx|m|mm|rc|def|r|odl|idl|hpj|bat)$"); ("Source Files",
this->AddSourceGroup("Header Files", "\\.(h|h\\+\\+|hm|hpp|hxx|in|txx|inl)$"); "\\.(C|M|c|c\\+\\+|cc|cpp|cxx|m|mm|rc|def|r|odl|idl|hpj|bat)$");
this->AddSourceGroup("Header Files",
"\\.(h|h\\+\\+|hm|hpp|hxx|in|txx|inl)$");
this->AddSourceGroup("CMake Rules", "\\.rule$"); this->AddSourceGroup("CMake Rules", "\\.rule$");
this->AddSourceGroup("Resources", "\\.plist$"); this->AddSourceGroup("Resources", "\\.plist$");
#endif #endif
@ -168,7 +170,8 @@ cmMakefile::~cmMakefile()
this->FunctionBlockers.clear(); this->FunctionBlockers.clear();
} }
void cmMakefile::PrintStringVector(const char* s, const std::vector<std::string>& v) const void cmMakefile::PrintStringVector(const char* s,
const std::vector<std::string>& v) const
{ {
std::cout << s << ": ( \n"; std::cout << s << ": ( \n";
for(std::vector<std::string>::const_iterator i = v.begin(); for(std::vector<std::string>::const_iterator i = v.begin();
@ -179,11 +182,13 @@ void cmMakefile::PrintStringVector(const char* s, const std::vector<std::string>
std::cout << " )\n"; std::cout << " )\n";
} }
void cmMakefile::PrintStringVector(const char* s, const std::vector<std::pair<cmStdString, bool> >& v) const void cmMakefile
::PrintStringVector(const char* s,
const std::vector<std::pair<cmStdString, bool> >& v) const
{ {
std::cout << s << ": ( \n"; std::cout << s << ": ( \n";
for(std::vector<std::pair<cmStdString, bool> >::const_iterator i = v.begin(); for(std::vector<std::pair<cmStdString, bool> >::const_iterator i
i != v.end(); ++i) = v.begin(); i != v.end(); ++i)
{ {
std::cout << i->first.c_str() << " " << i->second; std::cout << i->first.c_str() << " " << i->second;
} }
@ -212,12 +217,14 @@ void cmMakefile::Print()
this->cmStartDirectory.c_str() << std::endl; this->cmStartDirectory.c_str() << std::endl;
std::cout << " this->cmHomeDirectory; " << std::cout << " this->cmHomeDirectory; " <<
this->cmHomeDirectory.c_str() << std::endl; this->cmHomeDirectory.c_str() << std::endl;
std::cout << " this->ProjectName; " << this->ProjectName.c_str() << std::endl; std::cout << " this->ProjectName; "
this->PrintStringVector("this->IncludeDirectories;", this->IncludeDirectories); << this->ProjectName.c_str() << std::endl;
this->PrintStringVector("this->IncludeDirectories;",
this->IncludeDirectories);
this->PrintStringVector("this->LinkDirectories", this->LinkDirectories); this->PrintStringVector("this->LinkDirectories", this->LinkDirectories);
#if defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_BUILD_WITH_CMAKE)
for( std::vector<cmSourceGroup>::const_iterator i = this->SourceGroups.begin(); for( std::vector<cmSourceGroup>::const_iterator i =
i != this->SourceGroups.end(); ++i) this->SourceGroups.begin(); i != this->SourceGroups.end(); ++i)
{ {
std::cout << "Source Group: " << i->GetName() << std::endl; std::cout << "Source Group: " << i->GetName() << std::endl;
} }
@ -238,6 +245,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff)
// No error. // No error.
return result; return result;
} }
std::string name = lff.Name; std::string name = lff.Name;
// execute the command // execute the command
cmCommand *rm = cmCommand *rm =
@ -288,12 +296,14 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff)
this->UsedCommands.push_back(usedCommand); this->UsedCommands.push_back(usedCommand);
} }
} }
else if ( this->GetCMakeInstance()->GetScriptMode() && !usedCommand->IsScriptable() ) else if ( this->GetCMakeInstance()->GetScriptMode()
&& !usedCommand->IsScriptable() )
{ {
cmOStringStream error; cmOStringStream error;
error << "Error in cmake code at\n" error << "Error in cmake code at\n"
<< lff.FilePath << ":" << lff.Line << ":\n" << lff.FilePath << ":" << lff.Line << ":\n"
<< "Command " << usedCommand->GetName() << " not scriptable" << std::endl; << "Command " << usedCommand->GetName()
<< " not scriptable" << std::endl;
cmSystemTools::Error(error.str().c_str()); cmSystemTools::Error(error.str().c_str());
result = false; result = false;
cmSystemTools::SetFatalErrorOccured(); cmSystemTools::SetFatalErrorOccured();
@ -323,7 +333,8 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff)
// Parse the given CMakeLists.txt file executing all commands // Parse the given CMakeLists.txt file executing all commands
// //
bool cmMakefile::ReadListFile(const char* filename_in, const char *external_in) bool cmMakefile::ReadListFile(const char* filename_in,
const char *external_in)
{ {
std::string currentFile = this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE"); std::string currentFile = this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE");
this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename_in); this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename_in);
@ -475,7 +486,11 @@ void cmMakefile::ConfigureFinalPass()
= this->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY"); = this->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY");
if (oldValue && atof(oldValue) <= 1.2) if (oldValue && atof(oldValue) <= 1.2)
{ {
cmSystemTools::Error("You have requested backwards compatibility with CMake version 1.2 or earlier. This version of CMake only supports backwards compatibility with CMake 1.4 or later. For compatibility with 1.2 or earlier please use CMake 2.0"); cmSystemTools::Error("You have requested backwards compatibility "
"with CMake version 1.2 or earlier. This version "
"of CMake only supports backwards compatibility "
"with CMake 1.4 or later. For compatibility with "
"1.2 or earlier please use CMake 2.0");
} }
for (cmTargets::iterator l = this->Targets.begin(); for (cmTargets::iterator l = this->Targets.begin();
l != this->Targets.end(); l++) l != this->Targets.end(); l++)
@ -791,7 +806,8 @@ void cmMakefile::RemoveDefineFlag(const char* flag)
cmSystemTools::ReplaceString(this->DefineFlags, flag, " "); cmSystemTools::ReplaceString(this->DefineFlags, flag, " ");
} }
void cmMakefile::AddLinkLibrary(const char* lib, cmTarget::LinkLibraryType llt) void cmMakefile::AddLinkLibrary(const char* lib,
cmTarget::LinkLibraryType llt)
{ {
this->LinkLibraries.push_back( this->LinkLibraries.push_back(
std::pair<std::string, cmTarget::LinkLibraryType>(lib,llt)); std::pair<std::string, cmTarget::LinkLibraryType>(lib,llt));
@ -814,7 +830,8 @@ void cmMakefile::AddLinkLibraryForTarget(const char *target,
{ {
cmOStringStream e; cmOStringStream e;
e << "Attempt to add link library " << lib e << "Attempt to add link library " << lib
<< " which is not a library target to target " << tgt->GetType() << " " << << " which is not a library target to target "
<< tgt->GetType() << " " <<
target << "\n"; target << "\n";
cmSystemTools::Error(e.str().c_str()); cmSystemTools::Error(e.str().c_str());
} }
@ -841,8 +858,9 @@ void cmMakefile::AddLinkDirectoryForTarget(const char *target,
} }
else else
{ {
cmSystemTools::Error("Attempt to add link directories to non-existant target: ", cmSystemTools::Error
target, " for directory ", d); ("Attempt to add link directories to non-existant target: ",
target, " for directory ", d);
} }
} }
@ -864,7 +882,8 @@ void cmMakefile::AddLinkDirectory(const char* dir)
std::string newdir = dir; std::string newdir = dir;
newdir = newdir.substr(0, newdir.size()-1); newdir = newdir.substr(0, newdir.size()-1);
if(std::find(this->LinkDirectories.begin(), if(std::find(this->LinkDirectories.begin(),
this->LinkDirectories.end(), newdir.c_str()) == this->LinkDirectories.end()) this->LinkDirectories.end(),
newdir.c_str()) == this->LinkDirectories.end())
{ {
this->LinkDirectories.push_back(newdir); this->LinkDirectories.push_back(newdir);
} }
@ -872,7 +891,8 @@ void cmMakefile::AddLinkDirectory(const char* dir)
else else
{ {
if(std::find(this->LinkDirectories.begin(), if(std::find(this->LinkDirectories.begin(),
this->LinkDirectories.end(), dir) == this->LinkDirectories.end()) this->LinkDirectories.end(), dir)
== this->LinkDirectories.end())
{ {
this->LinkDirectories.push_back(dir); this->LinkDirectories.push_back(dir);
} }
@ -916,7 +936,8 @@ void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2)
lg2->Configure(); lg2->Configure();
} }
void cmMakefile::AddSubDirectory(const char* sub, bool topLevel, bool preorder) void cmMakefile::AddSubDirectory(const char* sub,
bool topLevel, bool preorder)
{ {
// the source path must be made full if it isn't already // the source path must be made full if it isn't already
std::string srcPath = sub; std::string srcPath = sub;
@ -946,14 +967,17 @@ void cmMakefile::AddSubDirectory(const char* srcPath, const char *binPath,
bool topLevel, bool preorder, bool topLevel, bool preorder,
bool immediate) bool immediate)
{ {
std::vector<cmLocalGenerator *>& children = this->LocalGenerator->GetChildren(); std::vector<cmLocalGenerator *>& children =
this->LocalGenerator->GetChildren();
// has this directory already been added? If so error // has this directory already been added? If so error
unsigned int i; unsigned int i;
for (i = 0; i < children.size(); ++i) for (i = 0; i < children.size(); ++i)
{ {
if (srcPath == children[i]->GetMakefile()->GetStartDirectory()) if (srcPath == children[i]->GetMakefile()->GetStartDirectory())
{ {
cmSystemTools::Error("Attempt to add subdirectory multiple times for directory.\n", srcPath); cmSystemTools::Error
("Attempt to add subdirectory multiple times for directory.\n",
srcPath);
return; return;
} }
} }
@ -1088,7 +1112,9 @@ void cmMakefile::AddDefinition(const char* name, bool value)
} }
void cmMakefile::AddCacheDefinition(const char* name, bool value, const char* doc) void cmMakefile::AddCacheDefinition(const char* name,
bool value,
const char* doc)
{ {
bool val = value; bool val = value;
cmCacheManager::CacheIterator it = cmCacheManager::CacheIterator it =
@ -1197,8 +1223,8 @@ cmSourceFile *cmMakefile::GetSourceFileWithOutput(const char *cname)
// look through all the source files that have custom commands // look through all the source files that have custom commands
// and see if the custom command has the passed source file as an output // and see if the custom command has the passed source file as an output
// keep in mind the possible .rule extension that may be tacked on // keep in mind the possible .rule extension that may be tacked on
for(std::vector<cmSourceFile*>::const_iterator i = this->SourceFiles.begin(); for(std::vector<cmSourceFile*>::const_iterator i =
i != this->SourceFiles.end(); ++i) this->SourceFiles.begin(); i != this->SourceFiles.end(); ++i)
{ {
// does this source file have a custom command? // does this source file have a custom command?
if ((*i)->GetCustomCommand()) if ((*i)->GetCustomCommand())
@ -1251,7 +1277,9 @@ cmSourceGroup* cmMakefile::GetSourceGroup(const char* name)
return 0; return 0;
} }
void cmMakefile::AddSourceGroup(const char* name, const char* regex, const char *parent) void cmMakefile::AddSourceGroup(const char* name,
const char* regex,
const char *parent)
{ {
// First see if the group exists. If so, replace its regular expression. // First see if the group exists. If so, replace its regular expression.
for(unsigned int i=0;i<this->SourceGroups.size();++i) for(unsigned int i=0;i<this->SourceGroups.size();++i)
@ -1281,8 +1309,9 @@ void cmMakefile::AddSourceGroup(const char* name, const char* regex, const char
{ {
if ( regex ) if ( regex )
{ {
// We only want to set the regular expression. If there are already // We only want to set the regular expression. If there are
// source files in the group, we don't want to remove them. // already source files in the group, we don't want to remove
// them.
localtarget->SetGroupRegex(regex); localtarget->SetGroupRegex(regex);
} }
} }
@ -1304,8 +1333,9 @@ void cmMakefile::AddSourceGroup(const char* name, const char* regex, const char
{ {
if ( regex ) if ( regex )
{ {
// We only want to set the regular expression. If there are already // We only want to set the regular expression. If there are
// source files in the group, we don't want to remove them. // already source files in the group, we don't want to
// remove them.
addtarget->SetGroupRegex(regex); addtarget->SetGroupRegex(regex);
} }
} }
@ -1388,7 +1418,8 @@ bool cmMakefile::CanIWriteThisFile(const char* fileName)
return true; return true;
} }
// If we are doing an in-source build, than the test will always fail // If we are doing an in-source build, than the test will always fail
if ( cmSystemTools::SameFile(this->GetHomeDirectory(), this->GetHomeOutputDirectory()) ) if ( cmSystemTools::SameFile(this->GetHomeDirectory(),
this->GetHomeOutputDirectory()) )
{ {
if ( this->IsOn("CMAKE_DISABLE_IN_SOURCE_BUILD") ) if ( this->IsOn("CMAKE_DISABLE_IN_SOURCE_BUILD") )
{ {
@ -1397,7 +1428,8 @@ bool cmMakefile::CanIWriteThisFile(const char* fileName)
return true; return true;
} }
// Check if this is subdirectory of the source tree but not a subdirectory of a build tree // Check if this is subdirectory of the source tree but not a
// subdirectory of a build tree
if ( cmSystemTools::IsSubDirectory(fileName, if ( cmSystemTools::IsSubDirectory(fileName,
this->GetHomeDirectory()) && this->GetHomeDirectory()) &&
!cmSystemTools::IsSubDirectory(fileName, !cmSystemTools::IsSubDirectory(fileName,
@ -1413,7 +1445,8 @@ const char* cmMakefile::GetRequiredDefinition(const char* name) const
const char* ret = this->GetDefinition(name); const char* ret = this->GetDefinition(name);
if(!ret) if(!ret)
{ {
cmSystemTools::Error("Error required internal CMake variable not set, cmake may be not be built correctly.\n", cmSystemTools::Error("Error required internal CMake variable not "
"set, cmake may be not be built correctly.\n",
"Missing variable is:\n", "Missing variable is:\n",
name); name);
return ""; return "";
@ -1449,8 +1482,8 @@ const char* cmMakefile::GetDefinition(const char* name) const
if (pos2 != this->Definitions.end() && if (pos2 != this->Definitions.end() &&
cmSystemTools::IsOn((*pos2).second.c_str())) cmSystemTools::IsOn((*pos2).second.c_str()))
{ {
vv->VariableAccessed(name, vv->VariableAccessed
cmVariableWatch::ALLOWED_UNKNOWN_VARIABLE_READ_ACCESS); (name, cmVariableWatch::ALLOWED_UNKNOWN_VARIABLE_READ_ACCESS);
} }
else else
{ {
@ -1473,18 +1506,21 @@ const char* cmMakefile::GetSafeDefinition(const char* def) const
return ret; return ret;
} }
std::vector<std::string> cmMakefile::GetDefinitions(int cacheonly /* = 0 */) const std::vector<std::string> cmMakefile
::GetDefinitions(int cacheonly /* = 0 */) const
{ {
std::map<cmStdString, int> definitions; std::map<cmStdString, int> definitions;
if ( !cacheonly ) if ( !cacheonly )
{ {
DefinitionMap::const_iterator it; DefinitionMap::const_iterator it;
for ( it = this->Definitions.begin(); it != this->Definitions.end(); it ++ ) for ( it = this->Definitions.begin();
it != this->Definitions.end(); it ++ )
{ {
definitions[it->first] = 1; definitions[it->first] = 1;
} }
} }
cmCacheManager::CacheIterator cit = this->GetCacheManager()->GetCacheIterator(); cmCacheManager::CacheIterator cit =
this->GetCacheManager()->GetCacheIterator();
for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() ) for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() )
{ {
definitions[cit.GetName()] = 1; definitions[cit.GetName()] = 1;
@ -1617,7 +1653,8 @@ const char *cmMakefile::ExpandVariablesInString(std::string& source,
// bogus $ with no { so add $ to result and move on // bogus $ with no { so add $ to result and move on
result += '$'; // add bogus $ back into string result += '$'; // add bogus $ back into string
currentPos = markerPos+1; // move on currentPos = markerPos+1; // move on
endVariableMarker = ' '; // set end var to space so we can tell bogus // set end var to space so we can tell bogus
endVariableMarker = ' ';
} }
} }
else else
@ -1648,7 +1685,8 @@ const char *cmMakefile::ExpandVariablesInString(std::string& source,
else else
{ {
// good variable remove it // good variable remove it
std::string var = source.substr(markerPos, endVariablePos - markerPos); std::string var =
source.substr(markerPos, endVariablePos - markerPos);
bool found = false; bool found = false;
if (markerStartSize == 5) // $ENV{ if (markerStartSize == 5) // $ENV{
{ {
@ -1853,7 +1891,8 @@ void cmMakefile::ExpandArguments(
{ {
// Expand the variables in the argument. // Expand the variables in the argument.
value = i->Value; value = i->Value;
this->ExpandVariablesInString(value, false, false, false, i->FilePath, i->Line); this->ExpandVariablesInString(value, false, false, false,
i->FilePath, i->Line);
// If the argument is quoted, it should be one argument. // If the argument is quoted, it should be one argument.
// Otherwise, it may be a list of arguments. // Otherwise, it may be a list of arguments.
@ -1905,7 +1944,8 @@ void cmMakefile::SetHomeOutputDirectory(const char* lib)
this->AddDefinition("CMAKE_BINARY_DIR", this->GetHomeOutputDirectory()); this->AddDefinition("CMAKE_BINARY_DIR", this->GetHomeOutputDirectory());
if ( !this->GetDefinition("CMAKE_CURRENT_BINARY_DIR") ) if ( !this->GetDefinition("CMAKE_CURRENT_BINARY_DIR") )
{ {
this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", this->GetHomeOutputDirectory()); this->AddDefinition("CMAKE_CURRENT_BINARY_DIR",
this->GetHomeOutputDirectory());
} }
} }
@ -1978,7 +2018,8 @@ cmSourceFile* cmMakefile::GetSource(const char* sourceName) const
ext = ext.substr(1); ext = ext.substr(1);
} }
for(std::vector<cmSourceFile*>::const_iterator i = this->SourceFiles.begin(); for(std::vector<cmSourceFile*>::const_iterator i =
this->SourceFiles.begin();
i != this->SourceFiles.end(); ++i) i != this->SourceFiles.end(); ++i)
{ {
if ((*i)->GetSourceNameWithoutLastExtension() == sname && if ((*i)->GetSourceNameWithoutLastExtension() == sname &&
@ -1996,7 +2037,8 @@ cmSourceFile* cmMakefile::GetSource(const char* sourceName) const
} }
path = this->GetCurrentOutputDirectory(); path = this->GetCurrentOutputDirectory();
for(std::vector<cmSourceFile*>::const_iterator i = this->SourceFiles.begin(); for(std::vector<cmSourceFile*>::const_iterator i =
this->SourceFiles.begin();
i != this->SourceFiles.end(); ++i) i != this->SourceFiles.end(); ++i)
{ {
if ((*i)->GetSourceName() == sname && if ((*i)->GetSourceName() == sname &&
@ -2059,7 +2101,8 @@ cmSourceFile* cmMakefile::GetOrCreateSource(const char* sourceName,
} }
else else
{ {
if ( cmSystemTools::GetFilenameLastExtension(srcTreeFile.c_str()).size() == 0) if ( cmSystemTools::GetFilenameLastExtension
(srcTreeFile.c_str()).size() == 0)
{ {
if (cmSystemTools::DoesFileExistWithExtensions( if (cmSystemTools::DoesFileExistWithExtensions(
srcTreeFile.c_str(), this->GetSourceExtensions())) srcTreeFile.c_str(), this->GetSourceExtensions()))
@ -2091,8 +2134,10 @@ cmSourceFile* cmMakefile::GetOrCreateSource(const char* sourceName,
{ {
ext = ext.substr(1); ext = ext.substr(1);
} }
bool headerFile = !(std::find( this->HeaderFileExtensions.begin(), this->HeaderFileExtensions.end(), ext ) == bool headerFile =
this->HeaderFileExtensions.end()); !(std::find( this->HeaderFileExtensions.begin(),
this->HeaderFileExtensions.end(), ext ) ==
this->HeaderFileExtensions.end());
file.SetName(name_no_ext.c_str(), path.c_str(), ext.c_str(), headerFile); file.SetName(name_no_ext.c_str(), path.c_str(), ext.c_str(), headerFile);
} }
else else
@ -2190,8 +2235,8 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir,
std::string cmakeCommand = this->GetDefinition("CMAKE_COMMAND"); std::string cmakeCommand = this->GetDefinition("CMAKE_COMMAND");
cmake cm; cmake cm;
cm.SetIsInTryCompile(true); cm.SetIsInTryCompile(true);
cmGlobalGenerator *gg = cmGlobalGenerator *gg = cm.CreateGlobalGenerator
cm.CreateGlobalGenerator(this->LocalGenerator->GetGlobalGenerator()->GetName()); (this->LocalGenerator->GetGlobalGenerator()->GetName());
if (!gg) if (!gg)
{ {
cmSystemTools::Error( cmSystemTools::Error(
@ -2215,7 +2260,8 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir,
cm.SetCacheArgs(*cmakeArgs); cm.SetCacheArgs(*cmakeArgs);
} }
// to save time we pass the EnableLanguage info directly // to save time we pass the EnableLanguage info directly
gg->EnableLanguagesFromGenerator(this->LocalGenerator->GetGlobalGenerator()); gg->EnableLanguagesFromGenerator
(this->LocalGenerator->GetGlobalGenerator());
if (cm.Configure() != 0) if (cm.Configure() != 0)
{ {
@ -2238,11 +2284,11 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir,
// finally call the generator to actually build the resulting project // finally call the generator to actually build the resulting project
int ret = int ret =
this->LocalGenerator->GetGlobalGenerator()->TryCompile(srcdir,bindir, this->LocalGenerator->GetGlobalGenerator()->TryCompile(srcdir,bindir,
projectName, projectName,
targetName, targetName,
output, output,
this); this);
cmSystemTools::ChangeDirectory(cwd.c_str()); cmSystemTools::ChangeDirectory(cwd.c_str());
return ret; return ret;
} }
@ -2365,7 +2411,8 @@ void cmMakefile::ConfigureString(const std::string& input,
// Replace #cmakedefine instances. // Replace #cmakedefine instances.
if(this->cmDefineRegex.find(line)) if(this->cmDefineRegex.find(line))
{ {
const char* def = this->GetDefinition(this->cmDefineRegex.match(1).c_str()); const char* def =
this->GetDefinition(this->cmDefineRegex.match(1).c_str());
if(!cmSystemTools::IsOff(def)) if(!cmSystemTools::IsOff(def))
{ {
cmSystemTools::ReplaceString(line, "#cmakedefine", "#define"); cmSystemTools::ReplaceString(line, "#cmakedefine", "#define");
@ -2381,7 +2428,8 @@ void cmMakefile::ConfigureString(const std::string& input,
} }
else if(this->cmDefine01Regex.find(line)) else if(this->cmDefine01Regex.find(line))
{ {
const char* def = this->GetDefinition(this->cmDefine01Regex.match(1).c_str()); const char* def =
this->GetDefinition(this->cmDefine01Regex.match(1).c_str());
cmSystemTools::ReplaceString(line, "#cmakedefine01", "#define"); cmSystemTools::ReplaceString(line, "#cmakedefine01", "#define");
output += line; output += line;
if(!cmSystemTools::IsOff(def)) if(!cmSystemTools::IsOff(def))
@ -2408,8 +2456,8 @@ void cmMakefile::ConfigureString(const std::string& input,
} }
// Perform variable replacements. // Perform variable replacements.
this->ExpandVariablesInString(output, escapeQuotes, true, atOnly, 0, -1, true); this->ExpandVariablesInString(output, escapeQuotes, true,
// this->RemoveVariablesInString(output, atOnly); atOnly, 0, -1, true);
} }
int cmMakefile::ConfigureFile(const char* infile, const char* outfile, int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
@ -2418,7 +2466,8 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
int res = 1; int res = 1;
if ( !this->CanIWriteThisFile(outfile) ) if ( !this->CanIWriteThisFile(outfile) )
{ {
cmSystemTools::Error("Attempt to write file: ", outfile, " into a source directory."); cmSystemTools::Error("Attempt to write file: ",
outfile, " into a source directory.");
return 0; return 0;
} }
if ( !cmSystemTools::FileExists(infile) ) if ( !cmSystemTools::FileExists(infile) )
@ -2511,7 +2560,10 @@ bool cmMakefile::CheckInfiniteLoops()
if ( this->HasWrittenFile(it->c_str()) ) if ( this->HasWrittenFile(it->c_str()) )
{ {
cmOStringStream str; cmOStringStream str;
str << "File " << it->c_str() << " is written by WRITE_FILE (or FILE WRITE) command and should not be used as input to CMake. Please use CONFIGURE_FILE to be safe. Refer to the note next to FILE WRITE command."; str << "File " << it->c_str() <<
" is written by WRITE_FILE (or FILE WRITE) command and should "
"not be used as input to CMake. Please use CONFIGURE_FILE to "
"be safe. Refer to the note next to FILE WRITE command.";
cmSystemTools::Error(str.str().c_str()); cmSystemTools::Error(str.str().c_str());
return false; return false;
} }

View File

@ -566,7 +566,8 @@ public:
* Remove any remaining variables in the string. Anything with ${var} or * Remove any remaining variables in the string. Anything with ${var} or
* @var@ will be removed. * @var@ will be removed.
*/ */
void RemoveVariablesInString(std::string& source, bool atOnly = false) const; void RemoveVariablesInString(std::string& source,
bool atOnly = false) const;
/** /**
* Expand variables in the makefiles ivars such as link directories etc * Expand variables in the makefiles ivars such as link directories etc
@ -612,7 +613,8 @@ public:
*/ */
void AddCommand(cmCommand* ); void AddCommand(cmCommand* );
///! Enable support for named language, if nil then all languages are enabled. ///! Enable support for named language, if nil then all languages are
///enabled.
void EnableLanguage(std::vector<std::string>const& languages); void EnableLanguage(std::vector<std::string>const& languages);
/** /**

View File

@ -95,8 +95,9 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// Get the name of the executable to generate. // Get the name of the executable to generate.
std::string targetName; std::string targetName;
std::string targetNameReal; std::string targetNameReal;
this->Target->GetExecutableNames(targetName, targetNameReal, this->Target->GetExecutableNames
this->LocalGenerator->ConfigurationName.c_str()); (targetName, targetNameReal,
this->LocalGenerator->ConfigurationName.c_str());
// Construct the full path version of the names. // Construct the full path version of the names.
std::string outpath = this->LocalGenerator->ExecutableOutputPath; std::string outpath = this->LocalGenerator->ExecutableOutputPath;
@ -135,7 +136,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
sourceIt != this->Target->GetSourceFiles().end(); sourceIt != this->Target->GetSourceFiles().end();
++ sourceIt ) ++ sourceIt )
{ {
const char* subDir = (*sourceIt)->GetProperty("MACOSX_PACKAGE_LOCATION"); const char* subDir =
(*sourceIt)->GetProperty("MACOSX_PACKAGE_LOCATION");
if ( subDir ) if ( subDir )
{ {
std::string newDir = macdir; std::string newDir = macdir;
@ -156,7 +158,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
cmSystemTools::MakeDirectory(macdir.c_str()); cmSystemTools::MakeDirectory(macdir.c_str());
this->Makefile->AddDefinition("MACOSX_BUNDLE_EXECUTABLE_NAME", this->Makefile->AddDefinition("MACOSX_BUNDLE_EXECUTABLE_NAME",
targetName.c_str()); targetName.c_str());
this->Makefile->ConfigureFile(f1.c_str(), f2.c_str(), false, false, false); this->Makefile->ConfigureFile(f1.c_str(), f2.c_str(),
false, false, false);
} }
#endif #endif
if(relink) if(relink)
@ -221,13 +224,13 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
if(this->Target->GetPropertyAsBool("WIN32_EXECUTABLE")) if(this->Target->GetPropertyAsBool("WIN32_EXECUTABLE"))
{ {
this->LocalGenerator->AppendFlags(linkFlags, this->LocalGenerator->AppendFlags
this->Makefile->GetDefinition("CMAKE_CREATE_WIN32_EXE")); (linkFlags, this->Makefile->GetDefinition("CMAKE_CREATE_WIN32_EXE"));
} }
else else
{ {
this->LocalGenerator->AppendFlags(linkFlags, this->LocalGenerator->AppendFlags
this->Makefile->GetDefinition("CMAKE_CREATE_CONSOLE_EXE")); (linkFlags, this->Makefile->GetDefinition("CMAKE_CREATE_CONSOLE_EXE"));
} }
// Add language-specific flags. // Add language-specific flags.
@ -236,19 +239,24 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
this->LocalGenerator->ConfigurationName.c_str()); this->LocalGenerator->ConfigurationName.c_str());
// Add target-specific linker flags. // Add target-specific linker flags.
this->LocalGenerator->AppendFlags(linkFlags, this->Target->GetProperty("LINK_FLAGS")); this->LocalGenerator->AppendFlags
(linkFlags, this->Target->GetProperty("LINK_FLAGS"));
std::string linkFlagsConfig = "LINK_FLAGS_"; std::string linkFlagsConfig = "LINK_FLAGS_";
linkFlagsConfig += cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName.c_str()); linkFlagsConfig +=
this->LocalGenerator->AppendFlags(linkFlags, cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName.c_str());
this->Target->GetProperty(linkFlagsConfig.c_str())); this->LocalGenerator->AppendFlags
(linkFlags, this->Target->GetProperty(linkFlagsConfig.c_str()));
// Construct a list of files associated with this executable that // Construct a list of files associated with this executable that
// may need to be cleaned. // may need to be cleaned.
std::vector<std::string> exeCleanFiles; std::vector<std::string> exeCleanFiles;
{ {
std::string cleanName; std::string cleanName;
std::string cleanRealName; std::string cleanRealName;
this->Target->GetExecutableCleanNames(cleanName, cleanRealName, this->Target->GetExecutableCleanNames
this->LocalGenerator->ConfigurationName.c_str()); (cleanName, cleanRealName,
this->LocalGenerator->ConfigurationName.c_str());
std::string cleanFullName = outpath + cleanName; std::string cleanFullName = outpath + cleanName;
std::string cleanFullRealName = outpath + cleanRealName; std::string cleanFullRealName = outpath + cleanRealName;
exeCleanFiles.push_back(this->Convert(cleanFullName.c_str(), exeCleanFiles.push_back(this->Convert(cleanFullName.c_str(),
@ -266,9 +274,11 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
std::vector<std::string> commands1; std::vector<std::string> commands1;
this->LocalGenerator->AppendCleanCommand(commands1, exeCleanFiles, this->LocalGenerator->AppendCleanCommand(commands1, exeCleanFiles,
*this->Target, "target"); *this->Target, "target");
this->LocalGenerator->CreateCDCommand(commands1, this->LocalGenerator->CreateCDCommand
this->Makefile->GetStartOutputDirectory(), (commands1,
this->Makefile->GetHomeOutputDirectory()); this->Makefile->GetStartOutputDirectory(),
this->Makefile->GetHomeOutputDirectory());
commands.insert(commands.end(), commands1.begin(), commands1.end()); commands.insert(commands.end(), commands1.begin(), commands1.end());
commands1.clear(); commands1.clear();

View File

@ -91,7 +91,8 @@ void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules()
linkRuleVar += "_CREATE_STATIC_LIBRARY"; linkRuleVar += "_CREATE_STATIC_LIBRARY";
std::string extraFlags; std::string extraFlags;
this->LocalGenerator->AppendFlags(extraFlags, this->Target->GetProperty("STATIC_LIBRARY_FLAGS")); this->LocalGenerator->AppendFlags
(extraFlags,this->Target->GetProperty("STATIC_LIBRARY_FLAGS"));
this->WriteLibraryRules(linkRuleVar.c_str(), extraFlags.c_str(), false); this->WriteLibraryRules(linkRuleVar.c_str(), extraFlags.c_str(), false);
} }
@ -108,26 +109,34 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
linkRuleVar += "_CREATE_SHARED_LIBRARY"; linkRuleVar += "_CREATE_SHARED_LIBRARY";
std::string extraFlags; std::string extraFlags;
this->LocalGenerator->AppendFlags(extraFlags, this->Target->GetProperty("LINK_FLAGS")); this->LocalGenerator->AppendFlags
(extraFlags, this->Target->GetProperty("LINK_FLAGS"));
std::string linkFlagsConfig = "LINK_FLAGS_"; std::string linkFlagsConfig = "LINK_FLAGS_";
linkFlagsConfig += cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName.c_str()); linkFlagsConfig +=
this->LocalGenerator->AppendFlags(extraFlags, cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName.c_str());
this->Target->GetProperty(linkFlagsConfig.c_str())); this->LocalGenerator->AppendFlags
(extraFlags, this->Target->GetProperty(linkFlagsConfig.c_str()));
this->LocalGenerator->AddConfigVariableFlags(extraFlags, "CMAKE_SHARED_LINKER_FLAGS", this->LocalGenerator->AddConfigVariableFlags
this->LocalGenerator->ConfigurationName.c_str()); (extraFlags, "CMAKE_SHARED_LINKER_FLAGS",
if(this->Makefile->IsOn("WIN32") && !(this->Makefile->IsOn("CYGWIN") || this->Makefile->IsOn("MINGW"))) this->LocalGenerator->ConfigurationName.c_str());
if(this->Makefile->IsOn("WIN32") && !(this->Makefile->IsOn("CYGWIN")
|| this->Makefile->IsOn("MINGW")))
{ {
const std::vector<cmSourceFile*>& sources = this->Target->GetSourceFiles(); const std::vector<cmSourceFile*>& sources =
this->Target->GetSourceFiles();
for(std::vector<cmSourceFile*>::const_iterator i = sources.begin(); for(std::vector<cmSourceFile*>::const_iterator i = sources.begin();
i != sources.end(); ++i) i != sources.end(); ++i)
{ {
if((*i)->GetSourceExtension() == "def") if((*i)->GetSourceExtension() == "def")
{ {
extraFlags += " "; extraFlags += " ";
extraFlags += this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG");
extraFlags += extraFlags +=
this->Convert((*i)->GetFullPath().c_str(),cmLocalGenerator::START_OUTPUT,cmLocalGenerator::MAKEFILE); this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG");
extraFlags +=
this->Convert((*i)->GetFullPath().c_str(),
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::MAKEFILE);
} }
} }
} }
@ -147,13 +156,17 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
linkRuleVar += "_CREATE_SHARED_MODULE"; linkRuleVar += "_CREATE_SHARED_MODULE";
std::string extraFlags; std::string extraFlags;
this->LocalGenerator->AppendFlags(extraFlags, this->Target->GetProperty("LINK_FLAGS"));
std::string linkFlagsConfig = "LINK_FLAGS_";
linkFlagsConfig += cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName.c_str());
this->LocalGenerator->AppendFlags(extraFlags, this->LocalGenerator->AppendFlags(extraFlags,
this->Target->GetProperty(linkFlagsConfig.c_str())); this->Target->GetProperty("LINK_FLAGS"));
this->LocalGenerator->AddConfigVariableFlags(extraFlags, "CMAKE_MODULE_LINKER_FLAGS", std::string linkFlagsConfig = "LINK_FLAGS_";
this->LocalGenerator->ConfigurationName.c_str()); linkFlagsConfig +=
cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName.c_str());
this->LocalGenerator->AppendFlags
(extraFlags, this->Target->GetProperty(linkFlagsConfig.c_str()));
this->LocalGenerator->AddConfigVariableFlags
(extraFlags, "CMAKE_MODULE_LINKER_FLAGS",
this->LocalGenerator->ConfigurationName.c_str());
// TODO: .def files should be supported here also. // TODO: .def files should be supported here also.
this->WriteLibraryRules(linkRuleVar.c_str(), extraFlags.c_str(), relink); this->WriteLibraryRules(linkRuleVar.c_str(), extraFlags.c_str(), relink);
} }
@ -233,7 +246,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
outpath += "/"; outpath += "/";
} }
std::string targetFullPath = outpath + targetName; std::string targetFullPath = outpath + targetName;
std::string targetFullPathPDB = outpath + this->Target->GetName() + std::string(".pdb"); std::string targetFullPathPDB =
outpath + this->Target->GetName() + std::string(".pdb");
std::string targetFullPathSO = outpath + targetNameSO; std::string targetFullPathSO = outpath + targetNameSO;
std::string targetFullPathReal = outpath + targetNameReal; std::string targetFullPathReal = outpath + targetNameReal;
std::string targetFullPathImport = outpath + targetNameImport; std::string targetFullPathImport = outpath + targetNameImport;
@ -341,9 +355,10 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
std::vector<std::string> commands1; std::vector<std::string> commands1;
this->LocalGenerator->AppendCleanCommand(commands1, libCleanFiles, this->LocalGenerator->AppendCleanCommand(commands1, libCleanFiles,
*this->Target, "target"); *this->Target, "target");
this->LocalGenerator->CreateCDCommand(commands1, this->LocalGenerator->CreateCDCommand
this->Makefile->GetStartOutputDirectory(), (commands1,
this->Makefile->GetHomeOutputDirectory()); this->Makefile->GetStartOutputDirectory(),
this->Makefile->GetHomeOutputDirectory());
commands.insert(commands.end(), commands1.begin(), commands1.end()); commands.insert(commands.end(), commands1.begin(), commands1.end());
commands1.clear(); commands1.clear();
@ -359,9 +374,10 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
// Construct the main link rule. // Construct the main link rule.
std::string linkRule = this->Makefile->GetRequiredDefinition(linkRuleVar); std::string linkRule = this->Makefile->GetRequiredDefinition(linkRuleVar);
cmSystemTools::ExpandListArgument(linkRule, commands1); cmSystemTools::ExpandListArgument(linkRule, commands1);
this->LocalGenerator->CreateCDCommand(commands1, this->LocalGenerator->CreateCDCommand
this->Makefile->GetStartOutputDirectory(), (commands1,
this->Makefile->GetHomeOutputDirectory()); this->Makefile->GetStartOutputDirectory(),
this->Makefile->GetHomeOutputDirectory());
commands.insert(commands.end(), commands1.begin(), commands1.end()); commands.insert(commands.end(), commands1.begin(), commands1.end());
// Add a rule to create necessary symlinks for the library. // Add a rule to create necessary symlinks for the library.

View File

@ -252,7 +252,8 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source)
// Get the full path name of the object file. // Get the full path name of the object file.
std::string objNoTargetDir; std::string objNoTargetDir;
std::string obj = std::string obj =
this->LocalGenerator->GetObjectFileName(*this->Target, source, &objNoTargetDir); this->LocalGenerator->GetObjectFileName(*this->Target, source,
&objNoTargetDir);
// Avoid generating duplicate rules. // Avoid generating duplicate rules.
if(this->ObjectFiles.find(obj) == this->ObjectFiles.end()) if(this->ObjectFiles.find(obj) == this->ObjectFiles.end())
@ -295,13 +296,15 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source)
this->WriteObjectBuildFile(obj, lang, source, depends); this->WriteObjectBuildFile(obj, lang, source, depends);
// The object file should be checked for dependency integrity. // The object file should be checked for dependency integrity.
this->LocalGenerator->CheckDependFiles[this->Target->GetName()][lang].insert(&source); this->LocalGenerator->
CheckDependFiles[this->Target->GetName()][lang].insert(&source);
// add this to the list of objects for this local generator // add this to the list of objects for this local generator
if(cmSystemTools::FileIsFullPath(objNoTargetDir.c_str())) if(cmSystemTools::FileIsFullPath(objNoTargetDir.c_str()))
{ {
objNoTargetDir = cmSystemTools::GetFilenameName(objNoTargetDir); objNoTargetDir = cmSystemTools::GetFilenameName(objNoTargetDir);
} }
this->LocalGenerator->LocalObjectFiles[objNoTargetDir].push_back(this->Target); this->LocalGenerator->LocalObjectFiles[objNoTargetDir].
push_back(this->Target);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -312,7 +315,8 @@ cmMakefileTargetGenerator
cmSourceFile& source, cmSourceFile& source,
std::vector<std::string>& depends) std::vector<std::string>& depends)
{ {
this->LocalGenerator->AppendRuleDepend(depends, this->FlagFileNameFull.c_str()); this->LocalGenerator->AppendRuleDepend(depends,
this->FlagFileNameFull.c_str());
// generate the depend scanning rule // generate the depend scanning rule
this->WriteObjectDependRules(source, depends); this->WriteObjectDependRules(source, depends);
@ -337,13 +341,15 @@ cmMakefileTargetGenerator
// Add target-specific flags. // Add target-specific flags.
if(this->Target->GetProperty("COMPILE_FLAGS")) if(this->Target->GetProperty("COMPILE_FLAGS"))
{ {
this->LocalGenerator->AppendFlags(flags, this->Target->GetProperty("COMPILE_FLAGS")); this->LocalGenerator->AppendFlags
(flags, this->Target->GetProperty("COMPILE_FLAGS"));
} }
// Add flags from source file properties. // Add flags from source file properties.
if (source.GetProperty("COMPILE_FLAGS")) if (source.GetProperty("COMPILE_FLAGS"))
{ {
this->LocalGenerator->AppendFlags(flags, source.GetProperty("COMPILE_FLAGS")); this->LocalGenerator->AppendFlags
(flags, source.GetProperty("COMPILE_FLAGS"));
*this->FlagFileStream << "# Custom flags: " *this->FlagFileStream << "# Custom flags: "
<< relativeObj << "_FLAGS = " << relativeObj << "_FLAGS = "
<< source.GetProperty("COMPILE_FLAGS") << source.GetProperty("COMPILE_FLAGS")
@ -356,16 +362,15 @@ cmMakefileTargetGenerator
if(this->LocalGenerator->UseRelativePaths) if(this->LocalGenerator->UseRelativePaths)
{ {
sourceFile = this->Convert(sourceFile.c_str(), sourceFile = this->Convert(sourceFile.c_str(),
cmLocalGenerator::HOME_OUTPUT); cmLocalGenerator::HOME_OUTPUT);
} }
sourceFile = this->Convert(sourceFile.c_str(), sourceFile = this->Convert(sourceFile.c_str(),
cmLocalGenerator::NONE, cmLocalGenerator::NONE,
cmLocalGenerator::SHELL); cmLocalGenerator::SHELL);
std::string objectFile = std::string objectFile = this->Convert(obj.c_str(),
this->Convert(obj.c_str(), cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL);
cmLocalGenerator::SHELL);
// Construct the build message. // Construct the build message.
std::vector<std::string> no_commands; std::vector<std::string> no_commands;
std::vector<std::string> commands; std::vector<std::string> commands;
@ -445,7 +450,9 @@ cmMakefileTargetGenerator
this->LocalGenerator->GetRelativeTargetDirectory(*this->Target); this->LocalGenerator->GetRelativeTargetDirectory(*this->Target);
tgtMakefileName += "/build.make"; tgtMakefileName += "/build.make";
r_commands.push_back r_commands.push_back
(this->LocalGenerator->GetRecursiveMakeCall(tgtMakefileName.c_str(),temp.c_str())); (this->LocalGenerator->GetRecursiveMakeCall(tgtMakefileName.c_str(),
temp.c_str()));
p_depends.clear(); p_depends.clear();
p_depends.push_back(objectRequires); p_depends.push_back(objectRequires);
this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
@ -503,10 +510,11 @@ void cmMakefileTargetGenerator::WriteTargetCleanRules()
// Construct the clean command. // Construct the clean command.
this->LocalGenerator->AppendCleanCommand(commands, this->CleanFiles, this->LocalGenerator->AppendCleanCommand(commands, this->CleanFiles,
*this->Target); *this->Target);
this->LocalGenerator->CreateCDCommand(commands, this->LocalGenerator->CreateCDCommand
this->Makefile->GetStartOutputDirectory(), (commands,
this->Makefile->GetHomeOutputDirectory()); this->Makefile->GetStartOutputDirectory(),
this->Makefile->GetHomeOutputDirectory());
// Write the rule. // Write the rule.
this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
cleanTarget.c_str(), cleanTarget.c_str(),
@ -619,11 +627,13 @@ void cmMakefileTargetGenerator
void cmMakefileTargetGenerator::WriteCustomCommands() void cmMakefileTargetGenerator::WriteCustomCommands()
{ {
// add custom commands to the clean rules? // add custom commands to the clean rules?
const char* clean_no_custom = this->Makefile->GetProperty("CLEAN_NO_CUSTOM"); const char* clean_no_custom =
this->Makefile->GetProperty("CLEAN_NO_CUSTOM");
bool clean = cmSystemTools::IsOff(clean_no_custom); bool clean = cmSystemTools::IsOff(clean_no_custom);
// Generate the rule files for each custom command. // Generate the rule files for each custom command.
const std::vector<cmSourceFile*> &classes = this->Makefile->GetSourceFiles(); const std::vector<cmSourceFile*> &classes =
this->Makefile->GetSourceFiles();
for(std::vector<cmSourceFile*>::const_iterator i = classes.begin(); for(std::vector<cmSourceFile*>::const_iterator i = classes.begin();
i != classes.end(); i++) i != classes.end(); i++)
{ {
@ -706,7 +716,8 @@ cmMakefileTargetGenerator
// Write a make variable assignment that lists all objects for the // Write a make variable assignment that lists all objects for the
// target. // target.
variableName = variableName =
this->LocalGenerator->CreateMakeVariable(this->Target->GetName(), "_OBJECTS"); this->LocalGenerator->CreateMakeVariable(this->Target->GetName(),
"_OBJECTS");
*this->BuildFileStream *this->BuildFileStream
<< "# Object files for target " << this->Target->GetName() << "\n" << "# Object files for target " << this->Target->GetName() << "\n"
<< variableName.c_str() << " ="; << variableName.c_str() << " =";
@ -744,10 +755,12 @@ cmMakefileTargetGenerator
// Write a make variable assignment that lists all external objects // Write a make variable assignment that lists all external objects
// for the target. // for the target.
variableNameExternal = variableNameExternal =
this->LocalGenerator->CreateMakeVariable(this->Target->GetName(),"_EXTERNAL_OBJECTS"); this->LocalGenerator->CreateMakeVariable(this->Target->GetName(),
"_EXTERNAL_OBJECTS");
*this->BuildFileStream *this->BuildFileStream
<< "\n" << "\n"
<< "# External object files for target " << this->Target->GetName() << "\n" << "# External object files for target "
<< this->Target->GetName() << "\n"
<< variableNameExternal.c_str() << " ="; << variableNameExternal.c_str() << " =";
for(std::vector<std::string>::const_iterator i = for(std::vector<std::string>::const_iterator i =
this->ExternalObjects.begin(); this->ExternalObjects.begin();
@ -759,9 +772,9 @@ cmMakefileTargetGenerator
<< this->Makefile->GetSafeDefinition("CMAKE_OBJECT_NAME"); << this->Makefile->GetSafeDefinition("CMAKE_OBJECT_NAME");
if(objName) if(objName)
{ {
*this->BuildFileStream << this->Convert(i->c_str(), *this->BuildFileStream <<
cmLocalGenerator::START_OUTPUT, this->Convert(i->c_str(), cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::MAKEFILE); cmLocalGenerator::MAKEFILE);
} }
else else
{ {

View File

@ -17,7 +17,8 @@
#include "cmMarkAsAdvancedCommand.h" #include "cmMarkAsAdvancedCommand.h"
// cmMarkAsAdvancedCommand // cmMarkAsAdvancedCommand
bool cmMarkAsAdvancedCommand::InitialPass(std::vector<std::string> const& args) bool cmMarkAsAdvancedCommand
::InitialPass(std::vector<std::string> const& args)
{ {
if(args.size() < 1 ) if(args.size() < 1 )
{ {
@ -41,7 +42,8 @@ bool cmMarkAsAdvancedCommand::InitialPass(std::vector<std::string> const& args)
{ {
std::string variable = args[i]; std::string variable = args[i];
cmCacheManager* manager = this->Makefile->GetCacheManager(); cmCacheManager* manager = this->Makefile->GetCacheManager();
cmCacheManager::CacheIterator it = manager->GetCacheIterator(variable.c_str()); cmCacheManager::CacheIterator it =
manager->GetCacheIterator(variable.c_str());
if ( it.IsAtEnd() ) if ( it.IsAtEnd() )
{ {
this->Makefile->AddCacheDefinition(variable.c_str(), 0, 0, this->Makefile->AddCacheDefinition(variable.c_str(), 0, 0,

View File

@ -66,7 +66,8 @@ public:
return return
" MATH(EXPR <output variable> <math expression>)\n" " MATH(EXPR <output variable> <math expression>)\n"
"EXPR evaluates mathematical expression and return result in the " "EXPR evaluates mathematical expression and return result in the "
"output variable. Example mathematical expression is '5 * ( 10 + 13 )'."; "output variable. Example mathematical expression is "
"'5 * ( 10 + 13 )'.";
} }
cmTypeMacro(cmMathCommand, cmCommand); cmTypeMacro(cmMathCommand, cmCommand);