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.FilePath = this->Functions[c].FilePath;
newLFF.Line = this->Functions[c].Line;
const char* def =
this->Makefile->GetDefinition("CMAKE_MACRO_REPORT_DEFINITION_LOCATION");
const char* def = this->Makefile->GetDefinition
("CMAKE_MACRO_REPORT_DEFINITION_LOCATION");
bool macroReportLocation = false;
if(def && !cmSystemTools::IsOff(def))
{

View File

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

View File

@ -73,9 +73,11 @@ cmMakefile::cmMakefile()
#if defined(CMAKE_BUILD_WITH_CMAKE)
this->AddSourceGroup("", "^.*$");
this->AddSourceGroup("Source Files",
"\\.(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
("Source Files",
"\\.(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("Resources", "\\.plist$");
#endif
@ -168,7 +170,8 @@ cmMakefile::~cmMakefile()
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";
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";
}
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";
for(std::vector<std::pair<cmStdString, bool> >::const_iterator i = v.begin();
i != v.end(); ++i)
for(std::vector<std::pair<cmStdString, bool> >::const_iterator i
= v.begin(); i != v.end(); ++i)
{
std::cout << i->first.c_str() << " " << i->second;
}
@ -212,12 +217,14 @@ void cmMakefile::Print()
this->cmStartDirectory.c_str() << std::endl;
std::cout << " this->cmHomeDirectory; " <<
this->cmHomeDirectory.c_str() << std::endl;
std::cout << " this->ProjectName; " << this->ProjectName.c_str() << std::endl;
this->PrintStringVector("this->IncludeDirectories;", this->IncludeDirectories);
std::cout << " this->ProjectName; "
<< this->ProjectName.c_str() << std::endl;
this->PrintStringVector("this->IncludeDirectories;",
this->IncludeDirectories);
this->PrintStringVector("this->LinkDirectories", this->LinkDirectories);
#if defined(CMAKE_BUILD_WITH_CMAKE)
for( std::vector<cmSourceGroup>::const_iterator i = this->SourceGroups.begin();
i != this->SourceGroups.end(); ++i)
for( std::vector<cmSourceGroup>::const_iterator i =
this->SourceGroups.begin(); i != this->SourceGroups.end(); ++i)
{
std::cout << "Source Group: " << i->GetName() << std::endl;
}
@ -238,6 +245,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff)
// No error.
return result;
}
std::string name = lff.Name;
// execute the command
cmCommand *rm =
@ -288,12 +296,14 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff)
this->UsedCommands.push_back(usedCommand);
}
}
else if ( this->GetCMakeInstance()->GetScriptMode() && !usedCommand->IsScriptable() )
else if ( this->GetCMakeInstance()->GetScriptMode()
&& !usedCommand->IsScriptable() )
{
cmOStringStream error;
error << "Error in cmake code at\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());
result = false;
cmSystemTools::SetFatalErrorOccured();
@ -323,7 +333,8 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff)
// 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");
this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename_in);
@ -475,7 +486,11 @@ void cmMakefile::ConfigureFinalPass()
= this->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY");
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();
l != this->Targets.end(); l++)
@ -791,7 +806,8 @@ void cmMakefile::RemoveDefineFlag(const char* 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(
std::pair<std::string, cmTarget::LinkLibraryType>(lib,llt));
@ -814,7 +830,8 @@ void cmMakefile::AddLinkLibraryForTarget(const char *target,
{
cmOStringStream e;
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";
cmSystemTools::Error(e.str().c_str());
}
@ -841,8 +858,9 @@ void cmMakefile::AddLinkDirectoryForTarget(const char *target,
}
else
{
cmSystemTools::Error("Attempt to add link directories to non-existant target: ",
target, " for directory ", d);
cmSystemTools::Error
("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;
newdir = newdir.substr(0, newdir.size()-1);
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);
}
@ -872,7 +891,8 @@ void cmMakefile::AddLinkDirectory(const char* dir)
else
{
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);
}
@ -916,7 +936,8 @@ void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2)
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
std::string srcPath = sub;
@ -946,14 +967,17 @@ void cmMakefile::AddSubDirectory(const char* srcPath, const char *binPath,
bool topLevel, bool preorder,
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
unsigned int i;
for (i = 0; i < children.size(); ++i)
{
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;
}
}
@ -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;
cmCacheManager::CacheIterator it =
@ -1197,8 +1223,8 @@ cmSourceFile *cmMakefile::GetSourceFileWithOutput(const char *cname)
// look through all the source files that have custom commands
// 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
for(std::vector<cmSourceFile*>::const_iterator i = this->SourceFiles.begin();
i != this->SourceFiles.end(); ++i)
for(std::vector<cmSourceFile*>::const_iterator i =
this->SourceFiles.begin(); i != this->SourceFiles.end(); ++i)
{
// does this source file have a custom command?
if ((*i)->GetCustomCommand())
@ -1251,7 +1277,9 @@ cmSourceGroup* cmMakefile::GetSourceGroup(const char* name)
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.
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 )
{
// We only want to set the regular expression. If there are already
// source files in the group, we don't want to remove them.
// We only want to set the regular expression. If there are
// already source files in the group, we don't want to remove
// them.
localtarget->SetGroupRegex(regex);
}
}
@ -1304,8 +1333,9 @@ void cmMakefile::AddSourceGroup(const char* name, const char* regex, const char
{
if ( regex )
{
// We only want to set the regular expression. If there are already
// source files in the group, we don't want to remove them.
// We only want to set the regular expression. If there are
// already source files in the group, we don't want to
// remove them.
addtarget->SetGroupRegex(regex);
}
}
@ -1388,7 +1418,8 @@ bool cmMakefile::CanIWriteThisFile(const char* fileName)
return true;
}
// 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") )
{
@ -1397,7 +1428,8 @@ bool cmMakefile::CanIWriteThisFile(const char* fileName)
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,
this->GetHomeDirectory()) &&
!cmSystemTools::IsSubDirectory(fileName,
@ -1413,7 +1445,8 @@ const char* cmMakefile::GetRequiredDefinition(const char* name) const
const char* ret = this->GetDefinition(name);
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",
name);
return "";
@ -1449,8 +1482,8 @@ const char* cmMakefile::GetDefinition(const char* name) const
if (pos2 != this->Definitions.end() &&
cmSystemTools::IsOn((*pos2).second.c_str()))
{
vv->VariableAccessed(name,
cmVariableWatch::ALLOWED_UNKNOWN_VARIABLE_READ_ACCESS);
vv->VariableAccessed
(name, cmVariableWatch::ALLOWED_UNKNOWN_VARIABLE_READ_ACCESS);
}
else
{
@ -1473,18 +1506,21 @@ const char* cmMakefile::GetSafeDefinition(const char* def) const
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;
if ( !cacheonly )
{
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;
}
}
cmCacheManager::CacheIterator cit = this->GetCacheManager()->GetCacheIterator();
cmCacheManager::CacheIterator cit =
this->GetCacheManager()->GetCacheIterator();
for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() )
{
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
result += '$'; // add bogus $ back into string
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
@ -1648,7 +1685,8 @@ const char *cmMakefile::ExpandVariablesInString(std::string& source,
else
{
// good variable remove it
std::string var = source.substr(markerPos, endVariablePos - markerPos);
std::string var =
source.substr(markerPos, endVariablePos - markerPos);
bool found = false;
if (markerStartSize == 5) // $ENV{
{
@ -1853,7 +1891,8 @@ void cmMakefile::ExpandArguments(
{
// Expand the variables in the argument.
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.
// 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());
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);
}
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)
{
if ((*i)->GetSourceNameWithoutLastExtension() == sname &&
@ -1996,7 +2037,8 @@ cmSourceFile* cmMakefile::GetSource(const char* sourceName) const
}
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)
{
if ((*i)->GetSourceName() == sname &&
@ -2059,7 +2101,8 @@ cmSourceFile* cmMakefile::GetOrCreateSource(const char* sourceName,
}
else
{
if ( cmSystemTools::GetFilenameLastExtension(srcTreeFile.c_str()).size() == 0)
if ( cmSystemTools::GetFilenameLastExtension
(srcTreeFile.c_str()).size() == 0)
{
if (cmSystemTools::DoesFileExistWithExtensions(
srcTreeFile.c_str(), this->GetSourceExtensions()))
@ -2091,8 +2134,10 @@ cmSourceFile* cmMakefile::GetOrCreateSource(const char* sourceName,
{
ext = ext.substr(1);
}
bool headerFile = !(std::find( this->HeaderFileExtensions.begin(), this->HeaderFileExtensions.end(), ext ) ==
this->HeaderFileExtensions.end());
bool headerFile =
!(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);
}
else
@ -2190,8 +2235,8 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir,
std::string cmakeCommand = this->GetDefinition("CMAKE_COMMAND");
cmake cm;
cm.SetIsInTryCompile(true);
cmGlobalGenerator *gg =
cm.CreateGlobalGenerator(this->LocalGenerator->GetGlobalGenerator()->GetName());
cmGlobalGenerator *gg = cm.CreateGlobalGenerator
(this->LocalGenerator->GetGlobalGenerator()->GetName());
if (!gg)
{
cmSystemTools::Error(
@ -2215,7 +2260,8 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir,
cm.SetCacheArgs(*cmakeArgs);
}
// to save time we pass the EnableLanguage info directly
gg->EnableLanguagesFromGenerator(this->LocalGenerator->GetGlobalGenerator());
gg->EnableLanguagesFromGenerator
(this->LocalGenerator->GetGlobalGenerator());
if (cm.Configure() != 0)
{
@ -2238,10 +2284,10 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir,
// finally call the generator to actually build the resulting project
int ret =
this->LocalGenerator->GetGlobalGenerator()->TryCompile(srcdir,bindir,
projectName,
targetName,
output,
this);
projectName,
targetName,
output,
this);
cmSystemTools::ChangeDirectory(cwd.c_str());
return ret;
@ -2365,7 +2411,8 @@ void cmMakefile::ConfigureString(const std::string& input,
// Replace #cmakedefine instances.
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))
{
cmSystemTools::ReplaceString(line, "#cmakedefine", "#define");
@ -2381,7 +2428,8 @@ void cmMakefile::ConfigureString(const std::string& input,
}
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");
output += line;
if(!cmSystemTools::IsOff(def))
@ -2408,8 +2456,8 @@ void cmMakefile::ConfigureString(const std::string& input,
}
// Perform variable replacements.
this->ExpandVariablesInString(output, escapeQuotes, true, atOnly, 0, -1, true);
// this->RemoveVariablesInString(output, atOnly);
this->ExpandVariablesInString(output, escapeQuotes, true,
atOnly, 0, -1, true);
}
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;
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;
}
if ( !cmSystemTools::FileExists(infile) )
@ -2511,7 +2560,10 @@ bool cmMakefile::CheckInfiniteLoops()
if ( this->HasWrittenFile(it->c_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());
return false;
}

View File

@ -566,7 +566,8 @@ public:
* Remove any remaining variables in the string. Anything with ${var} or
* @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
@ -612,7 +613,8 @@ public:
*/
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);
/**

View File

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

View File

@ -91,7 +91,8 @@ void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules()
linkRuleVar += "_CREATE_STATIC_LIBRARY";
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);
}
@ -108,26 +109,34 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
linkRuleVar += "_CREATE_SHARED_LIBRARY";
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_";
linkFlagsConfig += cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName.c_str());
this->LocalGenerator->AppendFlags(extraFlags,
this->Target->GetProperty(linkFlagsConfig.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_SHARED_LINKER_FLAGS",
this->LocalGenerator->ConfigurationName.c_str());
if(this->Makefile->IsOn("WIN32") && !(this->Makefile->IsOn("CYGWIN") || this->Makefile->IsOn("MINGW")))
this->LocalGenerator->AddConfigVariableFlags
(extraFlags, "CMAKE_SHARED_LINKER_FLAGS",
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();
i != sources.end(); ++i)
{
if((*i)->GetSourceExtension() == "def")
{
extraFlags += " ";
extraFlags += this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG");
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";
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->Target->GetProperty(linkFlagsConfig.c_str()));
this->LocalGenerator->AddConfigVariableFlags(extraFlags, "CMAKE_MODULE_LINKER_FLAGS",
this->LocalGenerator->ConfigurationName.c_str());
this->Target->GetProperty("LINK_FLAGS"));
std::string linkFlagsConfig = "LINK_FLAGS_";
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.
this->WriteLibraryRules(linkRuleVar.c_str(), extraFlags.c_str(), relink);
}
@ -233,7 +246,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
outpath += "/";
}
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 targetFullPathReal = outpath + targetNameReal;
std::string targetFullPathImport = outpath + targetNameImport;
@ -341,9 +355,10 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
std::vector<std::string> commands1;
this->LocalGenerator->AppendCleanCommand(commands1, libCleanFiles,
*this->Target, "target");
this->LocalGenerator->CreateCDCommand(commands1,
this->Makefile->GetStartOutputDirectory(),
this->Makefile->GetHomeOutputDirectory());
this->LocalGenerator->CreateCDCommand
(commands1,
this->Makefile->GetStartOutputDirectory(),
this->Makefile->GetHomeOutputDirectory());
commands.insert(commands.end(), commands1.begin(), commands1.end());
commands1.clear();
@ -359,9 +374,10 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
// Construct the main link rule.
std::string linkRule = this->Makefile->GetRequiredDefinition(linkRuleVar);
cmSystemTools::ExpandListArgument(linkRule, commands1);
this->LocalGenerator->CreateCDCommand(commands1,
this->Makefile->GetStartOutputDirectory(),
this->Makefile->GetHomeOutputDirectory());
this->LocalGenerator->CreateCDCommand
(commands1,
this->Makefile->GetStartOutputDirectory(),
this->Makefile->GetHomeOutputDirectory());
commands.insert(commands.end(), commands1.begin(), commands1.end());
// 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.
std::string objNoTargetDir;
std::string obj =
this->LocalGenerator->GetObjectFileName(*this->Target, source, &objNoTargetDir);
this->LocalGenerator->GetObjectFileName(*this->Target, source,
&objNoTargetDir);
// Avoid generating duplicate rules.
if(this->ObjectFiles.find(obj) == this->ObjectFiles.end())
@ -295,13 +296,15 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source)
this->WriteObjectBuildFile(obj, lang, source, depends);
// 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
if(cmSystemTools::FileIsFullPath(objNoTargetDir.c_str()))
{
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,
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
this->WriteObjectDependRules(source, depends);
@ -337,13 +341,15 @@ cmMakefileTargetGenerator
// Add target-specific 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.
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: "
<< relativeObj << "_FLAGS = "
<< source.GetProperty("COMPILE_FLAGS")
@ -356,15 +362,14 @@ cmMakefileTargetGenerator
if(this->LocalGenerator->UseRelativePaths)
{
sourceFile = this->Convert(sourceFile.c_str(),
cmLocalGenerator::HOME_OUTPUT);
cmLocalGenerator::HOME_OUTPUT);
}
sourceFile = this->Convert(sourceFile.c_str(),
cmLocalGenerator::NONE,
cmLocalGenerator::SHELL);
std::string objectFile =
this->Convert(obj.c_str(),
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::SHELL);
cmLocalGenerator::NONE,
cmLocalGenerator::SHELL);
std::string objectFile = this->Convert(obj.c_str(),
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::SHELL);
// Construct the build message.
std::vector<std::string> no_commands;
@ -445,7 +450,9 @@ cmMakefileTargetGenerator
this->LocalGenerator->GetRelativeTargetDirectory(*this->Target);
tgtMakefileName += "/build.make";
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.push_back(objectRequires);
this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
@ -503,9 +510,10 @@ void cmMakefileTargetGenerator::WriteTargetCleanRules()
// Construct the clean command.
this->LocalGenerator->AppendCleanCommand(commands, this->CleanFiles,
*this->Target);
this->LocalGenerator->CreateCDCommand(commands,
this->Makefile->GetStartOutputDirectory(),
this->Makefile->GetHomeOutputDirectory());
this->LocalGenerator->CreateCDCommand
(commands,
this->Makefile->GetStartOutputDirectory(),
this->Makefile->GetHomeOutputDirectory());
// Write the rule.
this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
@ -619,11 +627,13 @@ void cmMakefileTargetGenerator
void cmMakefileTargetGenerator::WriteCustomCommands()
{
// 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);
// 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();
i != classes.end(); i++)
{
@ -706,7 +716,8 @@ cmMakefileTargetGenerator
// Write a make variable assignment that lists all objects for the
// target.
variableName =
this->LocalGenerator->CreateMakeVariable(this->Target->GetName(), "_OBJECTS");
this->LocalGenerator->CreateMakeVariable(this->Target->GetName(),
"_OBJECTS");
*this->BuildFileStream
<< "# Object files for target " << this->Target->GetName() << "\n"
<< variableName.c_str() << " =";
@ -744,10 +755,12 @@ cmMakefileTargetGenerator
// Write a make variable assignment that lists all external objects
// for the target.
variableNameExternal =
this->LocalGenerator->CreateMakeVariable(this->Target->GetName(),"_EXTERNAL_OBJECTS");
this->LocalGenerator->CreateMakeVariable(this->Target->GetName(),
"_EXTERNAL_OBJECTS");
*this->BuildFileStream
<< "\n"
<< "# External object files for target " << this->Target->GetName() << "\n"
<< "# External object files for target "
<< this->Target->GetName() << "\n"
<< variableNameExternal.c_str() << " =";
for(std::vector<std::string>::const_iterator i =
this->ExternalObjects.begin();
@ -759,9 +772,9 @@ cmMakefileTargetGenerator
<< this->Makefile->GetSafeDefinition("CMAKE_OBJECT_NAME");
if(objName)
{
*this->BuildFileStream << this->Convert(i->c_str(),
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::MAKEFILE);
*this->BuildFileStream <<
this->Convert(i->c_str(), cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::MAKEFILE);
}
else
{

View File

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

View File

@ -66,7 +66,8 @@ public:
return
" MATH(EXPR <output variable> <math expression>)\n"
"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);