STYLE: fix line length

This commit is contained in:
Ken Martin 2006-05-11 10:40:28 -04:00
parent 5e68642d16
commit b8483cf109
11 changed files with 257 additions and 171 deletions

View File

@ -111,7 +111,8 @@ bool cmAddSubDirectoryCommand::InitialPass
"directory as well.");
return false;
}
cmSystemTools::ReplaceString(binPath,this->Makefile->GetHomeDirectory(),
cmSystemTools::ReplaceString(binPath,
this->Makefile->GetHomeDirectory(),
this->Makefile->GetHomeOutputDirectory());
}
}

View File

@ -61,7 +61,8 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
if(!mf->GetDefinition("CMAKE_MAKE_PROGRAM")
|| cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM")))
{
std::string setMakeProgram = mf->GetModulesFile(this->FindMakeProgramFile.c_str());
std::string setMakeProgram =
mf->GetModulesFile(this->FindMakeProgramFile.c_str());
if(setMakeProgram.size())
{
mf->ReadListFile(0, setMakeProgram.c_str());
@ -126,27 +127,39 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
//
// First figure out what OS we are running on:
//
// CMakeSystem.cmake // configured file created by CMakeDetermineSystem.cmake
// CMakeDetermineSystem.cmake // figure out os info and create CMakeSystem.cmake IFF CMAKE_SYSTEM_NAME not set
// CMakeSystem.cmake // configured file created by CMakeDetermineSystem.cmake IFF CMAKE_SYSTEM_LOADED
// TODO: CMakeDetermineSystem.cmake and CMakeSystem.cmake should be in the same if
// CMakeSystem.cmake - configured file created by CMakeDetermineSystem.cmake
// CMakeDetermineSystem.cmake - figure out os info and create
// CMakeSystem.cmake IFF CMAKE_SYSTEM_NAME
// not set
// CMakeSystem.cmake - configured file created by
// CMakeDetermineSystem.cmake IFF CMAKE_SYSTEM_LOADED
// Next try and enable all languages found in the languages vector
//
// FOREACH LANG in languages
// CMake(LANG)Compiler.cmake // configured file create by CMakeDetermine(LANG)Compiler.cmake
// CMakeDetermine(LANG)Compiler.cmake // Finds compiler for LANG and creates CMake(LANG)Compiler.cmake
// CMake(LANG)Compiler.cmake // configured file create by CMakeDetermine(LANG)Compiler.cmake
// CMake(LANG)Compiler.cmake - configured file create by
// CMakeDetermine(LANG)Compiler.cmake
// CMakeDetermine(LANG)Compiler.cmake - Finds compiler for LANG and
// creates CMake(LANG)Compiler.cmake
// CMake(LANG)Compiler.cmake - configured file created by
// CMakeDetermine(LANG)Compiler.cmake
//
// CMakeSystemSpecificInformation.cmake // inludes Platform/${CMAKE_SYSTEM_NAME}.cmake may use compiler stuff
// CMakeSystemSpecificInformation.cmake
// - includes Platform/${CMAKE_SYSTEM_NAME}.cmake
// may use compiler stuff
// FOREACH LANG in languages
// CMake(LANG)Information.cmake // loads Platform/${CMAKE_SYSTEM_NAME}-${COMPILER}.cmake
// CMakeTest(LANG)Compiler.cmake // Make sure the compiler works with a try compile if CMakeDetermine(LANG) was loaded
// CMake(LANG)Information.cmake
// - loads Platform/${CMAKE_SYSTEM_NAME}-${COMPILER}.cmake
// CMakeTest(LANG)Compiler.cmake
// - Make sure the compiler works with a try compile if
// CMakeDetermine(LANG) was loaded
//
// Now load a few files that can override values set in any of the above
// CMake(PROJECTNAME)Compatibility.cmake // load any backwards compatibility stuff for current project
// ${CMAKE_USER_MAKE_RULES_OVERRIDE} // allow users a chance to override system variables
// CMake(PROJECTNAME)Compatibility.cmake
// - load any backwards compatibility stuff for current project
// ${CMAKE_USER_MAKE_RULES_OVERRIDE}
// - allow users a chance to override system variables
//
//
@ -210,7 +223,8 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
cmOStringStream windowsVersionString;
windowsVersionString << osvi.dwMajorVersion << "." << osvi.dwMinorVersion;
windowsVersionString.str();
mf->AddDefinition("CMAKE_SYSTEM_VERSION", windowsVersionString.str().c_str());
mf->AddDefinition("CMAKE_SYSTEM_VERSION",
windowsVersionString.str().c_str());
#endif
// Read the DetermineSystem file
std::string systemFile = mf->GetModulesFile("CMakeDetermineSystem.cmake");
@ -258,11 +272,14 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
{
if(!mf->ReadListFile(0,fpath.c_str()))
{
cmSystemTools::Error("Could not find cmake module file:", fpath.c_str());
cmSystemTools::Error("Could not find cmake module file:",
fpath.c_str());
}
// if this file was found then the language was already determined to be working
// if this file was found then the language was already determined
// to be working
needTestLanguage[lang] = false;
this->SetLanguageEnabled(lang, mf); // this can only be called after loading CMake(LANG)Compiler.cmake
this->SetLanguageEnabled(lang, mf);
// this can only be called after loading CMake(LANG)Compiler.cmake
}
}
@ -271,9 +288,9 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
if (this->CMakeInstance->GetIsInTryCompile())
{
cmSystemTools::Error("This should not have happen. "
"If you see this message, you are probably using a "
"broken CMakeLists.txt file or a problematic release of "
"CMake");
"If you see this message, you are probably "
"using a broken CMakeLists.txt file or a "
"problematic release of CMake");
}
// if the CMake(LANG)Compiler.cmake file was not found then
// load CMakeDetermine(LANG)Compiler.cmake
@ -293,8 +310,9 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
// So the global generator can specify that in this variable
if(!mf->GetDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV"))
{
// put ${CMake_(LANG)_COMPILER_ENV_VAR}=${CMAKE_(LANG)_COMPILER into the
// environment, in case user scripts want to run configure, or sub cmakes
// put ${CMake_(LANG)_COMPILER_ENV_VAR}=${CMAKE_(LANG)_COMPILER
// into the environment, in case user scripts want to run
// configure, or sub cmakes
std::string compilerName = "CMAKE_";
compilerName += lang;
compilerName += "_COMPILER";
@ -302,7 +320,8 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
compilerEnv += lang;
compilerEnv += "_COMPILER_ENV_VAR";
std::string envVar = mf->GetRequiredDefinition(compilerEnv.c_str());
std::string envVarValue = mf->GetRequiredDefinition(compilerName.c_str());
std::string envVarValue =
mf->GetRequiredDefinition(compilerName.c_str());
std::string env = envVar;
env += "=";
env += envVarValue;
@ -319,11 +338,14 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
fpath += "Compiler.cmake";
if(!mf->ReadListFile(0,fpath.c_str()))
{
cmSystemTools::Error("Could not find cmake module file:", fpath.c_str());
cmSystemTools::Error("Could not find cmake module file:",
fpath.c_str());
}
this->SetLanguageEnabled(lang, mf); // this can only be called after loading CMake(LANG)Compiler.cmake
// the language must be enabled for try compile to work, but
// we do not know if it is a working compiler yet so set the test language flag
this->SetLanguageEnabled(lang, mf);
// this can only be called after loading CMake(LANG)Compiler.cmake
// the language must be enabled for try compile to work, but we do
// not know if it is a working compiler yet so set the test language
// flag
needTestLanguage[lang] = true;
}
} // end loop over languages
@ -334,7 +356,8 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
fpath = mf->GetModulesFile("CMakeSystemSpecificInformation.cmake");
if(!mf->ReadListFile(0,fpath.c_str()))
{
cmSystemTools::Error("Could not find cmake module file:", fpath.c_str());
cmSystemTools::Error("Could not find cmake module file:",
fpath.c_str());
}
}
// loop over languages again loading CMake(LANG)Information.cmake
@ -359,7 +382,8 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
fpath = mf->GetModulesFile(fpath.c_str());
if(!mf->ReadListFile(0,fpath.c_str()))
{
cmSystemTools::Error("Could not find cmake module file:", fpath.c_str());
cmSystemTools::Error("Could not find cmake module file:",
fpath.c_str());
}
}
// Test the compiler for the language just setup
@ -382,8 +406,9 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
std::string compilerWorks = "CMAKE_";
compilerWorks += lang;
compilerWorks += "_COMPILER_WORKS";
// if the compiler did not work, then remove the CMake(LANG)Compiler.cmake file
// so that it will get tested the next time cmake is run
// if the compiler did not work, then remove the
// CMake(LANG)Compiler.cmake file so that it will get tested the
// next time cmake is run
if(!mf->IsOn(compilerWorks.c_str()))
{
fpath = rootBin;
@ -405,12 +430,14 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
{
if(strcmp(lang, "C") == 0)
{
ifpath = mf->GetModulesFile("CMakeBackwardCompatibilityC.cmake");
ifpath =
mf->GetModulesFile("CMakeBackwardCompatibilityC.cmake");
mf->ReadListFile(0,ifpath.c_str());
}
if(strcmp(lang, "CXX") == 0)
{
ifpath = mf->GetModulesFile("CMakeBackwardCompatibilityCXX.cmake");
ifpath =
mf->GetModulesFile("CMakeBackwardCompatibilityCXX.cmake");
mf->ReadListFile(0,ifpath.c_str());
}
}
@ -419,9 +446,9 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
} // end need test language
} // end for each language
// Now load files that can override any settings on the platform or
// for the project
// First load the project compatibility file if it is in cmake
// Now load files that can override any settings on the platform or for
// the project First load the project compatibility file if it is in
// cmake
std::string projectCompatibility = mf->GetDefinition("CMAKE_ROOT");
projectCompatibility += "/Modules/";
projectCompatibility += mf->GetDefinition("PROJECT_NAME");
@ -432,7 +459,8 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
}
}
const char* cmGlobalGenerator::GetLanguageOutputExtensionForLanguage(const char* lang)
const char* cmGlobalGenerator
::GetLanguageOutputExtensionForLanguage(const char* lang)
{
if(!lang)
{
@ -445,7 +473,8 @@ const char* cmGlobalGenerator::GetLanguageOutputExtensionForLanguage(const char*
return "";
}
const char* cmGlobalGenerator::GetLanguageOutputExtensionFromExtension(const char* ext)
const char* cmGlobalGenerator
::GetLanguageOutputExtensionFromExtension(const char* ext)
{
if(!ext)
{
@ -468,9 +497,8 @@ const char* cmGlobalGenerator::GetLanguageOutputExtensionFromExtension(const cha
const char* cmGlobalGenerator::GetLanguageFromExtension(const char* ext)
{
// if there is an extension and it starts with . then
// move past the . because the extensions are not stored with a .
// in the map
// if there is an extension and it starts with . then move past the
// . because the extensions are not stored with a . in the map
if(ext && *ext == '.')
{
++ext;
@ -623,8 +651,8 @@ void cmGlobalGenerator::Configure()
notFoundMap.insert(varName);
}
}
this->CMakeInstance->UpdateProgress("Configuring",
0.9f+0.1f*(i+1.0f)/this->LocalGenerators.size());
this->CMakeInstance->UpdateProgress
("Configuring", 0.9f+0.1f*(i+1.0f)/this->LocalGenerators.size());
this->LocalGenerators[i]->GetMakefile()->CheckInfiniteLoops();
}
}
@ -671,7 +699,8 @@ void cmGlobalGenerator::Generate()
this->CreateDefaultGlobalTargets(&globalTargets);
for (i = 0; i < this->LocalGenerators.size(); ++i)
{
cmTargets* targets = &(this->LocalGenerators[i]->GetMakefile()->GetTargets());
cmTargets* targets =
&(this->LocalGenerators[i]->GetMakefile()->GetTargets());
cmTargets::iterator tarIt;
for ( tarIt = targets->begin(); tarIt != targets->end(); ++ tarIt )
{
@ -683,7 +712,8 @@ void cmGlobalGenerator::Generate()
}
for (i = 0; i < this->LocalGenerators.size(); ++i)
{
cmTargets* targets = &(this->LocalGenerators[i]->GetMakefile()->GetTargets());
cmTargets* targets =
&(this->LocalGenerators[i]->GetMakefile()->GetTargets());
cmTargets::iterator tit;
for ( tit = globalTargets.begin(); tit != globalTargets.end(); ++ tit )
{
@ -714,8 +744,8 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir,
const char *target,
std::string *output, cmMakefile *mf)
{
std::string makeCommand =
this->CMakeInstance->GetCacheManager()->GetCacheValue("CMAKE_MAKE_PROGRAM");
std::string makeCommand = this->CMakeInstance->
GetCacheManager()->GetCacheValue("CMAKE_MAKE_PROGRAM");
if(makeCommand.size() == 0)
{
cmSystemTools::Error(
@ -745,15 +775,17 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir,
output,makeCommand.c_str(),config,false);
}
std::string cmGlobalGenerator::GenerateBuildCommand(const char* makeProgram,
const char *projectName, const char* additionalOptions, const char *targetName,
const char* config, bool ignoreErrors)
std::string cmGlobalGenerator
::GenerateBuildCommand(const char* makeProgram, const char *projectName,
const char* additionalOptions, const char *targetName,
const char* config, bool ignoreErrors)
{
// Project name and config are not used yet.
(void)projectName;
(void)config;
std::string makeCommand = cmSystemTools::ConvertToUnixOutputPath(makeProgram);
std::string makeCommand =
cmSystemTools::ConvertToUnixOutputPath(makeProgram);
// Since we have full control over the invocation of nmake, let us
// make it quiet.
@ -802,7 +834,8 @@ int cmGlobalGenerator::Build(
// should we do a clean first?
if (clean)
{
std::string cleanCommand = this->GenerateBuildCommand(makeCommandCSTR, projectName,
std::string cleanCommand =
this->GenerateBuildCommand(makeCommandCSTR, projectName,
0, "clean", config, false);
if (!cmSystemTools::RunSingleCommand(cleanCommand.c_str(), output,
&retVal, 0, false, timeout))
@ -821,19 +854,21 @@ int cmGlobalGenerator::Build(
}
// now build
std::string makeCommand = this->GenerateBuildCommand(makeCommandCSTR, projectName,
0, target, config, false);
std::string makeCommand =
this->GenerateBuildCommand(makeCommandCSTR, projectName,
0, target, config, false);
if (!cmSystemTools::RunSingleCommand(makeCommand.c_str(), output,
&retVal, 0, false, timeout))
{
cmSystemTools::SetRunCommandHideConsole(hideconsole);
cmSystemTools::Error("Generator: execution of make failed. Make command was: ",
makeCommand.c_str());
cmSystemTools::Error
("Generator: execution of make failed. Make command was: ",
makeCommand.c_str());
if (output)
{
*output += "\nGenerator: execution of make failed. Make command was: " +
makeCommand + "\n";
*output += "\nGenerator: execution of make failed. Make command was: "
+ makeCommand + "\n";
}
// return to the original directory
@ -939,8 +974,8 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
void cmGlobalGenerator::GetEnabledLanguages(std::vector<std::string>& lang)
{
for(std::map<cmStdString, bool>::iterator i = this->LanguageEnabled.begin();
i != this->LanguageEnabled.end(); ++i)
for(std::map<cmStdString, bool>::iterator i =
this->LanguageEnabled.begin(); i != this->LanguageEnabled.end(); ++i)
{
lang.push_back(i->first);
}
@ -1014,7 +1049,8 @@ cmTarget* cmGlobalGenerator::FindTarget(const char* project,
// if all projects/directories
else
{
std::map<cmStdString,cmTarget *>::iterator i = this->TotalTargets.find(name);
std::map<cmStdString,cmTarget *>::iterator i =
this->TotalTargets.find(name);
if (i == this->TotalTargets.end())
{
return 0;
@ -1045,9 +1081,9 @@ void cmGlobalGenerator::ConfigureRelativePaths()
}
//----------------------------------------------------------------------------
std::string
cmGlobalGenerator::ConvertToRelativePath(const std::vector<std::string>& local,
const char* in_remote)
std::string cmGlobalGenerator
::ConvertToRelativePath(const std::vector<std::string>& local,
const char* in_remote)
{
// The path should never be quoted.
assert(in_remote[0] != '\"');
@ -1185,8 +1221,8 @@ inline std::string removeQuotes(const std::string& s)
void cmGlobalGenerator::SetupTests()
{
std::string ctest =
this->LocalGenerators[0]->GetMakefile()->GetRequiredDefinition("CMAKE_COMMAND");
std::string ctest = this->LocalGenerators[0]->GetMakefile()->
GetRequiredDefinition("CMAKE_COMMAND");
ctest = removeQuotes(ctest);
ctest = cmSystemTools::GetFilenamePath(ctest.c_str());
ctest += "/";
@ -1194,8 +1230,8 @@ void cmGlobalGenerator::SetupTests()
ctest += cmSystemTools::GetExecutableExtension();
if(!cmSystemTools::FileExists(ctest.c_str()))
{
ctest =
this->LocalGenerators[0]->GetMakefile()->GetRequiredDefinition("CMAKE_COMMAND");
ctest = this->LocalGenerators[0]->GetMakefile()->
GetRequiredDefinition("CMAKE_COMMAND");
ctest = cmSystemTools::GetFilenamePath(ctest.c_str());
ctest += "/Debug/";
ctest += "ctest";
@ -1203,8 +1239,8 @@ void cmGlobalGenerator::SetupTests()
}
if(!cmSystemTools::FileExists(ctest.c_str()))
{
ctest =
this->LocalGenerators[0]->GetMakefile()->GetRequiredDefinition("CMAKE_COMMAND");
ctest = this->LocalGenerators[0]->GetMakefile()->
GetRequiredDefinition("CMAKE_COMMAND");
ctest = cmSystemTools::GetFilenamePath(ctest.c_str());
ctest += "/Release/";
ctest += "ctest";
@ -1231,7 +1267,8 @@ void cmGlobalGenerator::SetupTests()
size_t i;
for (i = 0; i < this->LocalGenerators.size(); ++i)
{
total_tests += this->LocalGenerators[i]->GetMakefile()->GetTests()->size();
total_tests +=
this->LocalGenerators[i]->GetMakefile()->GetTests()->size();
}
// If the file doesn't exist, then ENABLE_TESTING hasn't been run
@ -1299,7 +1336,8 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
const char* packageSourceTargetName = this->GetPackageSourceTargetName();
if ( packageSourceTargetName )
{
cpackCommandLines.erase(cpackCommandLines.begin(), cpackCommandLines.end());
cpackCommandLines.erase(cpackCommandLines.begin(),
cpackCommandLines.end());
singleLine.erase(singleLine.begin(), singleLine.end());
depends.erase(depends.begin(), depends.end());
singleLine.push_back(this->GetCMakeInstance()->GetCPackCommand());
@ -1320,7 +1358,8 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
// Test
if(mf->IsOn("CMAKE_TESTING_ENABLED"))
{
cpackCommandLines.erase(cpackCommandLines.begin(), cpackCommandLines.end());
cpackCommandLines.erase(cpackCommandLines.begin(),
cpackCommandLines.end());
singleLine.erase(singleLine.begin(), singleLine.end());
depends.erase(depends.begin(), depends.end());
singleLine.push_back(this->GetCMakeInstance()->GetCTestCommand());
@ -1335,7 +1374,8 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
const char* editCacheTargetName = this->GetEditCacheTargetName();
if ( editCacheTargetName )
{
cpackCommandLines.erase(cpackCommandLines.begin(), cpackCommandLines.end());
cpackCommandLines.erase(cpackCommandLines.begin(),
cpackCommandLines.end());
singleLine.erase(singleLine.begin(), singleLine.end());
depends.erase(depends.begin(), depends.end());
@ -1360,7 +1400,8 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
cpackCommandLines.push_back(singleLine);
(*targets)[editCacheTargetName] =
this->CreateGlobalTarget(
editCacheTargetName, "Running interactive CMake command-line interface...",
editCacheTargetName,
"Running interactive CMake command-line interface...",
&cpackCommandLines, depends);
}
}

View File

@ -175,7 +175,8 @@ public:
configuration. This is valid during generation only. */
cmTargetManifest const& GetTargetManifest() { return this->TargetManifest; }
void AddTarget(cmTargets::value_type &v) { this->TotalTargets[v.first] = &v.second;};
void AddTarget(cmTargets::value_type &v) {
this->TotalTargets[v.first] = &v.second;};
/** Support for multiple custom command outputs. */
virtual void CheckMultipleOutputs(cmMakefile* mf, bool verbose);

View File

@ -7,7 +7,7 @@
Version: $Revision$
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
Copyright (c) 2004 Alexander Neundorf, neundorf@kde.org. All rights reserved.
Copyright (c) 2004 Alexander Neundorf neundorf@kde.org, 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
@ -40,16 +40,19 @@ cmLocalGenerator *cmGlobalKdevelopGenerator::CreateLocalGenerator()
}
//----------------------------------------------------------------------------
void cmGlobalKdevelopGenerator::GetDocumentation(cmDocumentationEntry& entry) const
void cmGlobalKdevelopGenerator
::GetDocumentation(cmDocumentationEntry& entry) const
{
entry.name = this->GetName();
entry.brief = "Generates KDevelop 3 project files.";
entry.full =
"Project files for KDevelop 3 will be created in the top directory and in every subdirectory "
"which features a CMakeLists.txt file containing a PROJECT() call. "
"Project files for KDevelop 3 will be created in the top directory "
"and in every subdirectory which features a CMakeLists.txt file "
"containing a PROJECT() call. "
"If you change the settings using KDevelop cmake will try its best "
"to keep your changes when regenerating the project files. "
"Additionally a hierarchy of UNIX makefiles is generated into the build tree. Any "
"Additionally a hierarchy of UNIX makefiles is generated into the "
"build tree. Any "
"standard UNIX-style make program can build the project through the "
"default make target. A \"make install\" target is also provided.";
}
@ -211,9 +214,10 @@ bool cmGlobalKdevelopGenerator
if (fileToOpen.empty())
{
std::string ext = cmSystemTools::GetFilenameExtension(tmp);
if ((ext==".c") || (ext==".cc") || (ext==".cpp") || (ext==".C") || (ext==".h"))
if ((ext==".c") || (ext==".cc") || (ext==".cpp")
|| (ext==".C") || (ext==".h"))
{
fileToOpen=tmp;
fileToOpen=tmp;
}
}
// make it relative to the project dir
@ -230,13 +234,13 @@ bool cmGlobalKdevelopGenerator
/* create the project file, if it already exists, merge it with the
existing one, otherwise create a new one */
void
cmGlobalKdevelopGenerator::CreateProjectFile(const std::string& outputDir,
const std::string& projectDir,
const std::string& projectname,
const std::string& executable,
const std::string& cmakeFilePattern,
const std::string& fileToOpen)
void cmGlobalKdevelopGenerator
::CreateProjectFile(const std::string& outputDir,
const std::string& projectDir,
const std::string& projectname,
const std::string& executable,
const std::string& cmakeFilePattern,
const std::string& fileToOpen)
{
std::string filename=outputDir+"/";
filename+=projectname+".kdevelop";
@ -246,30 +250,33 @@ cmGlobalKdevelopGenerator::CreateProjectFile(const std::string& outputDir,
if (cmSystemTools::FileExists(filename.c_str()))
{
this->MergeProjectFiles(outputDir, projectDir, filename,
executable, cmakeFilePattern, fileToOpen, sessionFilename);
executable, cmakeFilePattern,
fileToOpen, sessionFilename);
}
else
{
this->CreateNewProjectFile(outputDir, projectDir, filename,
executable, cmakeFilePattern, fileToOpen, sessionFilename);
executable, cmakeFilePattern,
fileToOpen, sessionFilename);
}
}
void
cmGlobalKdevelopGenerator::MergeProjectFiles(const std::string& outputDir,
const std::string& projectDir,
const std::string& filename,
const std::string& executable,
const std::string& cmakeFilePattern,
const std::string& fileToOpen,
const std::string& sessionFilename)
void cmGlobalKdevelopGenerator
::MergeProjectFiles(const std::string& outputDir,
const std::string& projectDir,
const std::string& filename,
const std::string& executable,
const std::string& cmakeFilePattern,
const std::string& fileToOpen,
const std::string& sessionFilename)
{
std::ifstream oldProjectFile(filename.c_str());
if (!oldProjectFile)
{
this->CreateNewProjectFile(outputDir, projectDir, filename, executable, cmakeFilePattern, fileToOpen, sessionFilename);
this->CreateNewProjectFile(outputDir, projectDir, filename,
executable, cmakeFilePattern,
fileToOpen, sessionFilename);
return;
}
@ -307,12 +314,15 @@ cmGlobalKdevelopGenerator::MergeProjectFiles(const std::string& outputDir,
// output the line from the file if it is not one of the above tags
fout<<*it<<"\n";
// if this is the <general> tag output the stuff that goes in the general tag
// if this is the <general> tag output the stuff that goes in the
// general tag
if (strstr(line, "<general>"))
{
fout<<" <projectmanagement>KDevCustomProject</projectmanagement>\n";
fout<<" <projectdirectory>"<<projectDir.c_str()<<"</projectdirectory>\n"; //this one is important
fout<<" <absoluteprojectpath>true</absoluteprojectpath>\n"; //and this one
fout<< " <projectmanagement>KDevCustomProject</projectmanagement>\n";
fout<< " <projectdirectory>" <<projectDir.c_str()
<< "</projectdirectory>\n"; //this one is important
fout<<" <absoluteprojectpath>true</absoluteprojectpath>\n";
//and this one
}
// inside kdevcustomproject the <filelistdirectory> must be put
if (strstr(line, "<kdevcustomproject>"))
@ -329,14 +339,14 @@ cmGlobalKdevelopGenerator::MergeProjectFiles(const std::string& outputDir,
}
}
void
cmGlobalKdevelopGenerator::CreateNewProjectFile(const std::string& outputDir,
const std::string& projectDir,
const std::string& filename,
const std::string& executable,
const std::string& cmakeFilePattern,
const std::string& fileToOpen,
const std::string& sessionFilename)
void cmGlobalKdevelopGenerator
::CreateNewProjectFile(const std::string& outputDir,
const std::string& projectDir,
const std::string& filename,
const std::string& executable,
const std::string& cmakeFilePattern,
const std::string& fileToOpen,
const std::string& sessionFilename)
{
cmGeneratedFileStream fout(filename.c_str());
if(!fout)
@ -353,14 +363,16 @@ cmGlobalKdevelopGenerator::CreateNewProjectFile(const std::string& outputDir,
fout<<" <projectmanagement>KDevCustomProject</projectmanagement>\n";
fout<<" <primarylanguage>C++</primarylanguage>\n";
fout<<" <ignoreparts/>\n";
fout<<" <projectdirectory>"<<projectDir.c_str()<<"</projectdirectory>\n"; //this one is important
fout<<" <absoluteprojectpath>true</absoluteprojectpath>\n"; //and this one
fout<<" <projectdirectory>"<<projectDir.c_str()
<<"</projectdirectory>\n"; //this one is important
fout<<" <absoluteprojectpath>true</absoluteprojectpath>\n"; //and this one
fout<<" <secondaryLanguages>\n";
fout<<" <language>C</language>\n";
fout<<" </secondaryLanguages>\n";
fout<<" </general>\n";
fout<<" <kdevcustomproject>\n";
fout<<" <filelistdirectory>"<<outputDir.c_str()<<"</filelistdirectory>\n";
fout<<" <filelistdirectory>"<<outputDir.c_str()
<<"</filelistdirectory>\n";
fout<<" <run>\n";
fout<<" <mainprogram>"<<executable.c_str()<<"</mainprogram>\n";
fout<<" <directoryradio>custom</directoryradio>\n";
@ -371,8 +383,8 @@ cmGlobalKdevelopGenerator::CreateNewProjectFile(const std::string& outputDir,
fout<<" <envvars/>\n";
fout<<" </run>\n";
fout<<" <build>\n";
fout<<" <buildtool>make</buildtool>\n"; //this one is important
fout<<" <builddir>"<<outputDir.c_str()<<"</builddir>\n"; //and this one
fout<<" <buildtool>make</buildtool>\n"; //this one is important
fout<<" <builddir>"<<outputDir.c_str()<<"</builddir>\n"; //and this one
fout<<" </build>\n";
fout<<" <make>\n";
fout<<" <abortonerror>false</abortonerror>\n";
@ -427,7 +439,8 @@ cmGlobalKdevelopGenerator::CreateNewProjectFile(const std::string& outputDir,
fout<<" </kdevcppsupport>\n";
fout<<" <kdevfileview>\n";
fout<<" <groups>\n";
fout<<" <group pattern=\""<<cmakeFilePattern.c_str()<<"\" name=\"CMake\" />\n";
fout<<" <group pattern=\""<<cmakeFilePattern.c_str()
<<"\" name=\"CMake\" />\n";
fout<<" <group pattern=\"*.h;*.hxx\" name=\"Header\" />\n";
fout<<" <group pattern=\"*.cpp;*.c;*.C;*.cxx\" name=\"Sources\" />\n";
fout<<" <group pattern=\"*.ui\" name=\"Qt Designer files\" />\n";
@ -443,7 +456,8 @@ cmGlobalKdevelopGenerator::CreateNewProjectFile(const std::string& outputDir,
if (sessionFilename.empty())
return;
// and a session file, so that kdevelop opens a file if it opens the project the first time
// and a session file, so that kdevelop opens a file if it opens the
// project the first time
cmGeneratedFileStream devses(sessionFilename.c_str());
if(!devses)
{
@ -453,7 +467,8 @@ cmGlobalKdevelopGenerator::CreateNewProjectFile(const std::string& outputDir,
devses<<"<!DOCTYPE KDevPrjSession>\n";
devses<<"<KDevPrjSession>\n";
devses<<" <DocsAndViews NumberOfDocuments=\"1\" >\n";
devses<<" <Doc0 NumberOfViews=\"1\" URL=\"file://"<<fileToOpen.c_str()<<"\" >\n";
devses<<" <Doc0 NumberOfViews=\"1\" URL=\"file://"
<<fileToOpen.c_str()<<"\" >\n";
devses<<" <View0 line=\"0\" Type=\"Source\" />\n";
devses<<" </Doc0>\n";
devses<<" </DocsAndViews>\n";

View File

@ -48,8 +48,8 @@ cmGlobalMSYSMakefileGenerator::FindMinGW(std::string const& makeloc)
return mingwBin;
}
void cmGlobalMSYSMakefileGenerator::EnableLanguage(std::vector<std::string>const& l,
cmMakefile *mf)
void cmGlobalMSYSMakefileGenerator
::EnableLanguage(std::vector<std::string>const& l, cmMakefile *mf)
{
this->FindMakeProgram(mf);
std::string makeProgram = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
@ -76,8 +76,9 @@ void cmGlobalMSYSMakefileGenerator::EnableLanguage(std::vector<std::string>const
this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf);
if(!mf->IsSet("CMAKE_AR") && !this->CMakeInstance->GetIsInTryCompile())
{
cmSystemTools::Error("CMAKE_AR was not found, please set to archive program. ",
mf->GetDefinition("CMAKE_AR"));
cmSystemTools::Error
("CMAKE_AR was not found, please set to archive program. ",
mf->GetDefinition("CMAKE_AR"));
}
}
@ -94,9 +95,11 @@ cmLocalGenerator *cmGlobalMSYSMakefileGenerator::CreateLocalGenerator()
}
//----------------------------------------------------------------------------
void cmGlobalMSYSMakefileGenerator::GetDocumentation(cmDocumentationEntry& entry) const
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.";
entry.full = "The makefiles use /bin/sh as the shell. "
"They require msys to be installed on the machine.";
}

View File

@ -25,8 +25,8 @@ cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator()
this->ToolSupportsColor = true;
}
void cmGlobalMinGWMakefileGenerator::EnableLanguage(std::vector<std::string>const& l,
cmMakefile *mf)
void cmGlobalMinGWMakefileGenerator
::EnableLanguage(std::vector<std::string>const& l, cmMakefile *mf)
{
this->FindMakeProgram(mf);
std::string makeProgram = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
@ -64,7 +64,8 @@ cmLocalGenerator *cmGlobalMinGWMakefileGenerator::CreateLocalGenerator()
}
//----------------------------------------------------------------------------
void cmGlobalMinGWMakefileGenerator::GetDocumentation(cmDocumentationEntry& entry) const
void cmGlobalMinGWMakefileGenerator
::GetDocumentation(cmDocumentationEntry& entry) const
{
entry.name = this->GetName();
entry.brief = "Generates a make file for use with mingw32-make.";

View File

@ -28,7 +28,8 @@ class cmGlobalMinGWMakefileGenerator : public cmGlobalUnixMakefileGenerator3
{
public:
cmGlobalMinGWMakefileGenerator();
static cmGlobalGenerator* New() { return new cmGlobalMinGWMakefileGenerator; }
static cmGlobalGenerator* New() {
return new cmGlobalMinGWMakefileGenerator; }
///! Get the name for the generator.
virtual const char* GetName() const {
return cmGlobalMinGWMakefileGenerator::GetActualName();}

View File

@ -25,8 +25,8 @@ cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator()
this->ToolSupportsColor = true;
}
void cmGlobalNMakeMakefileGenerator::EnableLanguage(std::vector<std::string>const& l,
cmMakefile *mf)
void cmGlobalNMakeMakefileGenerator
::EnableLanguage(std::vector<std::string>const& l, cmMakefile *mf)
{
// pick a default
mf->AddDefinition("CMAKE_GENERATOR_CC", "cl");
@ -50,7 +50,8 @@ cmLocalGenerator *cmGlobalNMakeMakefileGenerator::CreateLocalGenerator()
}
//----------------------------------------------------------------------------
void cmGlobalNMakeMakefileGenerator::GetDocumentation(cmDocumentationEntry& entry) const
void cmGlobalNMakeMakefileGenerator
::GetDocumentation(cmDocumentationEntry& entry) const
{
entry.name = this->GetName();
entry.brief = "Generates NMake makefiles.";

View File

@ -28,7 +28,8 @@ class cmGlobalNMakeMakefileGenerator : public cmGlobalUnixMakefileGenerator3
{
public:
cmGlobalNMakeMakefileGenerator();
static cmGlobalGenerator* New() { return new cmGlobalNMakeMakefileGenerator; }
static cmGlobalGenerator* New() {
return new cmGlobalNMakeMakefileGenerator; }
///! Get the name for the generator.
virtual const char* GetName() const {
return cmGlobalNMakeMakefileGenerator::GetActualName();}

View File

@ -48,7 +48,8 @@ void cmGlobalUnixMakefileGenerator3
if(!mf->GetDefinition(langComp.c_str()))
{
cmSystemTools::Error(langComp.c_str(), " not set, after EnableLanguage");
cmSystemTools::Error(langComp.c_str(),
" not set, after EnableLanguage");
continue;
}
const char* name = mf->GetRequiredDefinition(langComp.c_str());
@ -88,7 +89,8 @@ cmLocalGenerator *cmGlobalUnixMakefileGenerator3::CreateLocalGenerator()
}
//----------------------------------------------------------------------------
void cmGlobalUnixMakefileGenerator3::GetDocumentation(cmDocumentationEntry& entry) const
void cmGlobalUnixMakefileGenerator3
::GetDocumentation(cmDocumentationEntry& entry) const
{
entry.name = this->GetName();
entry.brief = "Generates standard UNIX makefiles.";
@ -182,7 +184,8 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2()
unsigned int i;
for (i = 0; i < this->LocalGenerators.size(); ++i)
{
lg = static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
lg =
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
// are any parents excluded
bool exclude = false;
cmLocalGenerator *lg3 = lg;
@ -238,7 +241,8 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
std::vector<std::string> lfiles;
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
{
lg = static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
lg =
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
// Get the list of files contributing to this generation step.
lfiles.insert(lfiles.end(),lg->GetMakefile()->GetListFiles().begin(),
@ -261,14 +265,15 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
cmakefileStream
<< "# The top level Makefile was generated from the following files:\n"
<< "SET(CMAKE_MAKEFILE_DEPENDS\n"
<< " \"" << lg->Convert(cache.c_str(),
cmLocalGenerator::START_OUTPUT).c_str() << "\"\n";
<< " \""
<< lg->Convert(cache.c_str(),
cmLocalGenerator::START_OUTPUT).c_str() << "\"\n";
for(std::vector<std::string>::const_iterator i = lfiles.begin();
i != lfiles.end(); ++i)
{
cmakefileStream
<< " \"" << lg->Convert(i->c_str(),
cmLocalGenerator::START_OUTPUT).c_str()
<< " \""
<< lg->Convert(i->c_str(), cmLocalGenerator::START_OUTPUT).c_str()
<< "\"\n";
}
cmakefileStream
@ -282,31 +287,38 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
cmakefileStream
<< "# The corresponding makefile is:\n"
<< "SET(CMAKE_MAKEFILE_OUTPUTS\n"
<< " \"" << lg->Convert(makefileName.c_str(),
cmLocalGenerator::START_OUTPUT).c_str() << "\"\n"
<< " \"" << lg->Convert(check.c_str(),
cmLocalGenerator::START_OUTPUT).c_str() << "\"\n";
<< " \""
<< lg->Convert(makefileName.c_str(),
cmLocalGenerator::START_OUTPUT).c_str() << "\"\n"
<< " \""
<< lg->Convert(check.c_str(),
cmLocalGenerator::START_OUTPUT).c_str() << "\"\n";
// add in all the directory information files
std::string tmpStr;
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
{
lg = static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
lg =
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
tmpStr = lg->GetMakefile()->GetStartOutputDirectory();
tmpStr += "/CMakeFiles/CMakeDirectoryInformation.cmake";
cmakefileStream << " \"" <<
lg->Convert(tmpStr.c_str(),cmLocalGenerator::HOME_OUTPUT).c_str() << "\"\n";
const std::vector<std::string>& outfiles = lg->GetMakefile()->GetOutputFiles();
lg->Convert(tmpStr.c_str(),cmLocalGenerator::HOME_OUTPUT).c_str()
<< "\"\n";
const std::vector<std::string>& outfiles =
lg->GetMakefile()->GetOutputFiles();
for(std::vector<std::string>::const_iterator k= outfiles.begin();
k != outfiles.end(); ++k)
{
cmakefileStream << " \"" <<
lg->Convert(k->c_str(),cmLocalGenerator::HOME_OUTPUT).c_str() << "\"\n";
lg->Convert(k->c_str(),cmLocalGenerator::HOME_OUTPUT).c_str()
<< "\"\n";
}
}
cmakefileStream << " )\n\n";
this->WriteMainCMakefileLanguageRules(cmakefileStream, this->LocalGenerators);
this->WriteMainCMakefileLanguageRules(cmakefileStream,
this->LocalGenerators);
if(!this->MultipleOutputPairs.empty())
{
@ -367,7 +379,8 @@ void cmGlobalUnixMakefileGenerator3::CheckMultipleOutputs(cmMakefile* mf,
void cmGlobalUnixMakefileGenerator3
::WriteMainCMakefileLanguageRules(cmGeneratedFileStream& cmakefileStream,
std::vector<cmLocalGenerator *> &lGenerators)
std::vector<cmLocalGenerator *> &lGenerators
)
{
cmLocalUnixMakefileGenerator3 *lg;
@ -440,8 +453,8 @@ cmGlobalUnixMakefileGenerator3
// The directory-level rule should depend on the directory-level
// rules of the subdirectories.
for(std::vector<cmLocalGenerator*>::iterator sdi = lg->GetChildren().begin();
sdi != lg->GetChildren().end(); ++sdi)
for(std::vector<cmLocalGenerator*>::iterator sdi =
lg->GetChildren().begin(); sdi != lg->GetChildren().end(); ++sdi)
{
cmLocalUnixMakefileGenerator3* slg =
static_cast<cmLocalUnixMakefileGenerator3*>(*sdi);
@ -502,16 +515,18 @@ cmGlobalUnixMakefileGenerator3
}
std::string cmGlobalUnixMakefileGenerator3::GenerateBuildCommand(const char* makeProgram,
const char *projectName, const char* additionalOptions, const char *targetName,
const char* config, bool ignoreErrors)
std::string cmGlobalUnixMakefileGenerator3
::GenerateBuildCommand(const char* makeProgram, const char *projectName,
const char* additionalOptions, const char *targetName,
const char* config, bool ignoreErrors)
{
// Project name and config are not used yet.
(void)projectName;
(void)config;
std::string makeCommand = cmSystemTools::ConvertToUnixOutputPath(makeProgram);
std::string makeCommand =
cmSystemTools::ConvertToUnixOutputPath(makeProgram);
// Since we have full control over the invocation of nmake, let us
// make it quiet.
if ( strcmp(this->GetName(), "NMake Makefiles") == 0 )
@ -532,11 +547,13 @@ std::string cmGlobalUnixMakefileGenerator3::GenerateBuildCommand(const char* mak
cmLocalUnixMakefileGenerator3 *lg;
if (this->LocalGenerators.size())
{
lg = static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[0]);
lg = static_cast<cmLocalUnixMakefileGenerator3 *>
(this->LocalGenerators[0]);
}
else
{
lg = static_cast<cmLocalUnixMakefileGenerator3 *>(this->CreateLocalGenerator());
lg = static_cast<cmLocalUnixMakefileGenerator3 *>
(this->CreateLocalGenerator());
// set the Start directories
lg->GetMakefile()->SetStartDirectory
(this->CMakeInstance->GetStartDirectory());
@ -578,7 +595,8 @@ cmGlobalUnixMakefileGenerator3
cmLocalUnixMakefileGenerator3 *lg;
for (i = 0; i < this->LocalGenerators.size(); ++i)
{
lg = static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
lg = static_cast<cmLocalUnixMakefileGenerator3 *>
(this->LocalGenerators[i]);
// for each target Generate the rule files for each target.
cmTargets& targets = lg->GetMakefile()->GetTargets();
for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
@ -756,7 +774,8 @@ cmGlobalUnixMakefileGenerator3
commands.push_back(lg->GetRecursiveMakeCall
(makefileName.c_str(), localName.c_str()));
this->AppendGlobalTargetDepends(depends,t->second);
lg->WriteMakeRule(ruleFileStream, "Pre-install relink rule for target.",
lg->WriteMakeRule(ruleFileStream,
"Pre-install relink rule for target.",
localName.c_str(), depends, commands, true);
depends.clear();
depends.push_back(localName);
@ -894,8 +913,8 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule
std::string path;
std::vector<std::string> no_depends;
std::vector<std::string> commands;
lg->AppendEcho(commands,
"The following are some of the valid targets for this Makefile:");
lg->AppendEcho(commands,"The following are some of the valid targets "
"for this Makefile:");
lg->AppendEcho(commands,"... all (the default if no target is provided)");
lg->AppendEcho(commands,"... clean");
lg->AppendEcho(commands,"... depend");
@ -908,7 +927,8 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule
cmLocalUnixMakefileGenerator3 *lg2;
for (i = 0; i < this->LocalGenerators.size(); ++i)
{
lg2 = static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
lg2 =
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
// for the passed in makefile or if this is the top Makefile wripte out
// the targets
if (lg2 == lg || !lg->GetParent())

View File

@ -58,7 +58,8 @@ class cmGlobalUnixMakefileGenerator3 : public cmGlobalGenerator
{
public:
cmGlobalUnixMakefileGenerator3();
static cmGlobalGenerator* New() { return new cmGlobalUnixMakefileGenerator3; }
static cmGlobalGenerator* New() {
return new cmGlobalUnixMakefileGenerator3; }
///! Get the name for the generator.
virtual const char* GetName() const {