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."); "directory as well.");
return false; return false;
} }
cmSystemTools::ReplaceString(binPath,this->Makefile->GetHomeDirectory(), cmSystemTools::ReplaceString(binPath,
this->Makefile->GetHomeDirectory(),
this->Makefile->GetHomeOutputDirectory()); this->Makefile->GetHomeOutputDirectory());
} }
} }

View File

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

View File

@ -175,7 +175,8 @@ public:
configuration. This is valid during generation only. */ configuration. This is valid during generation only. */
cmTargetManifest const& GetTargetManifest() { return this->TargetManifest; } 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. */ /** Support for multiple custom command outputs. */
virtual void CheckMultipleOutputs(cmMakefile* mf, bool verbose); virtual void CheckMultipleOutputs(cmMakefile* mf, bool verbose);

View File

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

View File

@ -48,8 +48,8 @@ cmGlobalMSYSMakefileGenerator::FindMinGW(std::string const& makeloc)
return mingwBin; return mingwBin;
} }
void cmGlobalMSYSMakefileGenerator::EnableLanguage(std::vector<std::string>const& l, void cmGlobalMSYSMakefileGenerator
cmMakefile *mf) ::EnableLanguage(std::vector<std::string>const& l, cmMakefile *mf)
{ {
this->FindMakeProgram(mf); this->FindMakeProgram(mf);
std::string makeProgram = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); 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); this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf);
if(!mf->IsSet("CMAKE_AR") && !this->CMakeInstance->GetIsInTryCompile()) if(!mf->IsSet("CMAKE_AR") && !this->CMakeInstance->GetIsInTryCompile())
{ {
cmSystemTools::Error("CMAKE_AR was not found, please set to archive program. ", cmSystemTools::Error
mf->GetDefinition("CMAKE_AR")); ("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.name = this->GetName();
entry.brief = "Generates MSYS makefiles."; 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; this->ToolSupportsColor = true;
} }
void cmGlobalMinGWMakefileGenerator::EnableLanguage(std::vector<std::string>const& l, void cmGlobalMinGWMakefileGenerator
cmMakefile *mf) ::EnableLanguage(std::vector<std::string>const& l, cmMakefile *mf)
{ {
this->FindMakeProgram(mf); this->FindMakeProgram(mf);
std::string makeProgram = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); 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.name = this->GetName();
entry.brief = "Generates a make file for use with mingw32-make."; entry.brief = "Generates a make file for use with mingw32-make.";

View File

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

View File

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

View File

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

View File

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

View File

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