diff options
Diffstat (limited to 'Source')
92 files changed, 971 insertions, 755 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index bb3c25c..060aedd 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150515) +set(CMake_VERSION_PATCH 20150519) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index 0439ff6..80ba068 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -29,6 +29,8 @@ #include <cmMakefile.h> #include <cmGeneratedFileStream.h> #include <cmXMLSafe.h> +#include <cmVersionConfig.h> +#include <cmTimestamp.h> //---------------------------------------------------------------------------- cmCPackIFWGenerator::cmCPackIFWGenerator() @@ -41,6 +43,27 @@ cmCPackIFWGenerator::~cmCPackIFWGenerator() } //---------------------------------------------------------------------------- +bool cmCPackIFWGenerator::IsVersionLess(const char *version) +{ + return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, + FrameworkVersion.data(), version); +} + +//---------------------------------------------------------------------------- +bool cmCPackIFWGenerator::IsVersionGreater(const char *version) +{ + return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER, + FrameworkVersion.data(), version); +} + +//---------------------------------------------------------------------------- +bool cmCPackIFWGenerator::IsVersionEqual(const char *version) +{ + return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, + FrameworkVersion.data(), version); +} + +//---------------------------------------------------------------------------- int cmCPackIFWGenerator::PackageFiles() { cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Configuration" << std::endl); @@ -59,7 +82,12 @@ int cmCPackIFWGenerator::PackageFiles() if (!Installer.Repositories.empty()) { std::string ifwCmd = RepoGen; - ifwCmd += " -c " + this->toplevel + "/config/config.xml"; + + if(IsVersionLess("2.0.0")) + { + ifwCmd += " -c " + this->toplevel + "/config/config.xml"; + } + ifwCmd += " -p " + this->toplevel + "/packages"; if(!PkgsDirsVector.empty()) @@ -216,8 +244,7 @@ const char *cmCPackIFWGenerator::GetPackagingInstallPrefix() //---------------------------------------------------------------------------- const char *cmCPackIFWGenerator::GetOutputExtension() { - const char *suffix = this->GetOption("CMAKE_EXECUTABLE_SUFFIX"); - return suffix ? suffix : cmCPackGenerator::GetOutputExtension(); + return ExecutableSuffix.c_str(); } //---------------------------------------------------------------------------- @@ -267,6 +294,17 @@ int cmCPackIFWGenerator::InitializeInternal() RepoGen = RepoGenStr; } + // Framework version + if(const char* FrameworkVersionSrt = + this->GetOption("CPACK_IFW_FRAMEWORK_VERSION")) + { + FrameworkVersion = FrameworkVersionSrt; + } + else + { + FrameworkVersion = "1.9.9"; + } + // Variables that Change Behavior // Resolve duplicate names @@ -307,6 +345,24 @@ int cmCPackIFWGenerator::InitializeInternal() return 0; } + // Executable suffix + if(const char *optExeSuffix = this->GetOption("CMAKE_EXECUTABLE_SUFFIX")) + { + ExecutableSuffix = optExeSuffix; + if(ExecutableSuffix.empty()) + { + std::string sysName(this->GetOption("CMAKE_SYSTEM_NAME")); + if(sysName == "Linux") + { + ExecutableSuffix = ".run"; + } + } + } + else + { + ExecutableSuffix = cmCPackGenerator::GetOutputExtension(); + } + return this->Superclass::InitializeInternal(); } @@ -552,3 +608,20 @@ cmCPackIFWPackage* cmCPackIFWGenerator::GetComponentPackage( = ComponentPackages.find(component); return pit != ComponentPackages.end() ? pit->second : 0; } + +//---------------------------------------------------------------------------- +void cmCPackIFWGenerator::WriteGeneratedByToStrim(cmGeneratedFileStream &xout) +{ + xout << "<!-- Generated by CPack " << CMake_VERSION << " IFW generator " + << "for QtIFW "; + if(IsVersionLess("2.0")) + { + xout << "less 2.0"; + } + else + { + xout << FrameworkVersion; + } + xout << " tools at " << cmTimestamp().CurrentTime("", true) << " -->" + << std::endl; +} diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h index 1d4d67b..3246861 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.h +++ b/Source/CPack/IFW/cmCPackIFWGenerator.h @@ -13,6 +13,7 @@ #ifndef cmCPackIFWGenerator_h #define cmCPackIFWGenerator_h +#include <cmGeneratedFileStream.h> #include <CPack/cmCPackGenerator.h> #include "cmCPackIFWPackage.h" @@ -44,6 +45,21 @@ public: */ virtual ~cmCPackIFWGenerator(); + /** + * Compare \a version with QtIFW framework version + */ + bool IsVersionLess(const char *version); + + /** + * Compare \a version with QtIFW framework version + */ + bool IsVersionGreater(const char *version); + + /** + * Compare \a version with QtIFW framework version + */ + bool IsVersionEqual(const char *version); + protected: // cmCPackGenerator reimplementation /** @@ -105,6 +121,8 @@ protected: // Methods cmCPackIFWPackage* GetGroupPackage(cmCPackComponentGroup *group) const; cmCPackIFWPackage* GetComponentPackage(cmCPackComponent *component) const; + void WriteGeneratedByToStrim(cmGeneratedFileStream& xout); + protected: // Data friend class cmCPackIFWPackage; @@ -126,6 +144,8 @@ protected: // Data private: std::string RepoGen; std::string BinCreator; + std::string FrameworkVersion; + std::string ExecutableSuffix; bool OnlineOnly; bool ResolveDuplicateNames; diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 4a99e50..8c77a2c 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -51,6 +51,25 @@ bool cmCPackIFWInstaller::IsOn(const std::string &op) const } //---------------------------------------------------------------------------- +bool cmCPackIFWInstaller::IsVersionLess(const char *version) +{ + return Generator ? Generator->IsVersionLess(version) : false; +} + +//---------------------------------------------------------------------------- +bool cmCPackIFWInstaller::IsVersionGreater(const char *version) +{ + return Generator ? Generator->IsVersionGreater(version) : false; +} + +//---------------------------------------------------------------------------- +bool cmCPackIFWInstaller::IsVersionEqual(const char *version) +{ + return Generator ? Generator->IsVersionEqual(version) : false; +} + + +//---------------------------------------------------------------------------- void cmCPackIFWInstaller::ConfigureFromOptions() { // Name; @@ -151,6 +170,17 @@ void cmCPackIFWInstaller::ConfigureFromOptions() } } + // Start menu + if (const char* optIFW_START_MENU_DIR = + this->GetOption("CPACK_IFW_PACKAGE_START_MENU_DIRECTORY")) + { + StartMenuDir = optIFW_START_MENU_DIR; + } + else + { + StartMenuDir = Name; + } + // Default target directory for installation if (const char* optIFW_TARGET_DIRECTORY = GetOption("CPACK_IFW_TARGET_DIRECTORY")) @@ -177,7 +207,7 @@ void cmCPackIFWInstaller::ConfigureFromOptions() // Repositories Repositories.clear(); RepositoryStruct Repo; - if (const char *site = this->GetOption("CPACK_DOWNLOAD_SITE")) + if(const char *site = this->GetOption("CPACK_DOWNLOAD_SITE")) { Repo.Url = site; Repositories.push_back(Repo); @@ -245,6 +275,53 @@ void cmCPackIFWInstaller::ConfigureFromOptions() } } } + + // Maintenance tool + if(const char* optIFW_MAINTENANCE_TOOL = + this->GetOption("CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME")) + { + MaintenanceToolName = optIFW_MAINTENANCE_TOOL; + } + + // Maintenance tool ini file + if(const char* optIFW_MAINTENANCE_TOOL_INI = + this->GetOption("CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_INI_FILE")) + { + MaintenanceToolIniFile = optIFW_MAINTENANCE_TOOL_INI; + } + + // Allow non-ASCII characters + if(this->GetOption("CPACK_IFW_PACKAGE_ALLOW_NON_ASCII_CHARACTERS")) + { + if(IsOn("CPACK_IFW_PACKAGE_ALLOW_NON_ASCII_CHARACTERS")) + { + AllowNonAsciiCharacters = "true"; + } + else + { + AllowNonAsciiCharacters = "false"; + } + } + + // Space in path + if(this->GetOption("CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH")) + { + if(IsOn("CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH")) + { + AllowSpaceInPath = "true"; + } + else + { + AllowSpaceInPath = "false"; + } + } + + // Control script + if(const char* optIFW_CONTROL_SCRIPT = + this->GetOption("CPACK_IFW_PACKAGE_CONTROL_SCRIPT")) + { + ControlScript = optIFW_CONTROL_SCRIPT; + } } //---------------------------------------------------------------------------- @@ -259,7 +336,10 @@ void cmCPackIFWInstaller::GenerateInstallerFile() // Output stream cmGeneratedFileStream xout((Directory + "/config/config.xml").data()); - xout << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl; + xout << "<?xml version=\"1.0\"?>" << std::endl; + + WriteGeneratedByToStrim(xout); + xout << "<Installer>" << std::endl; xout << " <Name>" << cmXMLSafe(Name).str() << "</Name>" << std::endl; @@ -313,11 +393,20 @@ void cmCPackIFWInstaller::GenerateInstallerFile() xout << " <Logo>" << name << "</Logo>" << std::endl; } + // Start menu + if(!IsVersionLess("2.0")) + { + xout << " <StartMenuDir>" << StartMenuDir + << "</StartMenuDir>" << std::endl; + } + + // Target dir if(!TargetDir.empty()) { xout << " <TargetDir>" << TargetDir << "</TargetDir>" << std::endl; } + // Admin target dir if(!AdminTargetDir.empty()) { xout << " <AdminTargetDir>" << AdminTargetDir @@ -364,11 +453,52 @@ void cmCPackIFWInstaller::GenerateInstallerFile() xout << " </RemoteRepositories>" << std::endl; } - // CPack IFW default policy - xout << " <!-- CPack IFW default policy -->" << std::endl; - xout << " <AllowNonAsciiCharacters>true</AllowNonAsciiCharacters>" - << std::endl; - xout << " <AllowSpaceInPath>true</AllowSpaceInPath>" << std::endl; + // Maintenance tool + if(!IsVersionLess("2.0") && !MaintenanceToolName.empty()) + { + xout << " <MaintenanceToolName>" << MaintenanceToolName + << "</MaintenanceToolName>" << std::endl; + } + + // Maintenance tool ini file + if(!IsVersionLess("2.0") && !MaintenanceToolIniFile.empty()) + { + xout << " <MaintenanceToolIniFile>" << MaintenanceToolIniFile + << "</MaintenanceToolIniFile>" << std::endl; + } + + // Different allows + if(IsVersionLess("2.0")) + { + // CPack IFW default policy + xout << " <!-- CPack IFW default policy for QtIFW less 2.0 -->" + << std::endl; + xout << " <AllowNonAsciiCharacters>true</AllowNonAsciiCharacters>" + << std::endl; + xout << " <AllowSpaceInPath>true</AllowSpaceInPath>" << std::endl; + } + else + { + if(!AllowNonAsciiCharacters.empty()) + { + xout << " <AllowNonAsciiCharacters>" << AllowNonAsciiCharacters + << "</AllowNonAsciiCharacters>" << std::endl; + } + if(!AllowSpaceInPath.empty()) + { + xout << " <AllowAllowSpaceInPath>" << AllowSpaceInPath + << "</AllowSpaceInPath>" << std::endl; + } + } + + // Control script (copy to config dir) + if(!IsVersionLess("2.0") && !ControlScript.empty()) + { + std::string name = cmSystemTools::GetFilenameName(ControlScript); + std::string path = Directory + "/config/" + name; + cmsys::SystemTools::CopyFileIfDifferent(ControlScript.data(), path.data()); + xout << " <ControlScript>" << name << "</ControlScript>" << std::endl; + } xout << "</Installer>" << std::endl; } @@ -402,5 +532,10 @@ void cmCPackIFWInstaller::GeneratePackageFiles() { cmCPackIFWPackage* package = pit->second; package->GeneratePackageFile(); - } + } +} + +void cmCPackIFWInstaller::WriteGeneratedByToStrim(cmGeneratedFileStream &xout) +{ + if(Generator) Generator->WriteGeneratedByToStrim(xout); } diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h index 5824d33..4cba5b2 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.h +++ b/Source/CPack/IFW/cmCPackIFWInstaller.h @@ -13,6 +13,7 @@ #ifndef cmCPackIFWInstaller_h #define cmCPackIFWInstaller_h +#include <cmGeneratedFileStream.h> #include <cmStandardIncludes.h> class cmCPackIFWPackage; @@ -69,17 +70,39 @@ public: // Configuration /// Filename for a logo std::string Logo; + /// Name of the default program group in the Windows Start menu + std::string StartMenuDir; + /// Default target directory for installation std::string TargetDir; /// Default target directory for installation with administrator rights std::string AdminTargetDir; + /// Filename of the generated maintenance tool + std::string MaintenanceToolName; + + /// Filename for the configuration of the generated maintenance tool + std::string MaintenanceToolIniFile; + + /// Set to true if the installation path can contain non-ASCII characters + std::string AllowNonAsciiCharacters; + + /// Set to false if the installation path cannot contain space characters + std::string AllowSpaceInPath; + + /// Filename for a custom installer control script + std::string ControlScript; + public: // Internal implementation const char* GetOption(const std::string& op) const; bool IsOn(const std::string& op) const; + bool IsVersionLess(const char *version); + bool IsVersionGreater(const char *version); + bool IsVersionEqual(const char *version); + void ConfigureFromOptions(); void GenerateInstallerFile(); @@ -90,6 +113,9 @@ public: // Internal implementation PackagesMap Packages; std::vector<RepositoryStruct> Repositories; std::string Directory; + +protected: + void WriteGeneratedByToStrim(cmGeneratedFileStream& xout); }; #endif // cmCPackIFWInstaller_h diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index 38cef87..5474ad1b 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -132,6 +132,24 @@ bool cmCPackIFWPackage::IsOn(const std::string &op) const } //---------------------------------------------------------------------------- +bool cmCPackIFWPackage::IsVersionLess(const char *version) +{ + return Generator ? Generator->IsVersionLess(version) : false; +} + +//---------------------------------------------------------------------------- +bool cmCPackIFWPackage::IsVersionGreater(const char *version) +{ + return Generator ? Generator->IsVersionGreater(version) : false; +} + +//---------------------------------------------------------------------------- +bool cmCPackIFWPackage::IsVersionEqual(const char *version) +{ + return Generator ? Generator->IsVersionEqual(version) : false; +} + +//---------------------------------------------------------------------------- std::string cmCPackIFWPackage::GetComponentName(cmCPackComponent *component) { if (!component) return ""; @@ -432,6 +450,9 @@ void cmCPackIFWPackage::GeneratePackageFile() cmGeneratedFileStream xout((Directory + "/meta/package.xml").data()); xout << "<?xml version=\"1.0\"?>" << std::endl; + + WriteGeneratedByToStrim(xout); + xout << "<Package>" << std::endl; xout << " <DisplayName>" << DisplayName @@ -538,3 +559,8 @@ void cmCPackIFWPackage::GeneratePackageFile() xout << "</Package>" << std::endl; } + +void cmCPackIFWPackage::WriteGeneratedByToStrim(cmGeneratedFileStream &xout) +{ + if(Generator) Generator->WriteGeneratedByToStrim(xout); +} diff --git a/Source/CPack/IFW/cmCPackIFWPackage.h b/Source/CPack/IFW/cmCPackIFWPackage.h index 9fc9bd0..d2f7927 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.h +++ b/Source/CPack/IFW/cmCPackIFWPackage.h @@ -14,6 +14,7 @@ #define cmCPackIFWPackage_h #include <cmStandardIncludes.h> +#include <cmGeneratedFileStream.h> class cmCPackComponent; class cmCPackComponentGroup; @@ -107,6 +108,10 @@ public: // Internal implementation const char* GetOption(const std::string& op) const; bool IsOn(const std::string& op) const; + bool IsVersionLess(const char *version); + bool IsVersionGreater(const char *version); + bool IsVersionEqual(const char *version); + std::string GetComponentName(cmCPackComponent *component); void DefaultConfiguration(); @@ -128,6 +133,9 @@ public: // Internal implementation std::set<DependenceStruct*> AlienDependencies; // Patch to package directory std::string Directory; + +protected: + void WriteGeneratedByToStrim(cmGeneratedFileStream& xout); }; #endif // cmCPackIFWPackage_h diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index e254e9a..41614ca 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -711,11 +711,13 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( } cmake cm; + cm.SetHomeDirectory(""); + cm.SetHomeOutputDirectory(""); cm.AddCMakePaths(); cm.SetProgressCallback(cmCPackGeneratorProgress, this); cmGlobalGenerator gg; gg.SetCMakeInstance(&cm); - cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator()); cmMakefile *mf = lg->GetMakefile(); std::string realInstallDirectory = tempInstallDirectory; if ( !installSubDirectory.empty() && installSubDirectory != "/" ) diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 2207873..a5109e0 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -198,10 +198,12 @@ int main (int argc, char const* const* argv) "Read CPack config file: " << cpackConfigFile << std::endl); cmake cminst; + cminst.SetHomeDirectory(""); + cminst.SetHomeOutputDirectory(""); cminst.GetState()->RemoveUnscriptableCommands(); cmGlobalGenerator cmgg; cmgg.SetCMakeInstance(&cminst); - cmsys::auto_ptr<cmLocalGenerator> cmlg(cmgg.CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> cmlg(cmgg.MakeLocalGenerator()); cmMakefile* globalMF = cmlg->GetMakefile(); #if defined(__CYGWIN__) globalMF->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0"); diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 586070b..20d303d 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -204,6 +204,8 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) } cmake cm; + cm.SetHomeDirectory(""); + cm.SetHomeOutputDirectory(""); std::string cmakeOutString; cmCTestBuildAndTestCaptureRAII captureRAII(cm, cmakeOutString); static_cast<void>(captureRAII); diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index de6ecde..6f43a1e 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -750,9 +750,11 @@ int cmCTestLaunch::Main(int argc, const char* const argv[]) void cmCTestLaunch::LoadConfig() { cmake cm; + cm.SetHomeDirectory(""); + cm.SetHomeOutputDirectory(""); cmGlobalGenerator gg; gg.SetCMakeInstance(&cm); - cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator()); cmMakefile* mf = lg->GetMakefile(); std::string fname = this->LogDir; fname += "CTestLaunchConfig.cmake"; diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 0a34be8..62c6b46 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -336,11 +336,13 @@ void cmCTestScriptHandler::CreateCMake() delete this->LocalGenerator; } this->CMake = new cmake; + this->CMake->SetHomeDirectory(""); + this->CMake->SetHomeOutputDirectory(""); this->CMake->AddCMakePaths(); this->GlobalGenerator = new cmGlobalGenerator; this->GlobalGenerator->SetCMakeInstance(this->CMake); - this->LocalGenerator = this->GlobalGenerator->CreateLocalGenerator(); + this->LocalGenerator = this->GlobalGenerator->MakeLocalGenerator(); this->Makefile = this->LocalGenerator->GetMakefile(); this->CMake->SetProgressCallback(ctestScriptProgressCallback, this->CTest); diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 95cdf3b..b1c479e 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1571,9 +1571,11 @@ void cmCTestTestHandler::GetListOfTests() cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Constructing a list of tests" << std::endl, this->Quiet); cmake cm; + cm.SetHomeDirectory(""); + cm.SetHomeOutputDirectory(""); cmGlobalGenerator gg; gg.SetCMakeInstance(&cm); - cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator()); cmMakefile *mf = lg->GetMakefile(); mf->AddDefinition("CTEST_CONFIGURATION_TYPE", this->CTest->GetConfigType().c_str()); diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index e013f81..5236e57 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -104,6 +104,8 @@ int main(int argc, char const* const* argv) if(doc.CheckOptions(argc, argv)) { cmake hcm; + hcm.SetHomeDirectory(""); + hcm.SetHomeOutputDirectory(""); hcm.AddCMakePaths(); std::vector<cmDocumentationEntry> generators; hcm.GetGeneratorDocumentation(generators); diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 8a72a24..349269e 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -64,6 +64,8 @@ int main(int argc, char** argv) { // Construct and print requested documentation. cmake hcm; + hcm.SetHomeDirectory(""); + hcm.SetHomeOutputDirectory(""); hcm.AddCMakePaths(); std::vector<cmDocumentationEntry> generators; diff --git a/Source/QtIFW/controlscript.qs b/Source/QtIFW/controlscript.qs new file mode 100644 index 0000000..d1a9b10 --- /dev/null +++ b/Source/QtIFW/controlscript.qs @@ -0,0 +1,6 @@ +// controlscript.qs - CMake installation control script + +function Controller() +{ + // do nothing now +} diff --git a/Source/QtIFW/installscript.qs.in b/Source/QtIFW/installscript.qs.in index 5491611..570dba1 100644 --- a/Source/QtIFW/installscript.qs.in +++ b/Source/QtIFW/installscript.qs.in @@ -18,7 +18,7 @@ Component.prototype.createOperations = function() installer.value("StartMenuDir") + "/CMake Web Site.lnk"); component.addOperation("CreateShortcut", - installer.value("TargetDir") + "/uninstall.exe", - installer.value("StartMenuDir") + "/Uninstall.lnk"); + installer.value("TargetDir") + "/cmake-maintenance.exe", + installer.value("StartMenuDir") + "/CMake Maintenance Tool.lnk"); } } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 403a459..211c83c 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -510,9 +510,11 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) } cmake cm; + cm.SetHomeDirectory(""); + cm.SetHomeOutputDirectory(""); cmGlobalGenerator gg; gg.SetCMakeInstance(&cm); - cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator()); cmMakefile *mf = lg->GetMakefile(); if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), mf) ) { diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index 0d1c86d..c816c23 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -143,7 +143,7 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var) cmListFileContext lfc; lfc.FilePath = this->FileName; lfc.Line = this->FileLine; - bt.push_back(lfc); + bt.Append(lfc); msg << "uninitialized variable \'" << var << "\'"; this->Makefile->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, msg.str(), bt); diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index 73aface..61847d4 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -112,10 +112,7 @@ const char* cmConditionEvaluator::GetDefinitionIfUnquoted( if(def && argument.WasQuoted() && this->Policy54Status == cmPolicies::WARN) { - bool hasBeenReported = this->Makefile.HasCMP0054AlreadyBeenReported( - this->Makefile.GetBacktrace()[0]); - - if(!hasBeenReported) + if(!this->Makefile.HasCMP0054AlreadyBeenReported()) { std::ostringstream e; e << (cmPolicies::GetPolicyWarning(cmPolicies::CMP0054)) << "\n"; @@ -161,10 +158,7 @@ bool cmConditionEvaluator::IsKeyword(std::string const& keyword, if(isKeyword && argument.WasQuoted() && this->Policy54Status == cmPolicies::WARN) { - bool hasBeenReported = this->Makefile.HasCMP0054AlreadyBeenReported( - this->Makefile.GetBacktrace()[0]); - - if(!hasBeenReported) + if(!this->Makefile.HasCMP0054AlreadyBeenReported()) { std::ostringstream e; e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0054) << "\n"; diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index f54bc4d..e2c6876 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -18,32 +18,29 @@ cmDefinitions::Def cmDefinitions::NoDef; //---------------------------------------------------------------------------- cmDefinitions::Def const& cmDefinitions::GetInternal( - const std::string& key, - std::list<cmDefinitions>::reverse_iterator rbegin, - std::list<cmDefinitions>::reverse_iterator rend) + const std::string& key, StackIter begin, StackIter end) { - assert(rbegin != rend); - MapType::const_iterator i = rbegin->Map.find(key); - if (i != rbegin->Map.end()) + assert(begin != end); + MapType::const_iterator i = begin->Map.find(key); + if (i != begin->Map.end()) { return i->second; } - std::list<cmDefinitions>::reverse_iterator rit = rbegin; - ++rit; - if (rit == rend) + StackIter it = begin; + ++it; + if (it == end) { return cmDefinitions::NoDef; } - Def const& def = cmDefinitions::GetInternal(key, rit, rend); - return rbegin->Map.insert(MapType::value_type(key, def)).first->second; + Def const& def = cmDefinitions::GetInternal(key, it, end); + return begin->Map.insert(MapType::value_type(key, def)).first->second; } //---------------------------------------------------------------------------- const char* cmDefinitions::Get(const std::string& key, - std::list<cmDefinitions>::reverse_iterator rbegin, - std::list<cmDefinitions>::reverse_iterator rend) + StackIter begin, StackIter end) { - Def const& def = cmDefinitions::GetInternal(key, rbegin, rend); + Def const& def = cmDefinitions::GetInternal(key, begin, end); return def.Exists? def.c_str() : 0; } @@ -77,36 +74,24 @@ std::vector<std::string> cmDefinitions::LocalKeys() const } //---------------------------------------------------------------------------- -cmDefinitions cmDefinitions::MakeClosure( - std::list<cmDefinitions>::const_reverse_iterator rbegin, - std::list<cmDefinitions>::const_reverse_iterator rend) +cmDefinitions cmDefinitions::MakeClosure(StackConstIter begin, + StackConstIter end) { - std::set<std::string> undefined; cmDefinitions closure; - closure.MakeClosure(undefined, rbegin, rend); - return closure; -} - -//---------------------------------------------------------------------------- -void -cmDefinitions::MakeClosure(std::set<std::string>& undefined, - std::list<cmDefinitions>::const_reverse_iterator rbegin, - std::list<cmDefinitions>::const_reverse_iterator rend) -{ - for (std::list<cmDefinitions>::const_reverse_iterator it = rbegin; - it != rend; ++it) + std::set<std::string> undefined; + for (StackConstIter it = begin; it != end; ++it) { // Consider local definitions. for(MapType::const_iterator mi = it->Map.begin(); mi != it->Map.end(); ++mi) { // Use this key if it is not already set or unset. - if(this->Map.find(mi->first) == this->Map.end() && + if(closure.Map.find(mi->first) == closure.Map.end() && undefined.find(mi->first) == undefined.end()) { if(mi->second.Exists) { - this->Map.insert(*mi); + closure.Map.insert(*mi); } else { @@ -115,22 +100,29 @@ cmDefinitions::MakeClosure(std::set<std::string>& undefined, } } } + return closure; } //---------------------------------------------------------------------------- std::vector<std::string> -cmDefinitions::ClosureKeys(std::set<std::string>& bound) const +cmDefinitions::ClosureKeys(StackConstIter begin, StackConstIter end) { + std::set<std::string> bound; std::vector<std::string> defined; - defined.reserve(this->Map.size()); - for(MapType::const_iterator mi = this->Map.begin(); - mi != this->Map.end(); ++mi) + + for (StackConstIter it = begin; it != end; ++it) { - // Use this key if it is not already set or unset. - if(bound.insert(mi->first).second && mi->second.Exists) + defined.reserve(defined.size() + it->Map.size()); + for(MapType::const_iterator mi = it->Map.begin(); + mi != it->Map.end(); ++mi) { - defined.push_back(mi->first); + // Use this key if it is not already set or unset. + if(bound.insert(mi->first).second && mi->second.Exists) + { + defined.push_back(mi->first); + } } } + return defined; } diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 245a0bd..bf791ed 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -32,12 +32,13 @@ */ class cmDefinitions { + typedef std::list<cmDefinitions>::reverse_iterator StackIter; + typedef std::list<cmDefinitions>::const_reverse_iterator StackConstIter; public: /** Get the value associated with a key; null if none. Store the result locally if it came from a parent. */ static const char* Get(const std::string& key, - std::list<cmDefinitions>::reverse_iterator rbegin, - std::list<cmDefinitions>::reverse_iterator rend); + StackIter begin, StackIter end); /** Set (or unset if null) a value associated with a key. */ void Set(const std::string& key, const char* value); @@ -47,12 +48,10 @@ public: /** Get the set of all local keys. */ std::vector<std::string> LocalKeys() const; - std::vector<std::string> - ClosureKeys(std::set<std::string>& bound) const; + static std::vector<std::string> ClosureKeys(StackConstIter begin, + StackConstIter end); - static cmDefinitions MakeClosure( - std::list<cmDefinitions>::const_reverse_iterator rbegin, - std::list<cmDefinitions>::const_reverse_iterator rend); + static cmDefinitions MakeClosure(StackConstIter begin, StackConstIter end); private: // String with existence boolean. @@ -81,11 +80,7 @@ private: MapType Map; static Def const& GetInternal(const std::string& key, - std::list<cmDefinitions>::reverse_iterator rbegin, - std::list<cmDefinitions>::reverse_iterator rend); - void MakeClosure(std::set<std::string>& undefined, - std::list<cmDefinitions>::const_reverse_iterator rbegin, - std::list<cmDefinitions>::const_reverse_iterator rend); + StackIter begin, StackIter end); }; #endif diff --git a/Source/cmExecutionStatus.h b/Source/cmExecutionStatus.h index d4da5a4..201465d 100644 --- a/Source/cmExecutionStatus.h +++ b/Source/cmExecutionStatus.h @@ -12,47 +12,44 @@ #ifndef cmExecutionStatus_h #define cmExecutionStatus_h -#include "cmObject.h" +#include "cmStandardIncludes.h" /** \class cmExecutionStatus * \brief Superclass for all command status classes * * when a command is involked it may set values on a command status instance */ -class cmExecutionStatus : public cmObject +class cmExecutionStatus { public: - cmTypeMacro(cmExecutionStatus, cmObject); + cmExecutionStatus() { this->Clear(); } - cmExecutionStatus() { this->Clear();} - - virtual void SetReturnInvoked(bool val) + void SetReturnInvoked(bool val) { this->ReturnInvoked = val; } - virtual bool GetReturnInvoked() + bool GetReturnInvoked() { return this->ReturnInvoked; } - virtual void SetBreakInvoked(bool val) + void SetBreakInvoked(bool val) { this->BreakInvoked = val; } - virtual bool GetBreakInvoked() + bool GetBreakInvoked() { return this->BreakInvoked; } - virtual void SetContinueInvoked(bool val) + void SetContinueInvoked(bool val) { this->ContinueInvoked = val; } - virtual bool GetContinueInvoked() + bool GetContinueInvoked() { return this->ContinueInvoked; } - virtual void Clear() + void Clear() { this->ReturnInvoked = false; this->BreakInvoked = false; this->ContinueInvoked = false; this->NestedError = false; } - virtual void SetNestedError(bool val) { this->NestedError = val; } - virtual bool GetNestedError() { return this->NestedError; } - + void SetNestedError(bool val) { this->NestedError = val; } + bool GetNestedError() { return this->NestedError; } -protected: +private: bool ReturnInvoked; bool BreakInvoked; bool ContinueInvoked; diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index fdd1018..001adb1 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -94,8 +94,8 @@ bool cmFunctionHelperCommand::InvokeInitialPass } // we push a scope on the makefile - cmMakefile::LexicalPushPop lexScope(this->Makefile); cmMakefile::ScopePushPop varScope(this->Makefile); + cmMakefile::LexicalPushPop lexScope(this->Makefile); static_cast<void>(varScope); // Push a weak policy scope which restores the policies recorded at diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx index d191056..0ee98a8 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.cxx +++ b/Source/cmGlobalBorlandMakefileGenerator.cxx @@ -22,6 +22,10 @@ cmGlobalBorlandMakefileGenerator::cmGlobalBorlandMakefileGenerator() this->ToolSupportsColor = true; this->UseLinkScript = false; this->WindowsShell = true; + this->IncludeDirective = "!include"; + this->DefineWindowsNULL = true; + this->PassMakeflags = true; + this->UnixCD = false; } @@ -43,11 +47,7 @@ cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator( { cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3(this, parent); - lg->SetIncludeDirective("!include"); - lg->SetDefineWindowsNULL(true); lg->SetMakefileVariableSize(32); - lg->SetPassMakeflags(true); - lg->SetUnixCD(false); lg->SetMakeCommandEscapeTargetTwice(true); lg->SetBorlandMakeCurlyHack(true); return lg; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 82023e4..1ca2c95 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1099,7 +1099,7 @@ void cmGlobalGenerator::Configure() this->ClearGeneratorMembers(); // start with this directory - cmLocalGenerator *lg = this->CreateLocalGenerator(); + cmLocalGenerator *lg = this->MakeLocalGenerator(); this->LocalGenerators.push_back(lg); // set the Start directories @@ -1890,6 +1890,12 @@ void cmGlobalGenerator::EnableInstallTarget() } cmLocalGenerator * +cmGlobalGenerator::MakeLocalGenerator(cmLocalGenerator *parent) +{ + return this->CreateLocalGenerator(parent); +} + +cmLocalGenerator * cmGlobalGenerator::CreateLocalGenerator(cmLocalGenerator *parent) { return new cmLocalGenerator(this, parent); diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index c4c98ea..f9ea449 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -56,8 +56,7 @@ public: cmGlobalGenerator(); virtual ~cmGlobalGenerator(); - ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); + cmLocalGenerator* MakeLocalGenerator(cmLocalGenerator* parent = 0); ///! Get the name for this generator virtual std::string GetName() const { return "Generic"; } @@ -358,6 +357,7 @@ public: cmFileLockPool& GetFileLockPool() { return FileLockPool; } #endif + std::string MakeSilentFlag; bool WindowsShell; bool WindowsVSIDE; bool WatcomWMake; @@ -450,6 +450,9 @@ protected: virtual bool UseFolderProperty(); private: + ///! Create a local generator appropriate to this Global Generator + virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent); + cmMakefile* TryCompileOuterMakefile; float FirstTimeProgress; // If you add a new map here, make sure it is copied diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx index 25613eb..3ddbeb6 100644 --- a/Source/cmGlobalJOMMakefileGenerator.cxx +++ b/Source/cmGlobalJOMMakefileGenerator.cxx @@ -21,6 +21,10 @@ cmGlobalJOMMakefileGenerator::cmGlobalJOMMakefileGenerator() this->UseLinkScript = false; this->WindowsShell = true; this->NMake = true; + this->DefineWindowsNULL = true; + this->PassMakeflags = true; + this->UnixCD = false; + this->MakeSilentFlag = "/nologo"; } void cmGlobalJOMMakefileGenerator @@ -46,20 +50,6 @@ void cmGlobalJOMMakefileGenerator this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional); } -///! Create a local generator appropriate to this Global Generator -cmLocalGenerator * -cmGlobalJOMMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) -{ - cmLocalUnixMakefileGenerator3* lg - = new cmLocalUnixMakefileGenerator3(this, parent); - lg->SetDefineWindowsNULL(true); - lg->SetMakeSilentFlag("/nologo"); - lg->SetIgnoreLibPrefix(true); - lg->SetPassMakeflags(true); - lg->SetUnixCD(false); - return lg; -} - //---------------------------------------------------------------------------- void cmGlobalJOMMakefileGenerator ::GetDocumentation(cmDocumentationEntry& entry) diff --git a/Source/cmGlobalJOMMakefileGenerator.h b/Source/cmGlobalJOMMakefileGenerator.h index 4831309..fa596f6 100644 --- a/Source/cmGlobalJOMMakefileGenerator.h +++ b/Source/cmGlobalJOMMakefileGenerator.h @@ -36,9 +36,6 @@ public: /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); - ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); - /** * Try to determine system information such as shared library * extension, pthreads, byte order etc. diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx index b6adcbb..fe3321e 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.cxx +++ b/Source/cmGlobalMSYSMakefileGenerator.cxx @@ -93,18 +93,6 @@ void cmGlobalMSYSMakefileGenerator } } -///! Create a local generator appropriate to this Global Generator -cmLocalGenerator * -cmGlobalMSYSMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) -{ - cmLocalUnixMakefileGenerator3* lg = - new cmLocalUnixMakefileGenerator3(this, parent); - lg->SetIgnoreLibPrefix(true); - lg->SetPassMakeflags(false); - lg->SetUnixCD(true); - return lg; -} - //---------------------------------------------------------------------------- void cmGlobalMSYSMakefileGenerator ::GetDocumentation(cmDocumentationEntry& entry) diff --git a/Source/cmGlobalMSYSMakefileGenerator.h b/Source/cmGlobalMSYSMakefileGenerator.h index 1795d86..4d5ee1e 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.h +++ b/Source/cmGlobalMSYSMakefileGenerator.h @@ -35,9 +35,6 @@ public: /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); - ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); - /** * Try to determine system information such as shared library * extension, pthreads, byte order etc. diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx index 5b92eeb..17a7301 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.cxx +++ b/Source/cmGlobalMinGWMakefileGenerator.cxx @@ -58,18 +58,6 @@ void cmGlobalMinGWMakefileGenerator this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional); } -///! Create a local generator appropriate to this Global Generator -cmLocalGenerator * -cmGlobalMinGWMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) -{ - cmLocalUnixMakefileGenerator3* lg = - new cmLocalUnixMakefileGenerator3(this, parent); - lg->SetIgnoreLibPrefix(true); - lg->SetPassMakeflags(false); - lg->SetUnixCD(true); - return lg; -} - //---------------------------------------------------------------------------- void cmGlobalMinGWMakefileGenerator ::GetDocumentation(cmDocumentationEntry& entry) diff --git a/Source/cmGlobalMinGWMakefileGenerator.h b/Source/cmGlobalMinGWMakefileGenerator.h index 93f67be..5543d12 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.h +++ b/Source/cmGlobalMinGWMakefileGenerator.h @@ -34,9 +34,6 @@ public: /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); - ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); - /** * Try to determine system information such as shared library * extension, pthreads, byte order etc. diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx index 98d7fb4..6152b29 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.cxx +++ b/Source/cmGlobalNMakeMakefileGenerator.cxx @@ -21,6 +21,10 @@ cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator() this->UseLinkScript = false; this->WindowsShell = true; this->NMake = true; + this->DefineWindowsNULL = true; + this->PassMakeflags = true; + this->UnixCD = false; + this->MakeSilentFlag = "/nologo"; } void cmGlobalNMakeMakefileGenerator @@ -46,20 +50,6 @@ void cmGlobalNMakeMakefileGenerator this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional); } -///! Create a local generator appropriate to this Global Generator -cmLocalGenerator * -cmGlobalNMakeMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent) -{ - cmLocalUnixMakefileGenerator3* lg = - new cmLocalUnixMakefileGenerator3(this, parent); - lg->SetDefineWindowsNULL(true); - lg->SetMakeSilentFlag("/nologo"); - lg->SetIgnoreLibPrefix(true); - lg->SetPassMakeflags(true); - lg->SetUnixCD(false); - return lg; -} - //---------------------------------------------------------------------------- void cmGlobalNMakeMakefileGenerator ::GetDocumentation(cmDocumentationEntry& entry) diff --git a/Source/cmGlobalNMakeMakefileGenerator.h b/Source/cmGlobalNMakeMakefileGenerator.h index cb898ba..69e5084 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.h +++ b/Source/cmGlobalNMakeMakefileGenerator.h @@ -34,9 +34,6 @@ public: /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); - ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); - /** * Try to determine system information such as shared library * extension, pthreads, byte order etc. diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 9a952a3..e064b84 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -21,6 +21,7 @@ #include <algorithm> #include <assert.h> +#include <ctype.h> const char* cmGlobalNinjaGenerator::NINJA_BUILD_FILE = "build.ninja"; const char* cmGlobalNinjaGenerator::NINJA_RULES_FILE = "rules.ninja"; @@ -57,6 +58,28 @@ void cmGlobalNinjaGenerator::WriteComment(std::ostream& os, os << "# " << replace.substr(lpos) << "\n\n"; } +std::string cmGlobalNinjaGenerator::EncodeRuleName(std::string const& name) +{ + // Ninja rule names must match "[a-zA-Z0-9_.-]+". Use ".xx" to encode + // "." and all invalid characters as hexadecimal. + std::string encoded; + for (std::string::const_iterator i = name.begin(); + i != name.end(); ++i) + { + if (isalnum(*i) || *i == '_' || *i == '-') + { + encoded += *i; + } + else + { + char buf[16]; + sprintf(buf, ".%02x", static_cast<unsigned int>(*i)); + encoded += buf; + } + } + return encoded; +} + static bool IsIdentChar(char c) { return @@ -120,7 +143,8 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os, const cmNinjaDeps& orderOnlyDeps, const cmNinjaVars& variables, const std::string& rspfile, - int cmdLineLimit) + int cmdLineLimit, + bool* usedResponseFile) { // Make sure there is a rule. if(rule.empty()) @@ -205,6 +229,7 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os, std::string buildstr = build; std::string assignments = variable_assignments.str(); const std::string& args = arguments; + bool useResponseFile = false; if (cmdLineLimit > 0 && args.size() + buildstr.size() + assignments.size() > (size_t) cmdLineLimit) { @@ -213,7 +238,12 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os, cmGlobalNinjaGenerator::WriteVariable(variable_assignments, "RSP_FILE", rspfile, "", 1); assignments += variable_assignments.str(); + useResponseFile = true; } + if (usedResponseFile) + { + *usedResponseFile = useResponseFile; + } os << buildstr << args << assignments; } diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 00dc237..444c3e2 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -61,6 +61,7 @@ public: /// Write a divider in the given output stream @a os. static void WriteDivider(std::ostream& os); + static std::string EncodeRuleName(std::string const& name); static std::string EncodeIdent(const std::string &ident, std::ostream &vars); static std::string EncodeLiteral(const std::string &lit); std::string EncodePath(const std::string &path); @@ -87,7 +88,8 @@ public: const cmNinjaDeps& orderOnlyDeps, const cmNinjaVars& variables, const std::string& rspfile = std::string(), - int cmdLineLimit = -1); + int cmdLineLimit = -1, + bool* usedResponseFile = 0); /** * Helper to write a build statement with the special 'phony' rule. diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index a4df493..a43a427 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -33,6 +33,11 @@ cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3() this->UseLinkScript = true; #endif this->CommandDatabase = NULL; + + this->IncludeDirective = "include"; + this->DefineWindowsNULL = false; + this->PassMakeflags = false; + this->UnixCD = true; } void cmGlobalUnixMakefileGenerator3 @@ -580,7 +585,7 @@ void cmGlobalUnixMakefileGenerator3 else { lg = static_cast<cmLocalUnixMakefileGenerator3 *> - (this->CreateLocalGenerator()); + (this->MakeLocalGenerator()); // set the Start directories lg->GetMakefile()->SetCurrentSourceDirectory (this->CMakeInstance->GetHomeDirectory()); diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 165a3c8..ac82287 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -132,6 +132,11 @@ public: virtual bool AllowDeleteOnError() const { return true; } virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const; + + std::string IncludeDirective; + bool DefineWindowsNULL; + bool PassMakeflags; + bool UnixCD; protected: void WriteMainMakefile2(); void WriteMainCMakefile(); diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 04bb6ce..d907de4 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -105,6 +105,7 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator( this->SystemIsWindowsPhone = false; this->SystemIsWindowsStore = false; this->MSBuildCommandInitialized = false; + this->Version = VS10; } //---------------------------------------------------------------------------- @@ -311,8 +312,7 @@ void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout) cmLocalGenerator * cmGlobalVisualStudio10Generator::CreateLocalGenerator(cmLocalGenerator* parent) { - return new cmLocalVisualStudio10Generator( - cmLocalVisualStudioGenerator::VS10, this, parent); + return new cmLocalVisualStudio10Generator(this, parent); } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 36ae0a4..c7ff1f6 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -117,6 +117,7 @@ cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator( "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\11.0\\Setup\\VC;" "ProductDir", vc11Express, cmSystemTools::KeyWOW64_32); this->DefaultPlatformToolset = "v110"; + this->Version = VS11; } //---------------------------------------------------------------------------- @@ -237,14 +238,6 @@ void cmGlobalVisualStudio11Generator::WriteSLNHeader(std::ostream& fout) } //---------------------------------------------------------------------------- -cmLocalGenerator * -cmGlobalVisualStudio11Generator::CreateLocalGenerator(cmLocalGenerator* parent) -{ - return new cmLocalVisualStudio10Generator( - cmLocalVisualStudioGenerator::VS11, this, parent); -} - -//---------------------------------------------------------------------------- bool cmGlobalVisualStudio11Generator::UseFolderProperty() { // Intentionally skip over the parent class implementation and call the diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h index ae4b888..6a9032f 100644 --- a/Source/cmGlobalVisualStudio11Generator.h +++ b/Source/cmGlobalVisualStudio11Generator.h @@ -28,9 +28,6 @@ public: virtual void WriteSLNHeader(std::ostream& fout); - ///! create the correct local generator - virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); - protected: virtual bool InitializeWindowsPhone(cmMakefile* mf); virtual bool InitializeWindowsStore(cmMakefile* mf); diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 17b2fc7..4e89e57 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -97,6 +97,7 @@ cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator( "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\12.0\\Setup\\VC;" "ProductDir", vc12Express, cmSystemTools::KeyWOW64_32); this->DefaultPlatformToolset = "v120"; + this->Version = VS12; } //---------------------------------------------------------------------------- @@ -217,14 +218,6 @@ void cmGlobalVisualStudio12Generator::WriteSLNHeader(std::ostream& fout) } //---------------------------------------------------------------------------- -cmLocalGenerator * -cmGlobalVisualStudio12Generator::CreateLocalGenerator(cmLocalGenerator* parent) -{ - return new cmLocalVisualStudio10Generator( - cmLocalVisualStudioGenerator::VS12, this, parent); -} - -//---------------------------------------------------------------------------- bool cmGlobalVisualStudio12Generator::IsWindowsDesktopToolsetInstalled() const { diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h index d304bc1..797394f 100644 --- a/Source/cmGlobalVisualStudio12Generator.h +++ b/Source/cmGlobalVisualStudio12Generator.h @@ -28,9 +28,6 @@ public: virtual void WriteSLNHeader(std::ostream& fout); - ///! create the correct local generator - virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); - //in Visual Studio 2013 they detached the MSBuild tools version //from the .Net Framework version and instead made it have it's own //version number diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index 90fcc7e..06ebe32 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -97,6 +97,7 @@ cmGlobalVisualStudio14Generator::cmGlobalVisualStudio14Generator( "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\14.0\\Setup\\VC;" "ProductDir", vc14Express, cmSystemTools::KeyWOW64_32); this->DefaultPlatformToolset = "v140"; + this->Version = VS14; } //---------------------------------------------------------------------------- @@ -126,11 +127,3 @@ void cmGlobalVisualStudio14Generator::WriteSLNHeader(std::ostream& fout) fout << "# Visual Studio 14\n"; } } - -//---------------------------------------------------------------------------- -cmLocalGenerator * -cmGlobalVisualStudio14Generator::CreateLocalGenerator(cmLocalGenerator* parent) -{ - return new cmLocalVisualStudio10Generator( - cmLocalVisualStudioGenerator::VS14, this, parent); -} diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h index 59f1e60..4d5612f 100644 --- a/Source/cmGlobalVisualStudio14Generator.h +++ b/Source/cmGlobalVisualStudio14Generator.h @@ -28,9 +28,6 @@ public: virtual void WriteSLNHeader(std::ostream& fout); - ///! create the correct local generator - virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); - virtual const char* GetToolsVersion() { return "14.0"; } protected: virtual const char* GetIDEVersion() { return "14.0"; } diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 570314e..66936b6 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -34,6 +34,7 @@ std::string GetVS6TargetName(const std::string& targetName) cmGlobalVisualStudio6Generator::cmGlobalVisualStudio6Generator() { this->MSDevCommandInitialized = false; + this->Version = VS6; } void cmGlobalVisualStudio6Generator diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 308e858..e3636bb 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -21,18 +21,7 @@ cmGlobalVisualStudio71Generator::cmGlobalVisualStudio71Generator( : cmGlobalVisualStudio7Generator(platformName) { this->ProjectConfigurationSectionName = "ProjectConfiguration"; -} - -//---------------------------------------------------------------------------- -///! Create a local generator appropriate to this Global Generator -cmLocalGenerator * -cmGlobalVisualStudio71Generator::CreateLocalGenerator(cmLocalGenerator* parent) -{ - cmLocalVisualStudio7Generator *lg = - new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS71, - this, parent); - lg->SetExtraFlagTable(this->GetExtraFlagTableVS7()); - return lg; + this->Version = VS71; } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h index ad6c153..7223ebc 100644 --- a/Source/cmGlobalVisualStudio71Generator.h +++ b/Source/cmGlobalVisualStudio71Generator.h @@ -36,9 +36,6 @@ public: /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); - ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); - /** * Where does this version of Visual Studio look for macros for the * current user? Returns the empty string if this version of Visual diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index a2faddd..ca86987 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -18,6 +18,32 @@ #include "cmake.h" #include <cmsys/Encoding.hxx> +//---------------------------------------------------------------------------- +static cmVS7FlagTable cmVS7ExtraFlagTable[] = +{ + // Precompiled header and related options. Note that the + // UsePrecompiledHeader entries are marked as "Continue" so that the + // corresponding PrecompiledHeaderThrough entry can be found. + {"UsePrecompiledHeader", "YX", "Automatically Generate", "2", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"PrecompiledHeaderThrough", "YX", "Precompiled Header Name", "", + cmVS7FlagTable::UserValueRequired}, + {"UsePrecompiledHeader", "Yu", "Use Precompiled Header", "3", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"PrecompiledHeaderThrough", "Yu", "Precompiled Header Name", "", + cmVS7FlagTable::UserValueRequired}, + {"WholeProgramOptimization", "LTCG", "WholeProgramOptimization", "true", 0}, + + // Exception handling mode. If no entries match, it will be FALSE. + {"ExceptionHandling", "GX", "enable c++ exceptions", "true", 0}, + {"ExceptionHandling", "EHsc", "enable c++ exceptions", "true", 0}, + // The EHa option does not have an IDE setting. Let it go to false, + // and have EHa passed on the command line by leaving out the table + // entry. + + {0,0,0,0,0} +}; + cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator( const std::string& platformName) { @@ -33,6 +59,8 @@ cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator( { this->DefaultPlatformName = platformName; } + this->ExtraFlagTable = cmVS7ExtraFlagTable; + this->Version = VS7; } cmGlobalVisualStudio7Generator::~cmGlobalVisualStudio7Generator() @@ -254,9 +282,7 @@ cmLocalGenerator * cmGlobalVisualStudio7Generator::CreateLocalGenerator(cmLocalGenerator* parent) { cmLocalVisualStudio7Generator *lg = - new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS7, - this, parent); - lg->SetExtraFlagTable(this->GetExtraFlagTableVS7()); + new cmLocalVisualStudio7Generator(this, parent); return lg; } @@ -1086,36 +1112,6 @@ cmGlobalVisualStudio7Generator return false; } -//---------------------------------------------------------------------------- -static cmVS7FlagTable cmVS7ExtraFlagTable[] = -{ - // Precompiled header and related options. Note that the - // UsePrecompiledHeader entries are marked as "Continue" so that the - // corresponding PrecompiledHeaderThrough entry can be found. - {"UsePrecompiledHeader", "YX", "Automatically Generate", "2", - cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, - {"PrecompiledHeaderThrough", "YX", "Precompiled Header Name", "", - cmVS7FlagTable::UserValueRequired}, - {"UsePrecompiledHeader", "Yu", "Use Precompiled Header", "3", - cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, - {"PrecompiledHeaderThrough", "Yu", "Precompiled Header Name", "", - cmVS7FlagTable::UserValueRequired}, - {"WholeProgramOptimization", "LTCG", "WholeProgramOptimization", "true", 0}, - - // Exception handling mode. If no entries match, it will be FALSE. - {"ExceptionHandling", "GX", "enable c++ exceptions", "true", 0}, - {"ExceptionHandling", "EHsc", "enable c++ exceptions", "true", 0}, - // The EHa option does not have an IDE setting. Let it go to false, - // and have EHa passed on the command line by leaving out the table - // entry. - - {0,0,0,0,0} -}; -cmIDEFlagTable const* cmGlobalVisualStudio7Generator::GetExtraFlagTableVS7() -{ - return cmVS7ExtraFlagTable; -} - std::string cmGlobalVisualStudio7Generator::Encoding() { std::ostringstream encoding; diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 92c5f1a..204fdc8 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -111,6 +111,8 @@ public: // Encoding for Visual Studio files virtual std::string Encoding(); + cmIDEFlagTable const* ExtraFlagTable; + protected: virtual void Generate(); virtual const char* GetIDEVersion() { return "7.0"; } @@ -120,7 +122,6 @@ protected: static const char* ExternalProjectType(const char* location); - static cmIDEFlagTable const* GetExtraFlagTableVS7(); virtual void OutputSLNFile(cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root, diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index ff9ff10..6d0dd36 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -101,6 +101,8 @@ cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator( { this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; this->Name = name; + this->ExtraFlagTable = this->GetExtraFlagTableVS8(); + this->Version = VS8; } //---------------------------------------------------------------------------- @@ -124,18 +126,6 @@ std::string cmGlobalVisualStudio8Generator::FindDevEnvCommand() } //---------------------------------------------------------------------------- -///! Create a local generator appropriate to this Global Generator -cmLocalGenerator * -cmGlobalVisualStudio8Generator::CreateLocalGenerator(cmLocalGenerator* parent) -{ - cmLocalVisualStudio7Generator *lg = - new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS8, - this, parent); - lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); - return lg; -} - -//---------------------------------------------------------------------------- void cmGlobalVisualStudio8Generator ::EnableLanguage(std::vector<std::string>const & lang, cmMakefile *mf, bool optional) diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index ee5ba9f..5079862 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -33,9 +33,6 @@ public: /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); - ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); - virtual void EnableLanguage(std::vector<std::string>const& languages, cmMakefile *, bool optional); virtual void AddPlatformDefinitions(cmMakefile* mf); diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index 8adde23..95e9fb9 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -104,6 +104,7 @@ cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator( const std::string& name, const std::string& platformName) : cmGlobalVisualStudio8Generator(name, platformName) { + this->Version = VS9; } //---------------------------------------------------------------------------- @@ -113,17 +114,6 @@ void cmGlobalVisualStudio9Generator::WriteSLNHeader(std::ostream& fout) fout << "# Visual Studio 2008\n"; } -///! Create a local generator appropriate to this Global Generator -cmLocalGenerator * -cmGlobalVisualStudio9Generator::CreateLocalGenerator(cmLocalGenerator* parent) -{ - cmLocalVisualStudio7Generator *lg - = new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS9, - this, parent); - lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); - return lg; -} - //---------------------------------------------------------------------------- std::string cmGlobalVisualStudio9Generator::GetUserMacrosDirectory() { diff --git a/Source/cmGlobalVisualStudio9Generator.h b/Source/cmGlobalVisualStudio9Generator.h index 97b7804..bc4f773 100644 --- a/Source/cmGlobalVisualStudio9Generator.h +++ b/Source/cmGlobalVisualStudio9Generator.h @@ -28,9 +28,6 @@ public: const std::string& platformName); static cmGlobalGeneratorFactory* NewFactory(); - ///! create the correct local generator - virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); - /** * Try to determine system information such as shared library * extension, pthreads, byte order etc. diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index b74ba6f..05f0f01 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -33,6 +33,19 @@ cmGlobalVisualStudioGenerator::~cmGlobalVisualStudioGenerator() } //---------------------------------------------------------------------------- +cmGlobalVisualStudioGenerator::VSVersion +cmGlobalVisualStudioGenerator::GetVersion() const +{ + return this->Version; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudioGenerator::SetVersion(VSVersion v) +{ + this->Version = v; +} + +//---------------------------------------------------------------------------- std::string cmGlobalVisualStudioGenerator::GetRegistryBase() { return cmGlobalVisualStudioGenerator::GetRegistryBase( diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index cb54132..ae83402 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -23,9 +23,27 @@ class cmGlobalVisualStudioGenerator : public cmGlobalGenerator { public: + /** Known versions of Visual Studio. */ + enum VSVersion + { + VS6 = 60, + VS7 = 70, + VS71 = 71, + VS8 = 80, + VS9 = 90, + VS10 = 100, + VS11 = 110, + VS12 = 120, + /* VS13 = 130 was skipped */ + VS14 = 140 + }; + cmGlobalVisualStudioGenerator(); virtual ~cmGlobalVisualStudioGenerator(); + VSVersion GetVersion() const; + void SetVersion(VSVersion v); + /** * Configure CMake's Visual Studio macros file into the user's Visual * Studio macros directory. @@ -107,6 +125,9 @@ protected: typedef std::map<cmTarget const*, std::string> UtilityDependsMap; UtilityDependsMap UtilityDepends; +protected: + VSVersion Version; + private: virtual std::string GetVSMakeProgram() = 0; void PrintCompilerAdvice(std::ostream&, std::string const&, diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx index 181178f..062091f 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.cxx +++ b/Source/cmGlobalWatcomWMakeGenerator.cxx @@ -26,6 +26,10 @@ cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator() this->WindowsShell = true; #endif this->WatcomWMake = true; + this->IncludeDirective = "!include"; + this->DefineWindowsNULL = true; + this->UnixCD = false; + this->MakeSilentFlag = "-h"; } void cmGlobalWatcomWMakeGenerator @@ -44,21 +48,6 @@ void cmGlobalWatcomWMakeGenerator this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional); } -///! Create a local generator appropriate to this Global Generator -cmLocalGenerator * -cmGlobalWatcomWMakeGenerator::CreateLocalGenerator(cmLocalGenerator* parent) -{ - cmLocalUnixMakefileGenerator3* lg - = new cmLocalUnixMakefileGenerator3(this, parent); - lg->SetDefineWindowsNULL(true); - lg->SetMakeSilentFlag("-h"); - lg->SetIgnoreLibPrefix(true); - lg->SetPassMakeflags(false); - lg->SetUnixCD(false); - lg->SetIncludeDirective("!include"); - return lg; -} - //---------------------------------------------------------------------------- void cmGlobalWatcomWMakeGenerator ::GetDocumentation(cmDocumentationEntry& entry) diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h index 3af2f9d..b733324 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.h +++ b/Source/cmGlobalWatcomWMakeGenerator.h @@ -34,9 +34,6 @@ public: /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); - ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0); - /** * Try to determine system information such as shared library * extension, pthreads, byte order etc. diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 99542a9..bbbfc24 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -65,9 +65,11 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, const char* fallbackSettingsFileName) { cmake cm; + cm.SetHomeDirectory(""); + cm.SetHomeOutputDirectory(""); cmGlobalGenerator ggi; ggi.SetCMakeInstance(&cm); - cmsys::auto_ptr<cmLocalGenerator> lg(ggi.CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lg(ggi.MakeLocalGenerator()); cmMakefile *mf = lg->GetMakefile(); const char* inFileName = settingsFileName; diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index ddcea9b..2756cd2 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -400,6 +400,11 @@ bool cmListFileParser::AddArgument(cmListFileLexer_Token* token, } } +void cmListFileBacktrace::Append(cmListFileContext const& context) +{ + this->push_back(context); +} + //---------------------------------------------------------------------------- void cmListFileBacktrace::MakeRelative() { @@ -416,6 +421,31 @@ void cmListFileBacktrace::MakeRelative() this->Relative = true; } +void cmListFileBacktrace::PrintTitle(std::ostream& out) +{ + if (this->empty()) + { + return; + } + out << (this->front().Line ? " at " : " in ") << this->front(); +} + +void cmListFileBacktrace::PrintCallStack(std::ostream& out) +{ + if (size() <= 1) + { + return; + } + + const_iterator i = this->begin() + 1; + out << "Call Stack (most recent call first):\n"; + while(i != this->end()) + { + cmListFileContext const& lfc = *i; + out << " " << lfc << "\n"; + ++i; + } +} //---------------------------------------------------------------------------- std::ostream& operator<<(std::ostream& os, cmListFileContext const& lfc) @@ -431,3 +461,22 @@ std::ostream& operator<<(std::ostream& os, cmListFileContext const& lfc) } return os; } + +bool operator<(const cmListFileContext& lhs, const cmListFileContext& rhs) +{ + if(lhs.Line != rhs.Line) + { + return lhs.Line < rhs.Line; + } + return lhs.FilePath < rhs.FilePath; +} + +bool operator==(const cmListFileContext& lhs, const cmListFileContext& rhs) +{ + return lhs.Line == rhs.Line && lhs.FilePath == rhs.FilePath; +} + +bool operator!=(const cmListFileContext& lhs, const cmListFileContext& rhs) +{ + return !(lhs == rhs); +} diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index 544ff1b..4a1d181 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -62,13 +62,16 @@ struct cmListFileContext }; std::ostream& operator<<(std::ostream&, cmListFileContext const&); +bool operator<(const cmListFileContext& lhs, const cmListFileContext& rhs); +bool operator==(cmListFileContext const& lhs, cmListFileContext const& rhs); +bool operator!=(cmListFileContext const& lhs, cmListFileContext const& rhs); struct cmListFileFunction: public cmListFileContext { std::vector<cmListFileArgument> Arguments; }; -class cmListFileBacktrace: public std::vector<cmListFileContext> +class cmListFileBacktrace: private std::vector<cmListFileContext> { public: cmListFileBacktrace(cmLocalGenerator* localGen) @@ -77,7 +80,12 @@ class cmListFileBacktrace: public std::vector<cmListFileContext> { } + void Append(cmListFileContext const& context); + void MakeRelative(); + + void PrintTitle(std::ostream& out); + void PrintCallStack(std::ostream& out); private: cmLocalGenerator* LocalGenerator; bool Relative; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 74362ae..0f18225 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -62,12 +62,9 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, this->Makefile = new cmMakefile(this); this->LinkScriptShell = false; - this->IgnoreLibPrefix = false; this->UseRelativePaths = false; this->Configured = false; this->EmitUniversalBinaryFlags = true; - this->RelativePathsConfigured = false; - this->PathConversionsSetup = false; this->BackwardsCompatibility = 0; this->BackwardsCompatibilityFinal = false; } @@ -196,29 +193,6 @@ void cmLocalGenerator::ReadInputFile() this->Makefile->ProcessBuildsystemFile(currentStart.c_str()); } -void cmLocalGenerator::SetupPathConversions() -{ - // Setup the current output directory components for use by - // Convert - std::string outdir; - outdir = - cmSystemTools::CollapseFullPath(this->GetState()->GetSourceDirectory()); - cmSystemTools::SplitPath(outdir, this->HomeDirectoryComponents); - outdir = cmSystemTools::CollapseFullPath( - this->StateSnapshot.GetCurrentSourceDirectory()); - cmSystemTools::SplitPath(outdir, this->StartDirectoryComponents); - - outdir = cmSystemTools::CollapseFullPath - (this->GetState()->GetBinaryDirectory()); - cmSystemTools::SplitPath(outdir, - this->HomeOutputDirectoryComponents); - - outdir = cmSystemTools::CollapseFullPath - (this->StateSnapshot.GetCurrentBinaryDirectory()); - cmSystemTools::SplitPath(outdir, - this->StartOutputDirectoryComponents); -} - void cmLocalGenerator::ConfigureFinalPass() { this->Makefile->ConfigureFinalPass(); @@ -390,12 +364,8 @@ void cmLocalGenerator::GenerateInstallRules() // Create the install script file. std::string file = this->StateSnapshot.GetCurrentBinaryDirectory(); std::string homedir = this->GetState()->GetBinaryDirectory(); - std::string currdir = this->StateSnapshot.GetCurrentBinaryDirectory(); - cmSystemTools::ConvertToUnixSlashes(file); - cmSystemTools::ConvertToUnixSlashes(homedir); - cmSystemTools::ConvertToUnixSlashes(currdir); int toplevel_install = 0; - if ( currdir == homedir ) + if (file == homedir) { toplevel_install = 1; } @@ -2705,13 +2675,6 @@ std::string cmLocalGenerator::Convert(const std::string& source, OutputFormat output, bool optional) { - // Make sure the relative path conversion components are set. - if(!this->PathConversionsSetup) - { - this->SetupPathConversions(); - this->PathConversionsSetup = true; - } - // Convert the path to a relative path. std::string result = source; @@ -2721,25 +2684,23 @@ std::string cmLocalGenerator::Convert(const std::string& source, { case HOME: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = this->ConvertToRelativePath(this->HomeDirectoryComponents, - result); + result = this->ConvertToRelativePath( + this->GetState()->GetSourceDirectoryComponents(), result); break; case START: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = this->ConvertToRelativePath(this->StartDirectoryComponents, - result); + result = this->ConvertToRelativePath( + this->StateSnapshot.GetCurrentSourceDirectoryComponents(), result); break; case HOME_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = - this->ConvertToRelativePath(this->HomeOutputDirectoryComponents, - result); + result = this->ConvertToRelativePath( + this->GetState()->GetBinaryDirectoryComponents(), result); break; case START_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = - this->ConvertToRelativePath(this->StartOutputDirectoryComponents, - result); + result = this->ConvertToRelativePath( + this->StateSnapshot.GetCurrentBinaryDirectoryComponents(), result); break; case FULL: result = cmSystemTools::CollapseFullPath(result); @@ -2812,97 +2773,6 @@ std::string cmLocalGenerator::Convert(RelativeRoot remote, } //---------------------------------------------------------------------------- -std::string cmLocalGenerator::FindRelativePathTopSource() -{ - cmState::Snapshot snapshot = this->StateSnapshot; - std::vector<cmState::Snapshot> snapshots; - snapshots.push_back(snapshot); - while (true) - { - snapshot = snapshot.GetParent(); - if (snapshot.IsValid()) - { - snapshots.push_back(snapshot); - } - else - { - break; - } - } - - std::string result = snapshots.front().GetCurrentSourceDirectory(); - - for (std::vector<cmState::Snapshot>::const_iterator it = - snapshots.begin() + 1; it != snapshots.end(); ++it) - { - std::string currentSource = it->GetCurrentSourceDirectory(); - if(cmSystemTools::IsSubDirectory(result, currentSource)) - { - result = currentSource; - } - } - - return result; -} - -//---------------------------------------------------------------------------- -std::string cmLocalGenerator::FindRelativePathTopBinary() -{ - cmState::Snapshot snapshot = this->StateSnapshot; - std::vector<cmState::Snapshot> snapshots; - snapshots.push_back(snapshot); - while (true) - { - snapshot = snapshot.GetParent(); - if (snapshot.IsValid()) - { - snapshots.push_back(snapshot); - } - else - { - break; - } - } - - std::string result = snapshots.front().GetCurrentBinaryDirectory(); - - for (std::vector<cmState::Snapshot>::const_iterator it = - snapshots.begin() + 1; it != snapshots.end(); ++it) - { - std::string currentBinary = it->GetCurrentBinaryDirectory(); - if(cmSystemTools::IsSubDirectory(result, currentBinary)) - { - result = currentBinary; - } - } - - return result; -} - -//---------------------------------------------------------------------------- -void cmLocalGenerator::ConfigureRelativePaths() -{ - // Relative path conversion inside the source tree is not used to - // construct relative paths passed to build tools so it is safe to - // even when the source is a network path. - std::string source = this->FindRelativePathTopSource(); - this->RelativePathTopSource = source; - - // The current working directory on Windows cannot be a network - // path. Therefore relative paths cannot work when the binary tree - // is a network path. - std::string binary = this->FindRelativePathTopBinary(); - if(binary.size() < 2 || binary.substr(0, 2) != "//") - { - this->RelativePathTopBinary = binary; - } - else - { - this->RelativePathTopBinary = ""; - } -} - -//---------------------------------------------------------------------------- static bool cmLocalGeneratorNotAbove(const char* a, const char* b) { return (cmSystemTools::ComparePath(a, b) || @@ -2927,26 +2797,19 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local, return in_remote; } - // Make sure relative path conversion is configured. - if(!this->RelativePathsConfigured) - { - this->ConfigureRelativePaths(); - this->RelativePathsConfigured = true; - } - if(!force) { // Skip conversion if the path and local are not both in the source // or both in the binary tree. std::string local_path = cmSystemTools::JoinPath(local); if(!((cmLocalGeneratorNotAbove(local_path.c_str(), - this->RelativePathTopBinary.c_str()) && + this->StateSnapshot.GetRelativePathTopBinary()) && cmLocalGeneratorNotAbove(in_remote.c_str(), - this->RelativePathTopBinary.c_str())) || + this->StateSnapshot.GetRelativePathTopBinary())) || (cmLocalGeneratorNotAbove(local_path.c_str(), - this->RelativePathTopSource.c_str()) && + this->StateSnapshot.GetRelativePathTopSource()) && cmLocalGeneratorNotAbove(in_remote.c_str(), - this->RelativePathTopSource.c_str())))) + this->StateSnapshot.GetRelativePathTopSource())))) { return in_remote; } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index fa2f712..67ac4fd 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -440,11 +440,6 @@ protected: std::string const& dir_max); void ComputeObjectMaxPath(); - void ConfigureRelativePaths(); - std::string FindRelativePathTopSource(); - std::string FindRelativePathTopBinary(); - void SetupPathConversions(); - virtual std::string ConvertToLinkReference(std::string const& lib, OutputFormat format = SHELL); @@ -458,10 +453,6 @@ protected: cmMakefile *Makefile; cmState::Snapshot StateSnapshot; cmGlobalGenerator *GlobalGenerator; - std::vector<std::string> HomeDirectoryComponents; - std::vector<std::string> StartDirectoryComponents; - std::vector<std::string> HomeOutputDirectoryComponents; - std::vector<std::string> StartOutputDirectoryComponents; cmLocalGenerator* Parent; std::vector<cmLocalGenerator*> Children; std::map<std::string, std::string> UniqueObjectNamesMap; @@ -470,7 +461,6 @@ protected: bool LinkScriptShell; bool UseRelativePaths; - bool IgnoreLibPrefix; bool Configured; bool EmitUniversalBinaryFlags; @@ -478,16 +468,6 @@ protected: // committed. std::string TargetImplib; - // The top-most directories for relative path conversion. Both the - // source and destination location of a relative path conversion - // must be underneath one of these directories (both under source or - // both under binary) in order for the relative path to be evaluated - // safely by the build tools. - std::string RelativePathTopSource; - std::string RelativePathTopBinary; - bool RelativePathsConfigured; - bool PathConversionsSetup; - cmIML_INT_uint64_t BackwardsCompatibility; bool BackwardsCompatibilityFinal; private: diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index f11c79e..f2e0a01 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -83,12 +83,7 @@ cmLocalUnixMakefileGenerator3:: cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmLocalGenerator* parent) : cmLocalGenerator(gg, parent) { - this->IncludeDirective = "include"; this->MakefileVariableSize = 0; - this->IgnoreLibPrefix = false; - this->PassMakeflags = false; - this->DefineWindowsNULL = false; - this->UnixCD = true; this->ColorMakefile = false; this->SkipPreprocessedSourceRules = false; this->SkipAssemblySourceRules = false; @@ -545,9 +540,11 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() // Setup relative path conversion tops. infoFileStream << "# Relative path conversion top directories.\n" - << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" << this->RelativePathTopSource + << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" + << this->StateSnapshot.GetRelativePathTopSource() << "\")\n" - << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \"" << this->RelativePathTopBinary + << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \"" + << this->StateSnapshot.GetRelativePathTopBinary() << "\")\n" << "\n"; @@ -720,7 +717,9 @@ cmLocalUnixMakefileGenerator3 makefileStream << "# Set environment variables for the build.\n" << "\n"; - if(this->DefineWindowsNULL) + cmGlobalUnixMakefileGenerator3* gg = + static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator); + if(gg->DefineWindowsNULL) { makefileStream << "!IF \"$(OS)\" == \"Windows_NT\"\n" @@ -1613,16 +1612,15 @@ cmLocalUnixMakefileGenerator3 } // Setup relative path top directories. - this->RelativePathsConfigured = true; if(const char* relativePathTopSource = mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_SOURCE")) { - this->RelativePathTopSource = relativePathTopSource; + this->StateSnapshot.SetRelativePathTopSource(relativePathTopSource); } if(const char* relativePathTopBinary = mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_BINARY")) { - this->RelativePathTopBinary = relativePathTopBinary; + this->StateSnapshot.SetRelativePathTopBinary(relativePathTopBinary); } } else @@ -2143,10 +2141,12 @@ cmLocalUnixMakefileGenerator3 cmd += this->Convert(makefile,NONE,SHELL); cmd += " "; + cmGlobalUnixMakefileGenerator3* gg = + static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator); // Pass down verbosity level. - if(!this->GetMakeSilentFlag().empty()) + if(!gg->MakeSilentFlag.empty()) { - cmd += this->GetMakeSilentFlag(); + cmd += gg->MakeSilentFlag; cmd += " "; } @@ -2154,7 +2154,7 @@ cmLocalUnixMakefileGenerator3 // sub-invoked makes via an environment variable. However, some // makes do not support that, so you have to pass the flags // explicitly. - if(this->GetPassMakeflags()) + if(gg->PassMakeflags) { cmd += "-$(MAKEFLAGS) "; } @@ -2346,7 +2346,9 @@ void cmLocalUnixMakefileGenerator3 // support changing the drive letter with just "d:"). const char* cd_cmd = this->IsMinGWMake() ? "cd /d " : "cd "; - if(!this->UnixCD) + cmGlobalUnixMakefileGenerator3* gg = + static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator); + if(!gg->UnixCD) { // On Windows we must perform each step separately and then change // back because the shell keeps the working directory between diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 7b436a5..0b056ff 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -67,52 +67,11 @@ public: void WriteMakeVariables(std::ostream& makefileStream); /** - * If true, then explicitly pass MAKEFLAGS on the make all target for makes - * that do not use environment variables. - * - */ - void SetPassMakeflags(bool s){this->PassMakeflags = s;} - bool GetPassMakeflags() { return this->PassMakeflags; } - - /** - * Set the flag used to keep the make program silent. - */ - void SetMakeSilentFlag(const std::string& s) { this->MakeSilentFlag = s; } - std::string &GetMakeSilentFlag() { return this->MakeSilentFlag; } - - /** - * If set to true, then NULL is set to nil for non Windows_NT. - * This uses make syntax used by nmake and borland. - * The default is false. - */ - void SetDefineWindowsNULL(bool v) {this->DefineWindowsNULL = v;} - - /** - * If set to true, cd dir && command is used to - * run commands in a different directory. - */ - void SetUnixCD(bool v) {this->UnixCD = v;} - - /** - * Set the string used to include one makefile into another default - * is include. - */ - void SetIncludeDirective(const std::string& s) - { this->IncludeDirective = s; } - const std::string& GetIncludeDirective() { return this->IncludeDirective; } - - /** * Set max makefile variable size, default is 0 which means unlimited. */ void SetMakefileVariableSize(int s) { this->MakefileVariableSize = s; } /** - * If ignore lib prefix is true, then do not strip lib from the name - * of a library. - */ - void SetIgnoreLibPrefix(bool s) { this->IgnoreLibPrefix = s; } - - /** * Set whether passing a make target on a command line requires an * extra level of escapes. */ @@ -303,12 +262,7 @@ private: //========================================================================== // Configuration settings. int MakefileVariableSize; - std::string IncludeDirective; - std::string MakeSilentFlag; std::string ConfigurationName; - bool DefineWindowsNULL; - bool UnixCD; - bool PassMakeflags; bool MakeCommandEscapeTargetTwice; bool BorlandMakeCurlyHack; //========================================================================== diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx index 06a3b6c..37b722a 100644 --- a/Source/cmLocalVisualStudio10Generator.cxx +++ b/Source/cmLocalVisualStudio10Generator.cxx @@ -62,9 +62,9 @@ class cmVS10XMLParser : public cmXMLParser //---------------------------------------------------------------------------- cmLocalVisualStudio10Generator -::cmLocalVisualStudio10Generator(VSVersion v, cmGlobalGenerator* gg, +::cmLocalVisualStudio10Generator(cmGlobalGenerator* gg, cmLocalGenerator* parent): - cmLocalVisualStudio7Generator(v, gg, parent) + cmLocalVisualStudio7Generator(gg, parent) { } diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h index 987e08b..afd52b9 100644 --- a/Source/cmLocalVisualStudio10Generator.h +++ b/Source/cmLocalVisualStudio10Generator.h @@ -25,7 +25,7 @@ class cmLocalVisualStudio10Generator : public cmLocalVisualStudio7Generator { public: ///! Set cache only and recurse to false by default. - cmLocalVisualStudio10Generator(VSVersion v, cmGlobalGenerator* gg, + cmLocalVisualStudio10Generator(cmGlobalGenerator* gg, cmLocalGenerator* parent); virtual ~cmLocalVisualStudio10Generator(); diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 42da639..8dc9836 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -26,7 +26,7 @@ cmLocalVisualStudio6Generator ::cmLocalVisualStudio6Generator(cmGlobalGenerator* gg, cmLocalGenerator* parent): - cmLocalVisualStudioGenerator(VS6, gg, parent) + cmLocalVisualStudioGenerator(gg, parent) { } diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 63c18a7..1d27086 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -55,11 +55,10 @@ static void cmConvertToWindowsSlash(std::string& s) //---------------------------------------------------------------------------- cmLocalVisualStudio7Generator -::cmLocalVisualStudio7Generator(VSVersion v, cmGlobalGenerator* gg, +::cmLocalVisualStudio7Generator(cmGlobalGenerator* gg, cmLocalGenerator* parent): - cmLocalVisualStudioGenerator(v, gg, parent) + cmLocalVisualStudioGenerator(gg, parent) { - this->ExtraFlagTable = 0; this->Internal = new cmLocalVisualStudio7GeneratorInternals(this); } @@ -241,18 +240,17 @@ void cmLocalVisualStudio7Generator::WriteStampFiles() void cmLocalVisualStudio7Generator ::CreateSingleVCProj(const std::string& lname, cmTarget &target) { - this->FortranProject = - static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator) - ->TargetIsFortranOnly(target); - this->WindowsCEProject = - static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator) - ->TargetsWindowsCE(); + cmGlobalVisualStudioGenerator* gg + = static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator); + this->FortranProject = gg->TargetIsFortranOnly(target); + this->WindowsCEProject = gg->TargetsWindowsCE(); // Intel Fortran for VS10 uses VS9 format ".vfproj" files. - VSVersion realVersion = this->Version; - if(this->FortranProject && this->Version >= VS10) + cmGlobalVisualStudioGenerator::VSVersion realVersion = gg->GetVersion(); + if(this->FortranProject + && gg->GetVersion() >= cmGlobalVisualStudioGenerator::VS10) { - this->Version = VS9; + gg->SetVersion(cmGlobalVisualStudioGenerator::VS9); } // add to the list of projects @@ -282,7 +280,7 @@ void cmLocalVisualStudio7Generator this->GlobalGenerator->FileReplacedDuringGenerate(fname); } - this->Version = realVersion; + gg->SetVersion(realVersion); } //---------------------------------------------------------------------------- @@ -773,7 +771,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, } Options targetOptions(this, t, table, - this->ExtraFlagTable); + gg->ExtraFlagTable); targetOptions.FixExceptionHandlingDefault(); std::string asmLocation = configName + "/"; targetOptions.AddFlag("AssemblerListingLocation", asmLocation.c_str()); @@ -995,7 +993,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, // end of <Tool Name=VCMIDLTool // Check if we need the FAT32 workaround. - if(targetBuilds && this->Version >= VS8) + if(targetBuilds && this->GetVersion() >= cmGlobalVisualStudioGenerator::VS8) { // Check the filesystem type where the target will be written. if(cmLVS6G_IsFAT(target.GetDirectory(configName).c_str())) @@ -1130,7 +1128,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, fout << "\t\t\t<Tool\n" << "\t\t\t\tName=\"" << tool << "\"\n"; - if(this->GetVersion() < VS8 || this->FortranProject) + if(this->GetVersion() < cmGlobalVisualStudioGenerator::VS8 + || this->FortranProject) { std::ostringstream libdeps; this->Internal->OutputObjects(libdeps, &target); @@ -1190,7 +1189,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, // libraries which may be set by the user to something bad. fout << "\t\t\t\tAdditionalDependencies=\"$(NOINHERIT) " << this->Makefile->GetSafeDefinition(standardLibsVar.c_str()); - if(this->GetVersion() < VS8 || this->FortranProject) + if(this->GetVersion() < cmGlobalVisualStudioGenerator::VS8 + || this->FortranProject) { this->Internal->OutputObjects(fout, &target, " "); } @@ -1218,7 +1218,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, } if(this->WindowsCEProject) { - if(this->GetVersion() < VS9) + if(this->GetVersion() < cmGlobalVisualStudioGenerator::VS9) { fout << "\t\t\t\tSubSystem=\"9\"\n"; } @@ -1288,7 +1288,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, // libraries which may be set by the user to something bad. fout << "\t\t\t\tAdditionalDependencies=\"$(NOINHERIT) " << this->Makefile->GetSafeDefinition(standardLibsVar.c_str()); - if(this->GetVersion() < VS8 || this->FortranProject) + if(this->GetVersion() < cmGlobalVisualStudioGenerator::VS8 + || this->FortranProject) { this->Internal->OutputObjects(fout, &target, " "); } @@ -1316,7 +1317,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, } if ( this->WindowsCEProject ) { - if(this->GetVersion() < VS9) + if(this->GetVersion() < cmGlobalVisualStudioGenerator::VS9) { fout << "\t\t\t\tSubSystem=\"9\"\n"; } @@ -1517,7 +1518,8 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout, this->WriteGroup(&sg, target, fout, libName, configs); } - if(this->GetVersion() >= VS8 && !this->FortranProject) + if(this->GetVersion() >= cmGlobalVisualStudioGenerator::VS8 + && !this->FortranProject) { // VS >= 8 support per-config source locations so we // list object library content as external objects. @@ -1842,7 +1844,7 @@ bool cmLocalVisualStudio7Generator table = cmLocalVisualStudio7GeneratorFortranFlagTable; } Options fileOptions(this, tool, table, - this->ExtraFlagTable); + gg->ExtraFlagTable); fileOptions.Parse(fc.CompileFlags.c_str()); fileOptions.AddDefines(fc.CompileDefs.c_str()); fileOptions.AddDefines(fc.CompileDefsConfig.c_str()); @@ -2149,13 +2151,13 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, << gg->Encoding() << "\"?>\n" << "<VisualStudioProject\n" << "\tProjectType=\"Visual C++\"\n"; - if(this->Version == VS71) + if(gg->GetVersion() == cmGlobalVisualStudioGenerator::VS71) { fout << "\tVersion=\"7.10\"\n"; } else { - fout << "\tVersion=\"" << (this->Version/10) << ".00\"\n"; + fout << "\tVersion=\"" << (gg->GetVersion()/10) << ".00\"\n"; } const char* projLabel = target.GetProperty("PROJECT_LABEL"); if(!projLabel) @@ -2168,7 +2170,7 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, keyword = "Win32Proj"; } fout << "\tName=\"" << projLabel << "\"\n"; - if(this->Version >= VS8) + if(gg->GetVersion() >= cmGlobalVisualStudioGenerator::VS8) { fout << "\tProjectGUID=\"{" << gg->GetGUID(libName.c_str()) << "}\"\n"; } diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index 1891369..464d750 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -35,7 +35,7 @@ class cmLocalVisualStudio7Generator : public cmLocalVisualStudioGenerator { public: ///! Set cache only and recurse to false by default. - cmLocalVisualStudio7Generator(VSVersion v, cmGlobalGenerator* gg, + cmLocalVisualStudio7Generator(cmGlobalGenerator* gg, cmLocalGenerator* parent); virtual ~cmLocalVisualStudio7Generator(); @@ -54,8 +54,6 @@ public: */ void SetBuildType(BuildType,const std::string& name); - void SetExtraFlagTable(cmVS7FlagTable const* table) - { this->ExtraFlagTable = table; } virtual std::string GetTargetDirectory(cmTarget const&) const; cmSourceFile* CreateVCProjBuildRule(); void WriteStampFiles(); @@ -119,7 +117,6 @@ private: class EventWriter; friend class EventWriter; - cmVS7FlagTable const* ExtraFlagTable; std::string ModuleDefinitionFile; bool FortranProject; bool WindowsCEProject; diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 4a596d5..2fd0387 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -19,11 +19,10 @@ //---------------------------------------------------------------------------- cmLocalVisualStudioGenerator -::cmLocalVisualStudioGenerator(VSVersion v, cmGlobalGenerator* gg, +::cmLocalVisualStudioGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent) : cmLocalGenerator(gg, parent) { - this->Version = v; } //---------------------------------------------------------------------------- @@ -32,6 +31,15 @@ cmLocalVisualStudioGenerator::~cmLocalVisualStudioGenerator() } //---------------------------------------------------------------------------- +cmGlobalVisualStudioGenerator::VSVersion +cmLocalVisualStudioGenerator::GetVersion() const +{ + cmGlobalVisualStudioGenerator* gg = + static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator); + return gg->GetVersion(); +} + +//---------------------------------------------------------------------------- void cmLocalVisualStudioGenerator::ComputeObjectFilenames( std::map<cmSourceFile const*, std::string>& mapping, cmGeneratorTarget const* gt) diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index 1152e82..df7d20c 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -13,6 +13,7 @@ #define cmLocalVisualStudioGenerator_h #include "cmLocalGenerator.h" +#include "cmGlobalVisualStudioGenerator.h" #include <cmsys/auto_ptr.hxx> @@ -30,22 +31,7 @@ class cmCustomCommandGenerator; class cmLocalVisualStudioGenerator : public cmLocalGenerator { public: - /** Known versions of Visual Studio. */ - enum VSVersion - { - VS6 = 60, - VS7 = 70, - VS71 = 71, - VS8 = 80, - VS9 = 90, - VS10 = 100, - VS11 = 110, - VS12 = 120, - /* VS13 = 130 was skipped */ - VS14 = 140 - }; - - cmLocalVisualStudioGenerator(VSVersion v, cmGlobalGenerator* gg, + cmLocalVisualStudioGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent); virtual ~cmLocalVisualStudioGenerator(); @@ -57,8 +43,7 @@ public: sequence of custom commands. */ const char* GetReportErrorLabel() const; - /** Version of Visual Studio. */ - VSVersion GetVersion() const { return this->Version; } + cmGlobalVisualStudioGenerator::VSVersion GetVersion() const; virtual std::string ComputeLongestObjectDirectory(cmTarget&) const = 0; @@ -76,8 +61,6 @@ protected: cmsys::auto_ptr<cmCustomCommand> MaybeCreateImplibDir(cmTarget& target, const std::string& config, bool isFortran); - - VSVersion Version; }; #endif diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7b8d3af..3e19cbb 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -94,16 +94,8 @@ public: std::vector<std::string> ClosureKeys() const { - std::vector<std::string> closureKeys; - std::set<std::string> bound; - for (std::list<cmDefinitions>::const_reverse_iterator it = - this->VarStack.rbegin(); it != this->VarStack.rend(); ++it) - { - std::vector<std::string> const& localKeys = it->ClosureKeys(bound); - closureKeys.insert(closureKeys.end(), - localKeys.begin(), localKeys.end()); - } - return closureKeys; + return cmDefinitions::ClosureKeys(this->VarStack.rbegin(), + this->VarStack.rend()); } void PopDefinitions() @@ -358,7 +350,7 @@ void cmMakefile::IssueMessage(cmake::MessageType t, lfc.FilePath = this->ListFileStack.back(); } lfc.Line = 0; - backtrace.push_back(lfc); + backtrace.Append(lfc); } // Issue the message. @@ -372,12 +364,18 @@ cmListFileBacktrace cmMakefile::GetBacktrace() const for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin(); i != this->CallStack.rend(); ++i) { - backtrace.push_back(*i->Context); + backtrace.Append(*i->Context); } return backtrace; } //---------------------------------------------------------------------------- +cmListFileContext cmMakefile::GetExecutionContext() const +{ + return *this->CallStack.back().Context; +} + +//---------------------------------------------------------------------------- void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) const { std::ostringstream msg; @@ -1706,7 +1704,7 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, // create a new local generator and set its parent cmLocalGenerator *lg2 = this->GetGlobalGenerator() - ->CreateLocalGenerator(this->LocalGenerator); + ->MakeLocalGenerator(this->LocalGenerator); this->GetGlobalGenerator()->AddLocalGenerator(lg2); // set the subdirs start dirs @@ -1937,9 +1935,9 @@ void cmMakefile::CheckForUnused(const char* reason, cmListFileBacktrace bt(this->GetLocalGenerator()); if (!this->CallStack.empty()) { - const cmListFileContext* file = this->CallStack.back().Context; - bt.push_back(*file); - path = file->FilePath.c_str(); + cmListFileContext file = this->GetExecutionContext(); + bt.Append(file); + path = file.FilePath; } else { @@ -1948,7 +1946,7 @@ void cmMakefile::CheckForUnused(const char* reason, cmListFileContext lfc; lfc.FilePath = path; lfc.Line = 0; - bt.push_back(lfc); + bt.Append(lfc); } if (this->CheckSystemVars || cmSystemTools::IsSubDirectory(path, @@ -2878,7 +2876,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( cmListFileContext lfc; lfc.FilePath = filename; lfc.Line = line; - bt.push_back(lfc); + bt.Append(lfc); msg << "uninitialized variable \'" << lookup << "\'"; this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, msg.str(), bt); @@ -3276,6 +3274,7 @@ void cmMakefile::PopFunctionBlockerBarrier(bool reportError) this->FunctionBlockerBarriers.back(); while(this->FunctionBlockers.size() > barrier) { + cmMakefile::LoopBlockPop loopBlockPop(this); cmsys::auto_ptr<cmFunctionBlocker> fb(this->FunctionBlockers.back()); this->FunctionBlockers.pop_back(); if(reportError) @@ -3410,7 +3409,7 @@ void cmMakefile::AddFunctionBlocker(cmFunctionBlocker* fb) if(!this->CallStack.empty()) { // Record the context in which the blocker is created. - fb->SetStartingContext(*(this->CallStack.back().Context)); + fb->SetStartingContext(this->GetExecutionContext()); } this->FunctionBlockers.push_back(fb); @@ -4371,7 +4370,7 @@ std::string cmMakefile::GetListFileStack() const size_t depth = this->ListFileStack.size(); if (depth > 0) { - std::deque<std::string>::const_iterator it = this->ListFileStack.end(); + std::vector<std::string>::const_iterator it = this->ListFileStack.end(); do { if (depth != this->ListFileStack.size()) @@ -4935,20 +4934,9 @@ bool cmMakefile::SetPolicyVersion(const char *version) } //---------------------------------------------------------------------------- -bool cmMakefile::HasCMP0054AlreadyBeenReported( - cmListFileContext context) const +bool cmMakefile::HasCMP0054AlreadyBeenReported() const { - cmCMP0054Id id(context); - - bool alreadyReported = - this->CMP0054ReportedIds.find(id) != this->CMP0054ReportedIds.end(); - - if(!alreadyReported) - { - this->CMP0054ReportedIds.insert(id); - } - - return alreadyReported; + return !this->CMP0054ReportedIds.insert(this->GetExecutionContext()).second; } //---------------------------------------------------------------------------- diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 8271cc2..82f2715 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -39,7 +39,6 @@ #endif #include <stack> -#include <deque> class cmFunctionBlocker; class cmCommand; @@ -391,33 +390,13 @@ public: */ cmPolicies *GetPolicies() const; - struct cmCMP0054Id - { - cmCMP0054Id(cmListFileContext const& context): - Context(context) - { - - } - - bool operator< (cmCMP0054Id const& id) const - { - if(this->Context.FilePath != id.Context.FilePath) - return this->Context.FilePath < id.Context.FilePath; - - return this->Context.Line < id.Context.Line; - } - - cmListFileContext Context; - }; - - mutable std::set<cmCMP0054Id> CMP0054ReportedIds; + mutable std::set<cmListFileContext> CMP0054ReportedIds; /** * Determine if the given context, name pair has already been reported * in context of CMP0054. */ - bool HasCMP0054AlreadyBeenReported( - cmListFileContext context) const; + bool HasCMP0054AlreadyBeenReported() const; bool IgnoreErrorsCMP0061() const; @@ -615,6 +594,7 @@ public: * Get the current context backtrace. */ cmListFileBacktrace GetBacktrace() const; + cmListFileContext GetExecutionContext() const; /** * Get the vector of files created by this makefile @@ -971,7 +951,7 @@ private: bool CheckSystemVars; // stack of list files being read - std::deque<std::string> ListFileStack; + std::vector<std::string> ListFileStack; // stack of commands being invoked. struct CallStackEntry @@ -979,7 +959,7 @@ private: cmListFileContext const* Context; cmExecutionStatus* Status; }; - typedef std::deque<CallStackEntry> CallStackType; + typedef std::vector<CallStackEntry> CallStackType; CallStackType CallStack; friend class cmMakefileCall; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 2ee23d1..9afe09c 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -226,7 +226,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() dependFileNameFull += "/depend.make"; *this->BuildFileStream << "# Include any dependencies generated for this target.\n" - << this->LocalGenerator->IncludeDirective << " " << root + << this->GlobalGenerator->IncludeDirective << " " << root << this->Convert(dependFileNameFull, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKERULE) @@ -237,7 +237,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() // Include the progress variables for the target. *this->BuildFileStream << "# Include the progress variables for this target.\n" - << this->LocalGenerator->IncludeDirective << " " << root + << this->GlobalGenerator->IncludeDirective << " " << root << this->Convert(this->ProgressFileNameFull, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKERULE) @@ -270,7 +270,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() // Include the flags for the target. *this->BuildFileStream << "# Include the compile flags for this target's objects.\n" - << this->LocalGenerator->IncludeDirective << " " << root + << this->GlobalGenerator->IncludeDirective << " " << root << this->Convert(this->FlagFileNameFull, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKERULE) diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx index 617214f..25d929c 100644 --- a/Source/cmMakefileUtilityTargetGenerator.cxx +++ b/Source/cmMakefileUtilityTargetGenerator.cxx @@ -51,7 +51,7 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles() // Include the progress variables for the target. *this->BuildFileStream << "# Include the progress variables for this target.\n" - << this->LocalGenerator->IncludeDirective << " " << root + << this->GlobalGenerator->IncludeDirective << " " << root << this->Convert(this->ProgressFileNameFull, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKERULE) diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 771ecc4..7f9c09f 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -94,8 +94,6 @@ void cmNinjaNormalTargetGenerator::Generate() } else { - this->WriteLinkRule(false); // write rule without rspfile support - this->WriteLinkRule(true); // write rule with rspfile support this->WriteLinkStatement(); } } @@ -160,7 +158,9 @@ cmNinjaNormalTargetGenerator return this->TargetLinkLanguage + "_" + cmTarget::GetTargetTypeName(this->GetTarget()->GetType()) - + "_LINKER"; + + "_LINKER__" + + cmGlobalNinjaGenerator::EncodeRuleName(this->GetTarget()->GetName()) + ; } void @@ -169,8 +169,6 @@ cmNinjaNormalTargetGenerator { cmTarget::TargetType targetType = this->GetTarget()->GetType(); std::string ruleName = this->LanguageLinkerRule(); - if (useResponseFile) - ruleName += "_RSP_FILE"; // Select whether to use a response file for objects. std::string rspfile; @@ -661,6 +659,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() } // Write the build statement for this target. + bool usedResponseFile = false; globalGen.WriteBuild(this->GetBuildFileStream(), comment.str(), this->LanguageLinkerRule(), @@ -670,7 +669,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() orderOnlyDeps, vars, rspfile, - commandLineLengthLimit); + commandLineLengthLimit, + &usedResponseFile); + this->WriteLinkRule(usedResponseFile); if (targetOutput != targetOutputReal && !target.IsFrameworkOnApple()) { diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 128a35b..cdc9cc8 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -97,6 +97,13 @@ std::string const& cmNinjaTargetGenerator::GetConfigName() const return this->LocalGenerator->GetConfigName(); } +std::string cmNinjaTargetGenerator::LanguageCompilerRule( + const std::string& lang) const +{ + return lang + "_COMPILER__" + + cmGlobalNinjaGenerator::EncodeRuleName(this->Target->GetName()); +} + // TODO: Picked up from cmMakefileTargetGenerator. Refactor it. const char* cmNinjaTargetGenerator::GetFeature(const std::string& feature) { diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 5733fde..4e7d8b3 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -67,8 +67,7 @@ protected: std::string const& GetConfigName() const; - std::string LanguageCompilerRule(const std::string& lang) const - { return lang + "_COMPILER"; } + std::string LanguageCompilerRule(const std::string& lang) const; const char* GetFeature(const std::string& feature); bool GetFeatureAsBool(const std::string& feature); diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 457de11..3e7989f 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -20,7 +20,7 @@ #include "cmAlgorithms.h" #if defined(_WIN32) && !defined(__CYGWIN__) -# include "cmLocalVisualStudioGenerator.h" +# include "cmGlobalVisualStudioGenerator.h" #endif #include <sys/stat.h> @@ -372,13 +372,13 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) cmGlobalGenerator* gg = localGen->GetGlobalGenerator(); if(gg->GetName().find("Visual Studio") != std::string::npos) { - cmLocalVisualStudioGenerator* vslg = - static_cast<cmLocalVisualStudioGenerator*>(localGen); + cmGlobalVisualStudioGenerator* vsgg = + static_cast<cmGlobalVisualStudioGenerator*>(gg); // Under VS >= 7 use a PRE_BUILD event instead of a separate target to // reduce the number of targets loaded into the IDE. // This also works around a VS 11 bug that may skip updating the target: // https://connect.microsoft.com/VisualStudio/feedback/details/769495 - usePRE_BUILD = vslg->GetVersion() >= cmLocalVisualStudioGenerator::VS7; + usePRE_BUILD = vsgg->GetVersion() >= cmGlobalVisualStudioGenerator::VS7; if(usePRE_BUILD) { for (std::vector<std::string>::iterator it = depends.begin(); @@ -1212,7 +1212,7 @@ static cmGlobalGenerator* CreateGlobalGenerator(cmake* cm, cm->SetHomeOutputDirectory(targetDirectory); cm->SetHomeDirectory(targetDirectory); - cmLocalGenerator* lg = gg->CreateLocalGenerator(); + cmLocalGenerator* lg = gg->MakeLocalGenerator(); lg->GetMakefile()->SetCurrentBinaryDirectory(targetDirectory); lg->GetMakefile()->SetCurrentSourceDirectory(targetDirectory); gg->SetCurrentLocalGenerator(lg); diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 82a2939..4965ae3 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -197,6 +197,10 @@ void cmState::Initialize() this->Locations.clear(); this->OutputLocations.clear(); this->ParentPositions.clear(); + this->CurrentSourceDirectoryComponents.clear(); + this->CurrentBinaryDirectoryComponents.clear(); + this->RelativePathTopSource.clear(); + this->RelativePathTopBinary.clear(); this->CreateSnapshot(Snapshot()); this->DefineProperty @@ -458,6 +462,10 @@ void cmState::SetSourceDirectory(std::string const& sourceDirectory) { this->SourceDirectory = sourceDirectory; cmSystemTools::ConvertToUnixSlashes(this->SourceDirectory); + + cmSystemTools::SplitPath( + cmSystemTools::CollapseFullPath(this->SourceDirectory), + this->SourceDirectoryComponents); } const char* cmState::GetSourceDirectory() const @@ -465,10 +473,19 @@ const char* cmState::GetSourceDirectory() const return this->SourceDirectory.c_str(); } +std::vector<std::string> const& cmState::GetSourceDirectoryComponents() const +{ + return this->SourceDirectoryComponents; +} + void cmState::SetBinaryDirectory(std::string const& binaryDirectory) { this->BinaryDirectory = binaryDirectory; cmSystemTools::ConvertToUnixSlashes(this->BinaryDirectory); + + cmSystemTools::SplitPath( + cmSystemTools::CollapseFullPath(this->BinaryDirectory), + this->BinaryDirectoryComponents); } const char* cmState::GetBinaryDirectory() const @@ -476,12 +493,103 @@ const char* cmState::GetBinaryDirectory() const return this->BinaryDirectory.c_str(); } +std::vector<std::string> const& cmState::GetBinaryDirectoryComponents() const +{ + return this->BinaryDirectoryComponents; +} + +void cmState::Snapshot::ComputeRelativePathTopSource() +{ + // Relative path conversion inside the source tree is not used to + // construct relative paths passed to build tools so it is safe to use + // even when the source is a network path. + + cmState::Snapshot snapshot = *this; + std::vector<cmState::Snapshot> snapshots; + snapshots.push_back(snapshot); + while (true) + { + snapshot = snapshot.GetParent(); + if (snapshot.IsValid()) + { + snapshots.push_back(snapshot); + } + else + { + break; + } + } + + std::string result = snapshots.front().GetCurrentSourceDirectory(); + + for (std::vector<cmState::Snapshot>::const_iterator it = + snapshots.begin() + 1; it != snapshots.end(); ++it) + { + std::string currentSource = it->GetCurrentSourceDirectory(); + if(cmSystemTools::IsSubDirectory(result, currentSource)) + { + result = currentSource; + } + } + this->State->RelativePathTopSource[this->Position] = result; +} + +void cmState::Snapshot::ComputeRelativePathTopBinary() +{ + cmState::Snapshot snapshot = *this; + std::vector<cmState::Snapshot> snapshots; + snapshots.push_back(snapshot); + while (true) + { + snapshot = snapshot.GetParent(); + if (snapshot.IsValid()) + { + snapshots.push_back(snapshot); + } + else + { + break; + } + } + + std::string result = + snapshots.front().GetCurrentBinaryDirectory(); + + for (std::vector<cmState::Snapshot>::const_iterator it = + snapshots.begin() + 1; it != snapshots.end(); ++it) + { + std::string currentBinary = it->GetCurrentBinaryDirectory(); + if(cmSystemTools::IsSubDirectory(result, currentBinary)) + { + result = currentBinary; + } + } + + // The current working directory on Windows cannot be a network + // path. Therefore relative paths cannot work when the binary tree + // is a network path. + if(result.size() < 2 || result.substr(0, 2) != "//") + { + this->State->RelativePathTopBinary[this->Position] = result; + } + else + { + this->State->RelativePathTopBinary[this->Position] = ""; + } +} + cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) { PositionType pos = this->ParentPositions.size(); this->ParentPositions.push_back(originSnapshot.Position); this->Locations.resize(this->Locations.size() + 1); this->OutputLocations.resize(this->OutputLocations.size() + 1); + this->CurrentSourceDirectoryComponents.resize( + this->CurrentSourceDirectoryComponents.size() + 1); + this->CurrentBinaryDirectoryComponents.resize( + this->CurrentBinaryDirectoryComponents.size() + 1); + this->RelativePathTopSource.resize(this->RelativePathTopSource.size() + 1); + this->RelativePathTopBinary.resize(this->RelativePathTopBinary.size() + 1); return cmState::Snapshot(this, pos); } @@ -505,6 +613,11 @@ void cmState::Snapshot::SetCurrentSourceDirectory(std::string const& dir) this->State->Locations[this->Position]); this->State->Locations[this->Position] = cmSystemTools::CollapseFullPath(this->State->Locations[this->Position]); + + cmSystemTools::SplitPath( + this->State->Locations[this->Position], + this->State->CurrentSourceDirectoryComponents[this->Position]); + this->ComputeRelativePathTopSource(); } const char* cmState::Snapshot::GetCurrentBinaryDirectory() const @@ -521,6 +634,43 @@ void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir) this->State->OutputLocations[this->Position] = cmSystemTools::CollapseFullPath( this->State->OutputLocations[this->Position]); + + cmSystemTools::SplitPath( + this->State->OutputLocations[this->Position], + this->State->CurrentBinaryDirectoryComponents[this->Position]); + this->ComputeRelativePathTopBinary(); +} + +std::vector<std::string> const& +cmState::Snapshot::GetCurrentSourceDirectoryComponents() +{ + return this->State->CurrentSourceDirectoryComponents[this->Position]; +} + +std::vector<std::string> const& +cmState::Snapshot::GetCurrentBinaryDirectoryComponents() +{ + return this->State->CurrentBinaryDirectoryComponents[this->Position]; +} + +const char* cmState::Snapshot::GetRelativePathTopSource() const +{ + return this->State->RelativePathTopSource[this->Position].c_str(); +} + +const char* cmState::Snapshot::GetRelativePathTopBinary() const +{ + return this->State->RelativePathTopBinary[this->Position].c_str(); +} + +void cmState::Snapshot::SetRelativePathTopSource(const char* dir) +{ + this->State->RelativePathTopSource[this->Position] = dir; +} + +void cmState::Snapshot::SetRelativePathTopBinary(const char* dir) +{ + this->State->RelativePathTopBinary[this->Position] = dir; } bool cmState::Snapshot::IsValid() const diff --git a/Source/cmState.h b/Source/cmState.h index ed58c64..23d3f0d 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -36,10 +36,22 @@ public: const char* GetCurrentBinaryDirectory() const; void SetCurrentBinaryDirectory(std::string const& dir); + std::vector<std::string> const& GetCurrentSourceDirectoryComponents(); + std::vector<std::string> const& GetCurrentBinaryDirectoryComponents(); + + const char* GetRelativePathTopSource() const; + const char* GetRelativePathTopBinary() const; + void SetRelativePathTopSource(const char* dir); + void SetRelativePathTopBinary(const char* dir); + bool IsValid() const; Snapshot GetParent() const; private: + void ComputeRelativePathTopSource(); + void ComputeRelativePathTopBinary(); + + private: friend class cmState; cmState* State; cmState::PositionType Position; @@ -123,6 +135,9 @@ public: const char* GetBinaryDirectory() const; void SetBinaryDirectory(std::string const& binaryDirectory); + std::vector<std::string> const& GetSourceDirectoryComponents() const; + std::vector<std::string> const& GetBinaryDirectoryComponents() const; + private: std::map<cmProperty::ScopeType, cmPropertyDefinitionMap> PropertyDefinitions; std::vector<std::string> EnabledLanguages; @@ -132,6 +147,19 @@ private: std::vector<std::string> Locations; std::vector<std::string> OutputLocations; std::vector<PositionType> ParentPositions; + + std::vector<std::vector<std::string> > CurrentSourceDirectoryComponents; + std::vector<std::vector<std::string> > CurrentBinaryDirectoryComponents; + // The top-most directories for relative path conversion. Both the + // source and destination location of a relative path conversion + // must be underneath one of these directories (both under source or + // both under binary) in order for the relative path to be evaluated + // safely by the build tools. + std::vector<std::string> RelativePathTopSource; + std::vector<std::string> RelativePathTopBinary; + + std::vector<std::string> SourceDirectoryComponents; + std::vector<std::string> BinaryDirectoryComponents; std::string SourceDirectory; std::string BinaryDirectory; bool IsInTryCompile; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 8a8c163..8feb7a5 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1239,8 +1239,11 @@ bool cmTarget::PushTLLCommandTrace(TLLSignature signature) ret = false; } } - cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - this->TLLCommands.push_back(std::make_pair(signature, lfbt)); + cmListFileContext lfc = this->Makefile->GetExecutionContext(); + if (this->TLLCommands.empty() || this->TLLCommands.back().second != lfc) + { + this->TLLCommands.push_back(std::make_pair(signature, lfc)); + } return ret; } @@ -1248,39 +1251,19 @@ bool cmTarget::PushTLLCommandTrace(TLLSignature signature) void cmTarget::GetTllSignatureTraces(std::ostringstream &s, TLLSignature sig) const { - std::vector<cmListFileBacktrace> sigs; - typedef std::vector<std::pair<TLLSignature, cmListFileBacktrace> > Container; + const char *sigString = (sig == cmTarget::KeywordTLLSignature ? "keyword" + : "plain"); + s << "The uses of the " << sigString << " signature are here:\n"; + typedef std::vector<std::pair<TLLSignature, cmListFileContext> > Container; + cmLocalGenerator* lg = this->GetMakefile()->GetLocalGenerator(); for(Container::const_iterator it = this->TLLCommands.begin(); it != this->TLLCommands.end(); ++it) { if (it->first == sig) { - sigs.push_back(it->second); - } - } - if (!sigs.empty()) - { - const char *sigString - = (sig == cmTarget::KeywordTLLSignature ? "keyword" - : "plain"); - s << "The uses of the " << sigString << " signature are here:\n"; - UNORDERED_SET<std::string> emitted; - for(std::vector<cmListFileBacktrace>::iterator it = sigs.begin(); - it != sigs.end(); ++it) - { - it->MakeRelative(); - cmListFileBacktrace::const_iterator i = it->begin(); - if(i != it->end()) - { - cmListFileContext const& lfc = *i; - std::ostringstream line; - line << " * " << (lfc.Line? "": " in ") << lfc << std::endl; - if (emitted.insert(line.str()).second) - { - s << line.str(); - } - ++i; - } + cmListFileContext lfc = it->second; + lfc.FilePath = lg->Convert(lfc.FilePath, cmLocalGenerator::HOME); + s << " * " << lfc << std::endl; } } } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index f43c87c..1a8b75a 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -645,7 +645,7 @@ private: // directories. std::set<std::string> SystemIncludeDirectories; - std::vector<std::pair<TLLSignature, cmListFileBacktrace> > TLLCommands; + std::vector<std::pair<TLLSignature, cmListFileContext> > TLLCommands; #if defined(_WIN32) && !defined(__CYGWIN__) /** diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 131a134..5673982 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -47,13 +47,13 @@ cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetClFlagTable() const { if(this->MSTools) { - cmLocalVisualStudioGenerator::VSVersion + cmGlobalVisualStudioGenerator::VSVersion v = this->LocalGenerator->GetVersion(); - if(v >= cmLocalVisualStudioGenerator::VS14) + if(v >= cmGlobalVisualStudioGenerator::VS14) { return cmVS14CLFlagTable; } - else if(v >= cmLocalVisualStudioGenerator::VS12) + else if(v >= cmGlobalVisualStudioGenerator::VS12) { return cmVS12CLFlagTable; } - else if(v == cmLocalVisualStudioGenerator::VS11) + else if(v == cmGlobalVisualStudioGenerator::VS11) { return cmVS11CLFlagTable; } else { return cmVS10CLFlagTable; } @@ -65,13 +65,13 @@ cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetRcFlagTable() const { if(this->MSTools) { - cmLocalVisualStudioGenerator::VSVersion + cmGlobalVisualStudioGenerator::VSVersion v = this->LocalGenerator->GetVersion(); - if(v >= cmLocalVisualStudioGenerator::VS14) + if(v >= cmGlobalVisualStudioGenerator::VS14) { return cmVS14RCFlagTable; } - else if(v >= cmLocalVisualStudioGenerator::VS12) + else if(v >= cmGlobalVisualStudioGenerator::VS12) { return cmVS12RCFlagTable; } - else if(v == cmLocalVisualStudioGenerator::VS11) + else if(v == cmGlobalVisualStudioGenerator::VS11) { return cmVS11RCFlagTable; } else { return cmVS10RCFlagTable; } @@ -83,13 +83,13 @@ cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetLibFlagTable() const { if(this->MSTools) { - cmLocalVisualStudioGenerator::VSVersion + cmGlobalVisualStudioGenerator::VSVersion v = this->LocalGenerator->GetVersion(); - if(v >= cmLocalVisualStudioGenerator::VS14) + if(v >= cmGlobalVisualStudioGenerator::VS14) { return cmVS14LibFlagTable; } - else if(v >= cmLocalVisualStudioGenerator::VS12) + else if(v >= cmGlobalVisualStudioGenerator::VS12) { return cmVS12LibFlagTable; } - else if(v == cmLocalVisualStudioGenerator::VS11) + else if(v == cmGlobalVisualStudioGenerator::VS11) { return cmVS11LibFlagTable; } else { return cmVS10LibFlagTable; } @@ -101,13 +101,13 @@ cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetLinkFlagTable() const { if(this->MSTools) { - cmLocalVisualStudioGenerator::VSVersion + cmGlobalVisualStudioGenerator::VSVersion v = this->LocalGenerator->GetVersion(); - if(v >= cmLocalVisualStudioGenerator::VS14) + if(v >= cmGlobalVisualStudioGenerator::VS14) { return cmVS14LinkFlagTable; } - else if(v >= cmLocalVisualStudioGenerator::VS12) + else if(v >= cmGlobalVisualStudioGenerator::VS12) { return cmVS12LinkFlagTable; } - else if(v == cmLocalVisualStudioGenerator::VS11) + else if(v == cmGlobalVisualStudioGenerator::VS11) { return cmVS11LinkFlagTable; } else { return cmVS10LinkFlagTable; } @@ -119,13 +119,13 @@ cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetMasmFlagTable() const { if(this->MSTools) { - cmLocalVisualStudioGenerator::VSVersion + cmGlobalVisualStudioGenerator::VSVersion v = this->LocalGenerator->GetVersion(); - if(v >= cmLocalVisualStudioGenerator::VS14) + if(v >= cmGlobalVisualStudioGenerator::VS14) { return cmVS14MASMFlagTable; } - else if(v >= cmLocalVisualStudioGenerator::VS12) + else if(v >= cmGlobalVisualStudioGenerator::VS12) { return cmVS12MASMFlagTable; } - else if(v == cmLocalVisualStudioGenerator::VS11) + else if(v == cmGlobalVisualStudioGenerator::VS11) { return cmVS11MASMFlagTable; } else { return cmVS10MASMFlagTable; } @@ -911,7 +911,8 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile const* source, sep = ";"; } (*this->BuildFileStream ) << "</Outputs>\n"; - if(this->LocalGenerator->GetVersion() > cmLocalVisualStudioGenerator::VS10) + if(this->LocalGenerator->GetVersion() + > cmGlobalVisualStudioGenerator::VS10) { // VS >= 11 let us turn off linking of custom command outputs. this->WritePlatformConfigTag("LinkObjects", i->c_str(), 3); @@ -1416,7 +1417,7 @@ void cmVisualStudio10TargetGenerator::WriteSource( // conversion uses full paths when possible to allow deeper trees. bool forceRelative = false; std::string sourceFile = this->ConvertPath(sf->GetFullPath(), false); - if(this->LocalGenerator->GetVersion() == cmLocalVisualStudioGenerator::VS10 + if(this->LocalGenerator->GetVersion() == cmGlobalVisualStudioGenerator::VS10 && cmSystemTools::FileIsFullPath(sourceFile.c_str())) { // Normal path conversion resulted in a full path. VS 10 (but not 11) @@ -1544,7 +1545,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() ++si; } } - if(this->LocalGenerator->GetVersion() > cmLocalVisualStudioGenerator::VS10) + if(this->LocalGenerator->GetVersion() > cmGlobalVisualStudioGenerator::VS10) { // For VS >= 11 we use LinkObjects to avoid linking custom command // outputs. Use Object for all external objects, generated or not. diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 00386f6..6512fc2 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -96,14 +96,14 @@ void cmVisualStudioGeneratorOptions::FixExceptionHandlingDefault() // remove the flag we need to override the IDE default of on. switch (this->Version) { - case cmLocalVisualStudioGenerator::VS7: - case cmLocalVisualStudioGenerator::VS71: + case cmGlobalVisualStudioGenerator::VS7: + case cmGlobalVisualStudioGenerator::VS71: this->FlagMap["ExceptionHandling"] = "FALSE"; break; - case cmLocalVisualStudioGenerator::VS10: - case cmLocalVisualStudioGenerator::VS11: - case cmLocalVisualStudioGenerator::VS12: - case cmLocalVisualStudioGenerator::VS14: + case cmGlobalVisualStudioGenerator::VS10: + case cmGlobalVisualStudioGenerator::VS11: + case cmGlobalVisualStudioGenerator::VS12: + case cmGlobalVisualStudioGenerator::VS14: // by default VS puts <ExceptionHandling></ExceptionHandling> empty // for a project, to make our projects look the same put a new line // and space over for the closing </ExceptionHandling> as the default @@ -132,7 +132,7 @@ void cmVisualStudioGeneratorOptions::SetVerboseMakefile(bool verbose) this->FlagMap.find("SuppressStartupBanner") == this->FlagMap.end()) { this->FlagMap["SuppressStartupBanner"] = - this->Version < cmLocalVisualStudioGenerator::VS10 ? "FALSE" : ""; + this->Version < cmGlobalVisualStudioGenerator::VS10 ? "FALSE" : ""; } } @@ -270,7 +270,7 @@ cmVisualStudioGeneratorOptions { return; } - if(this->Version >= cmLocalVisualStudioGenerator::VS10) + if(this->Version >= cmGlobalVisualStudioGenerator::VS10) { // if there are configuration specific flags, then // use the configuration specific tag for PreprocessorDefinitions @@ -298,7 +298,7 @@ cmVisualStudioGeneratorOptions { // Escape the definition for the compiler. std::string define; - if(this->Version < cmLocalVisualStudioGenerator::VS10) + if(this->Version < cmGlobalVisualStudioGenerator::VS10) { define = this->LocalGenerator->EscapeForShell(di->c_str(), true); @@ -308,7 +308,7 @@ cmVisualStudioGeneratorOptions define = *di; } // Escape this flag for the IDE. - if(this->Version >= cmLocalVisualStudioGenerator::VS10) + if(this->Version >= cmGlobalVisualStudioGenerator::VS10) { define = cmVisualStudio10GeneratorOptionsEscapeForXML(define); @@ -325,7 +325,7 @@ cmVisualStudioGeneratorOptions fout << sep << define; sep = ";"; } - if(this->Version >= cmLocalVisualStudioGenerator::VS10) + if(this->Version >= cmGlobalVisualStudioGenerator::VS10) { fout << ";%(PreprocessorDefinitions)</PreprocessorDefinitions>" << suffix; } @@ -340,7 +340,7 @@ void cmVisualStudioGeneratorOptions ::OutputFlagMap(std::ostream& fout, const char* indent) { - if(this->Version >= cmLocalVisualStudioGenerator::VS10) + if(this->Version >= cmGlobalVisualStudioGenerator::VS10) { for(std::map<std::string, FlagValue>::iterator m = this->FlagMap.begin(); m != this->FlagMap.end(); ++m) @@ -395,7 +395,7 @@ cmVisualStudioGeneratorOptions { if(!this->FlagString.empty()) { - if(this->Version >= cmLocalVisualStudioGenerator::VS10) + if(this->Version >= cmGlobalVisualStudioGenerator::VS10) { fout << prefix; if(this->Configuration.size()) diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h index 5490a43..0179134 100644 --- a/Source/cmVisualStudioGeneratorOptions.h +++ b/Source/cmVisualStudioGeneratorOptions.h @@ -73,7 +73,7 @@ public: void SetConfiguration(const char* config); private: cmLocalVisualStudioGenerator* LocalGenerator; - cmLocalVisualStudioGenerator::VSVersion Version; + cmGlobalVisualStudioGenerator::VSVersion Version; std::string Configuration; Tool CurrentTool; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 5c5c428..b2c603f 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -376,7 +376,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args, std::string homeOutputDir = this->GetHomeOutputDirectory(); this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory()); this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory()); - cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lg(gg->MakeLocalGenerator()); lg->GetMakefile()->SetCurrentBinaryDirectory (cmSystemTools::GetCurrentWorkingDirectory()); lg->GetMakefile()->SetCurrentSourceDirectory @@ -418,7 +418,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args) this->SetGlobalGenerator(gg); // read in the list file to fill the cache - cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lg(gg->MakeLocalGenerator()); cmMakefile* mf = lg->GetMakefile(); mf->SetCurrentBinaryDirectory (cmSystemTools::GetCurrentWorkingDirectory()); @@ -1925,9 +1925,11 @@ int cmake::CheckBuildSystem() // Read the rerun check file and use it to decide whether to do the // global generate. cmake cm; + cm.SetHomeDirectory(""); + cm.SetHomeOutputDirectory(""); cmGlobalGenerator gg; gg.SetCMakeInstance(&cm); - cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator()); cmMakefile* mf = lg->GetMakefile(); if(!mf->ReadListFile(this->CheckBuildSystemArgument.c_str()) || cmSystemTools::GetErrorOccuredFlag()) @@ -1957,7 +1959,7 @@ int cmake::CheckBuildSystem() ggd(this->CreateGlobalGenerator(genName)); if(ggd.get()) { - cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->MakeLocalGenerator()); lgd->ClearDependencies(mf, verbose); } } @@ -2485,13 +2487,7 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text, } // Add the immediate context. - cmListFileBacktrace::const_iterator i = backtrace.begin(); - if(i != backtrace.end()) - { - cmListFileContext const& lfc = *i; - msg << (lfc.Line? " at ": " in ") << lfc; - ++i; - } + backtrace.PrintTitle(msg); // Add the message text. { @@ -2502,16 +2498,7 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text, } // Add the rest of the context. - if(i != backtrace.end()) - { - msg << "Call Stack (most recent call first):\n"; - while(i != backtrace.end()) - { - cmListFileContext const& lfc = *i; - msg << " " << lfc << "\n"; - ++i; - } - } + backtrace.PrintCallStack(msg); // Add a note about warning suppression. if(t == cmake::AUTHOR_WARNING) @@ -2580,6 +2567,9 @@ int cmake::Build(const std::string& dir, const std::vector<std::string>& nativeOptions, bool clean) { + + this->SetHomeDirectory(""); + this->SetHomeOutputDirectory(""); if(!cmSystemTools::FileIsDirectory(dir)) { std::cerr << "Error: " << dir << " is not a directory\n"; diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index d82087f..577dcd9 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -214,6 +214,8 @@ int do_cmake(int ac, char const* const* av) { // Construct and print requested documentation. cmake hcm; + hcm.SetHomeDirectory(""); + hcm.SetHomeOutputDirectory(""); hcm.AddCMakePaths(); // the command line args are processed here so that you can do @@ -317,10 +319,14 @@ int do_cmake(int ac, char const* const* av) if (sysinfo) { cmake cm; + cm.SetHomeDirectory(""); + cm.SetHomeOutputDirectory(""); int ret = cm.GetSystemInformation(args); return ret; } cmake cm; + cm.SetHomeDirectory(""); + cm.SetHomeOutputDirectory(""); cmSystemTools::SetMessageCallback(cmakemainMessageCallback, (void *)&cm); cm.SetProgressCallback(cmakemainProgressCallback, (void *)&cm); cm.SetWorkingMode(workingMode); diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 12bb8ee..3400625 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -646,7 +646,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) if(cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen)) { cm.SetGlobalGenerator(ggd); - cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->MakeLocalGenerator()); lgd->GetMakefile()->SetCurrentSourceDirectory(startDir); lgd->GetMakefile()->SetCurrentBinaryDirectory(startOutDir); diff --git a/Source/ctest.cxx b/Source/ctest.cxx index 0fc47b7..e784759 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -160,6 +160,8 @@ int main (int argc, char const* const* argv) if(doc.CheckOptions(argc, argv)) { cmake hcm; + hcm.SetHomeDirectory(""); + hcm.SetHomeOutputDirectory(""); hcm.AddCMakePaths(); // Construct and print requested documentation. |