diff options
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r-- | Source/cmake.cxx | 403 |
1 files changed, 141 insertions, 262 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index f069481..d5bc3d2 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -10,7 +10,6 @@ See the License for more information. ============================================================================*/ #include "cmake.h" -#include "cmCacheManager.h" #include "cmMakefile.h" #include "cmLocalGenerator.h" #include "cmExternalMakefileProjectGenerator.h" @@ -128,12 +127,14 @@ cmake::cmake() this->WarnUnused = false; this->WarnUnusedCli = true; this->CheckSystemVars = false; + this->SuppressDevWarnings = false; + this->DoSuppressDevWarnings = false; this->DebugOutput = false; this->DebugTryCompile = false; this->ClearBuildSystem = false; this->FileComparison = new cmFileTimeComparison; - this->State = new cmState(this); + this->State = new cmState; this->CurrentSnapshot = this->State->CreateBaseSnapshot(); #ifdef __APPLE__ @@ -149,7 +150,6 @@ cmake::cmake() #endif this->Verbose = false; - this->CacheManager = new cmCacheManager(this); this->GlobalGenerator = 0; this->ProgressCallback = 0; this->ProgressCallbackClientData = 0; @@ -165,11 +165,34 @@ cmake::cmake() // Make sure we can capture the build tool output. cmSystemTools::EnableVSConsoleOutput(); + + // Set up a list of source and header extensions + // these are used to find files when the extension + // is not given + // The "c" extension MUST precede the "C" extension. + this->SourceFileExtensions.push_back( "c" ); + this->SourceFileExtensions.push_back( "C" ); + + this->SourceFileExtensions.push_back( "c++" ); + this->SourceFileExtensions.push_back( "cc" ); + this->SourceFileExtensions.push_back( "cpp" ); + this->SourceFileExtensions.push_back( "cxx" ); + this->SourceFileExtensions.push_back( "m" ); + this->SourceFileExtensions.push_back( "M" ); + this->SourceFileExtensions.push_back( "mm" ); + + this->HeaderFileExtensions.push_back( "h" ); + this->HeaderFileExtensions.push_back( "hh" ); + this->HeaderFileExtensions.push_back( "h++" ); + this->HeaderFileExtensions.push_back( "hm" ); + this->HeaderFileExtensions.push_back( "hpp" ); + this->HeaderFileExtensions.push_back( "hxx" ); + this->HeaderFileExtensions.push_back( "in" ); + this->HeaderFileExtensions.push_back( "txx" ); } cmake::~cmake() { - delete this->CacheManager; delete this->State; if (this->GlobalGenerator) { @@ -187,6 +210,7 @@ void cmake::CleanupCommandsAndMacros() { this->CurrentSnapshot = this->State->Reset(); this->State->RemoveUserDefinedCommands(); + this->CurrentSnapshot.SetDefaultDefinitions(); } // Parse the args @@ -214,7 +238,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) } std::string var, value; cmState::CacheEntryType type = cmState::UNINITIALIZED; - if(cmCacheManager::ParseEntry(entry, var, value, type)) + if(cmState::ParseCacheEntry(entry, var, value, type)) { // The value is transformed if it is a filepath for example, so // we can't compare whether the value is already in the cache until @@ -230,7 +254,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) } } - this->State->AddCacheEntry(var, value.c_str(), + this->AddCacheEntry(var, value.c_str(), "No help, variable specified on the command line.", type); if(this->WarnUnusedCli) @@ -250,70 +274,15 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) return false; } } - else if(cmHasLiteralPrefix(arg, "-W")) + else if(arg.find("-Wno-dev",0) == 0) { - std::string entry = arg.substr(2); - if (entry.empty()) - { - ++i; - if (i < args.size()) - { - entry = args[i]; - } - else - { - cmSystemTools::Error( - "-W must be followed with [no-][error=]<name>."); - return false; - } + this->SuppressDevWarnings = true; + this->DoSuppressDevWarnings = true; } - - std::string name; - bool foundNo = false; - bool foundError = false; - unsigned int nameStartPosition = 0; - - if (entry.find("no-", nameStartPosition) == 0) - { - foundNo = true; - nameStartPosition += 3; - } - - if (entry.find("error=", nameStartPosition) == 0) - { - foundError = true; - nameStartPosition += 6; - } - - name = entry.substr(nameStartPosition); - if (name.empty()) - { - cmSystemTools::Error("No warning name provided."); - return false; - } - - if (!foundNo && !foundError) - { - // -W<name> - this->WarningLevels[name] = std::max(this->WarningLevels[name], - WARNING_LEVEL); - } - else if (foundNo && !foundError) - { - // -Wno<name> - this->WarningLevels[name] = IGNORE_LEVEL; - } - else if (!foundNo && foundError) - { - // -Werror=<name> - this->WarningLevels[name] = ERROR_LEVEL; - } - else - { - // -Wno-error=<name> - this->WarningLevels[name] = std::min(this->WarningLevels[name], - WARNING_LEVEL); - } + else if(arg.find("-Wdev",0) == 0) + { + this->SuppressDevWarnings = false; + this->DoSuppressDevWarnings = true; } else if(arg.find("-U",0) == 0) { @@ -430,21 +399,21 @@ void cmake::ReadListFile(const std::vector<std::string>& args, this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory()); this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory()); cmState::Snapshot snapshot = this->GetCurrentSnapshot(); - cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(gg, snapshot)); - cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator(mf.get())); - lg->GetMakefile()->SetCurrentBinaryDirectory + snapshot.GetDirectory().SetCurrentBinary (cmSystemTools::GetCurrentWorkingDirectory()); - lg->GetMakefile()->SetCurrentSourceDirectory + snapshot.GetDirectory().SetCurrentSource (cmSystemTools::GetCurrentWorkingDirectory()); + snapshot.SetDefaultDefinitions(); + cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(gg, snapshot)); if (this->GetWorkingMode() != NORMAL_MODE) { std::string file(cmSystemTools::CollapseFullPath(path)); cmSystemTools::ConvertToUnixSlashes(file); - lg->GetMakefile()->SetScriptModeFile(file.c_str()); + mf->SetScriptModeFile(file.c_str()); - lg->GetMakefile()->SetArgcArgv(args); + mf->SetArgcArgv(args); } - if (!lg->GetMakefile()->ReadListFile(path)) + if (!mf->ReadListFile(path)) { cmSystemTools::Error("Error processing file: ", path); } @@ -472,13 +441,14 @@ bool cmake::FindPackage(const std::vector<std::string>& args) this->SetGlobalGenerator(gg); cmState::Snapshot snapshot = this->GetCurrentSnapshot(); - // read in the list file to fill the cache - cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(gg, snapshot)); - cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator(mf.get())); - mf->SetCurrentBinaryDirectory + snapshot.GetDirectory().SetCurrentBinary (cmSystemTools::GetCurrentWorkingDirectory()); - mf->SetCurrentSourceDirectory + snapshot.GetDirectory().SetCurrentSource (cmSystemTools::GetCurrentWorkingDirectory()); + // read in the list file to fill the cache + snapshot.SetDefaultDefinitions(); + cmMakefile* mf = new cmMakefile(gg, snapshot); + gg->AddMakefile(mf); mf->SetArgcArgv(args); @@ -511,6 +481,8 @@ bool cmake::FindPackage(const std::vector<std::string>& args) std::vector<std::string> includeDirs; cmSystemTools::ExpandListArgument(includes, includeDirs); + gg->CreateGenerationObjects(); + cmLocalGenerator* lg = gg->LocalGenerators[0]; std::string includeFlags = lg->GetIncludeFlags(includeDirs, 0, language); std::string definitions = mf->GetSafeDefinition("PACKAGE_DEFINITIONS"); @@ -531,7 +503,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args) ++libIt) { mf->AddLinkLibraryForTarget(targetName, *libIt, - cmTarget::GENERAL); + GENERAL_LibraryType); } @@ -540,8 +512,9 @@ bool cmake::FindPackage(const std::vector<std::string>& args) std::string linkPath; std::string flags; std::string linkFlags; - gg->CreateGeneratorTargets(cmGlobalGenerator::AllTargets, lg.get()); - cmGeneratorTarget *gtgt = gg->GetGeneratorTarget(tgt); + gg->CreateGenerationObjects(); + cmGeneratorTarget *gtgt = gg->FindGeneratorTarget(tgt->GetName()); + cmLocalGenerator* lg = gtgt->GetLocalGenerator(); lg->GetTargetFlags(linkLibs, frameworkPath, linkPath, flags, linkFlags, gtgt, false); linkLibs = frameworkPath + linkPath + linkLibs; @@ -645,7 +618,11 @@ void cmake::SetArgs(const std::vector<std::string>& args, // skip for now i++; } - else if(arg.find("-W",0) == 0) + else if(arg.find("-Wno-dev",0) == 0) + { + // skip for now + } + else if(arg.find("-Wdev",0) == 0) { // skip for now } @@ -898,14 +875,14 @@ void cmake::SetDirectoriesFromFile(const char* arg) int cmake::AddCMakePaths() { // Save the value in the cache - this->CacheManager->AddCacheEntry + this->AddCacheEntry ("CMAKE_COMMAND", cmSystemTools::GetCMakeCommand().c_str(), "Path to CMake executable.", cmState::INTERNAL); #ifdef CMAKE_BUILD_WITH_CMAKE - this->CacheManager->AddCacheEntry + this->AddCacheEntry ("CMAKE_CTEST_COMMAND", cmSystemTools::GetCTestCommand().c_str(), "Path to ctest program executable.", cmState::INTERNAL); - this->CacheManager->AddCacheEntry + this->AddCacheEntry ("CMAKE_CPACK_COMMAND", cmSystemTools::GetCPackCommand().c_str(), "Path to cpack program executable.", cmState::INTERNAL); #endif @@ -919,7 +896,7 @@ int cmake::AddCMakePaths() cmSystemTools::GetCMakeRoot().c_str()); return 0; } - this->CacheManager->AddCacheEntry + this->AddCacheEntry ("CMAKE_ROOT", cmSystemTools::GetCMakeRoot().c_str(), "Path to CMake installation.", cmState::INTERNAL); @@ -1033,6 +1010,10 @@ cmGlobalGenerator* cmake::CreateGlobalGenerator(const std::string& gname) void cmake::SetHomeDirectory(const std::string& dir) { this->State->SetSourceDirectory(dir); + if (this->CurrentSnapshot.IsValid()) + { + this->CurrentSnapshot.SetDefinition("CMAKE_SOURCE_DIR", dir); + } } const char* cmake::GetHomeDirectory() const @@ -1043,6 +1024,10 @@ const char* cmake::GetHomeDirectory() const void cmake::SetHomeOutputDirectory(const std::string& dir) { this->State->SetBinaryDirectory(dir); + if (this->CurrentSnapshot.IsValid()) + { + this->CurrentSnapshot.SetDefinition("CMAKE_BINARY_DIR", dir); + } } const char* cmake::GetHomeOutputDirectory() const @@ -1136,10 +1121,10 @@ int cmake::DoPreConfigureChecks() } // do a sanity check on some values - if(this->CacheManager->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY")) + if(this->State->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY")) { std::string cacheStart = - this->CacheManager->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY"); + this->State->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY"); cacheStart += "/CMakeLists.txt"; std::string currentStart = this->GetHomeDirectory(); currentStart += "/CMakeLists.txt"; @@ -1196,12 +1181,12 @@ int cmake::HandleDeleteCacheVariables(const std::string& var) save.value = *i; warning << *i << "\n"; const char* existingValue = - this->CacheManager->GetCacheEntryValue(save.key); + this->State->GetCacheEntryValue(save.key); if(existingValue) { - save.type = this->CacheManager->GetCacheEntryType(save.key); + save.type = this->State->GetCacheEntryType(save.key); if(const char* help = - this->CacheManager->GetCacheEntryProperty(save.key, "HELPSTRING")) + this->State->GetCacheEntryProperty(save.key, "HELPSTRING")) { save.help = help; } @@ -1210,7 +1195,7 @@ int cmake::HandleDeleteCacheVariables(const std::string& var) } // remove the cache - this->CacheManager->DeleteCache(this->GetHomeOutputDirectory()); + this->DeleteCache(this->GetHomeOutputDirectory()); // load the empty cache this->LoadCache(); // restore the changed compilers @@ -1232,121 +1217,25 @@ int cmake::HandleDeleteCacheVariables(const std::string& var) int cmake::Configure() { - WarningLevel warningLevel; - - if (this->WarningLevels.count("deprecated") == 1) - { - warningLevel = this->WarningLevels["deprecated"]; - if (warningLevel == IGNORE_LEVEL) - { - this->CacheManager-> - AddCacheEntry("CMAKE_WARN_DEPRECATED", "FALSE", - "Whether to issue deprecation warnings for" - " macros and functions.", - cmState::BOOL); - this->CacheManager-> - AddCacheEntry("CMAKE_ERROR_DEPRECATED", "FALSE", - "Whether to issue deprecation errors for macros" - " and functions.", - cmState::BOOL); - } - if (warningLevel == WARNING_LEVEL) - { - this->CacheManager-> - AddCacheEntry("CMAKE_WARN_DEPRECATED", "TRUE", - "Whether to issue deprecation warnings for" - " macros and functions.", - cmState::BOOL); - } - else if (warningLevel == ERROR_LEVEL) - { - this->CacheManager-> - AddCacheEntry("CMAKE_ERROR_DEPRECATED", "TRUE", - "Whether to issue deprecation errors for macros" - " and functions.", - cmState::BOOL); - } - } - - if (this->WarningLevels.count("dev") == 1) + if(this->DoSuppressDevWarnings) { - bool setDeprecatedVariables = false; - - const char* cachedWarnDeprecated = - this->State->GetCacheEntryValue("CMAKE_WARN_DEPRECATED"); - const char* cachedErrorDeprecated = - this->State->GetCacheEntryValue("CMAKE_ERROR_DEPRECATED"); - - // don't overwrite deprecated warning setting from a previous invocation - if (!cachedWarnDeprecated && !cachedErrorDeprecated) - { - setDeprecatedVariables = true; - } - - warningLevel = this->WarningLevels["dev"]; - if (warningLevel == IGNORE_LEVEL) + if(this->SuppressDevWarnings) { - this->CacheManager-> + this-> AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "TRUE", "Suppress Warnings that are meant for" " the author of the CMakeLists.txt files.", cmState::INTERNAL); - this->CacheManager-> - AddCacheEntry("CMAKE_ERROR_DEVELOPER_WARNINGS", "FALSE", - "Suppress errors that are meant for" - " the author of the CMakeLists.txt files.", - cmState::INTERNAL); - - if (setDeprecatedVariables) - { - this->CacheManager-> - AddCacheEntry("CMAKE_WARN_DEPRECATED", "FALSE", - "Whether to issue deprecation warnings for" - " macros and functions.", - cmState::BOOL); - this->CacheManager-> - AddCacheEntry("CMAKE_ERROR_DEPRECATED", "FALSE", - "Whether to issue deprecation errors for macros" - " and functions.", - cmState::BOOL); - } } - else if (warningLevel == WARNING_LEVEL) + else { - this->CacheManager-> + this-> AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "FALSE", "Suppress Warnings that are meant for" " the author of the CMakeLists.txt files.", cmState::INTERNAL); - - if (setDeprecatedVariables) - { - this->CacheManager-> - AddCacheEntry("CMAKE_WARN_DEPRECATED", "TRUE", - "Whether to issue deprecation warnings for" - " macros and functions.", - cmState::BOOL); - } - } - else if (warningLevel == ERROR_LEVEL) - { - this->CacheManager-> - AddCacheEntry("CMAKE_ERROR_DEVELOPER_WARNINGS", "TRUE", - "Suppress errors that are meant for" - " the author of the CMakeLists.txt files.", - cmState::INTERNAL); - - if (setDeprecatedVariables) - { - this->CacheManager-> - AddCacheEntry("CMAKE_ERROR_DEPRECATED", "TRUE", - "Whether to issue deprecation errors for macros" - " and functions.", - cmState::BOOL); - } } } - int ret = this->ActualConfigure(); const char* delCacheVars = this->State ->GetGlobalProperty("__CMAKE_DELETE_CACHE_CHANGE_VARS_"); @@ -1375,7 +1264,7 @@ int cmake::ActualConfigure() } if ( !res ) { - this->CacheManager->AddCacheEntry + this->AddCacheEntry ("CMAKE_HOME_DIRECTORY", this->GetHomeDirectory(), "Source directory with the top level CMakeLists.txt file for this " @@ -1387,9 +1276,9 @@ int cmake::ActualConfigure() if(!this->GlobalGenerator) { const char* genName = - this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR"); + this->State->GetInitializedCacheValue("CMAKE_GENERATOR"); const char* extraGenName = - this->CacheManager->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR"); + this->State->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR"); if(genName) { std::string fullName = cmExternalMakefileProjectGenerator:: @@ -1467,7 +1356,7 @@ int cmake::ActualConfigure() } } - const char* genName = this->CacheManager + const char* genName = this->State ->GetInitializedCacheValue("CMAKE_GENERATOR"); if(genName) { @@ -1484,20 +1373,20 @@ int cmake::ActualConfigure() return -2; } } - if(!this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR")) + if(!this->State->GetInitializedCacheValue("CMAKE_GENERATOR")) { - this->CacheManager->AddCacheEntry("CMAKE_GENERATOR", + this->AddCacheEntry("CMAKE_GENERATOR", this->GlobalGenerator->GetName().c_str(), "Name of generator.", cmState::INTERNAL); - this->CacheManager->AddCacheEntry("CMAKE_EXTRA_GENERATOR", + this->AddCacheEntry("CMAKE_EXTRA_GENERATOR", this->GlobalGenerator->GetExtraGeneratorName().c_str(), "Name of external makefile project generator.", cmState::INTERNAL); } if(const char* platformName = - this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR_PLATFORM")) + this->State->GetInitializedCacheValue("CMAKE_GENERATOR_PLATFORM")) { if(this->GeneratorPlatform.empty()) { @@ -1518,14 +1407,14 @@ int cmake::ActualConfigure() } else { - this->CacheManager->AddCacheEntry("CMAKE_GENERATOR_PLATFORM", + this->AddCacheEntry("CMAKE_GENERATOR_PLATFORM", this->GeneratorPlatform.c_str(), "Name of generator platform.", cmState::INTERNAL); } if(const char* tsName = - this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR_TOOLSET")) + this->State->GetInitializedCacheValue("CMAKE_GENERATOR_TOOLSET")) { if(this->GeneratorToolset.empty()) { @@ -1546,7 +1435,7 @@ int cmake::ActualConfigure() } else { - this->CacheManager->AddCacheEntry("CMAKE_GENERATOR_TOOLSET", + this->AddCacheEntry("CMAKE_GENERATOR_TOOLSET", this->GeneratorToolset.c_str(), "Name of generator toolset.", cmState::INTERNAL); @@ -1580,7 +1469,7 @@ int cmake::ActualConfigure() { if(!this->State->GetInitializedCacheValue("LIBRARY_OUTPUT_PATH")) { - this->State->AddCacheEntry + this->AddCacheEntry ("LIBRARY_OUTPUT_PATH", "", "Single output directory for building all libraries.", cmState::PATH); @@ -1588,7 +1477,7 @@ int cmake::ActualConfigure() if(!this->State ->GetInitializedCacheValue("EXECUTABLE_OUTPUT_PATH")) { - this->State->AddCacheEntry + this->AddCacheEntry ("EXECUTABLE_OUTPUT_PATH", "", "Single output directory for building all executables.", cmState::PATH); @@ -1608,7 +1497,7 @@ int cmake::ActualConfigure() // only save the cache if there were no fatal errors if ( this->GetWorkingMode() == NORMAL_MODE ) { - this->CacheManager->SaveCache(this->GetHomeOutputDirectory()); + this->SaveCache(this->GetHomeOutputDirectory()); } if(cmSystemTools::GetErrorOccuredFlag()) { @@ -1677,18 +1566,6 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure) { this->AddCMakePaths(); } - - // don't turn dev warnings into errors by default, if no value has been - // specified for the flag, disable it - if (!this->State->GetCacheEntryValue("CMAKE_ERROR_DEVELOPER_WARNINGS")) - { - this->CacheManager-> - AddCacheEntry("CMAKE_ERROR_DEVELOPER_WARNINGS", "FALSE", - "Suppress errors that are meant for" - " the author of the CMakeLists.txt files.", - cmState::INTERNAL); - } - // Add any cache args if ( !this->SetCacheArgs(args) ) { @@ -1790,7 +1667,7 @@ int cmake::Generate() // for the Visual Studio and Xcode generators.) if ( this->GetWorkingMode() == NORMAL_MODE ) { - this->CacheManager->SaveCache(this->GetHomeOutputDirectory()); + this->SaveCache(this->GetHomeOutputDirectory()); } return 0; } @@ -1799,14 +1676,15 @@ void cmake::AddCacheEntry(const std::string& key, const char* value, const char* helpString, int type) { - this->CacheManager->AddCacheEntry(key, value, + this->State->AddCacheEntry(key, value, helpString, cmState::CacheEntryType(type)); + this->UnwatchUnusedCli(key); } const char* cmake::GetCacheDefinition(const std::string& name) const { - return this->CacheManager->GetInitializedCacheValue(name); + return this->State->GetInitializedCacheValue(name); } void cmake::AddDefaultCommands() @@ -1879,7 +1757,7 @@ bool cmake::ParseCacheEntry(const std::string& entry, std::string& value, cmState::CacheEntryType& type) { - return cmCacheManager::ParseEntry(entry, var, value, type); + return cmState::ParseCacheEntry(entry, var, value, type); } int cmake::LoadCache() @@ -1910,24 +1788,43 @@ int cmake::LoadCache() bool cmake::LoadCache(const std::string& path) { - return this->CacheManager->LoadCache(path); + std::set<std::string> emptySet; + return this->LoadCache(path, true, emptySet, emptySet); } bool cmake::LoadCache(const std::string& path, bool internal, std::set<std::string>& excludes, std::set<std::string>& includes) { - return this->CacheManager->LoadCache(path, internal, excludes, includes); + bool result = this->State->LoadCache(path, internal, excludes, includes); + static const char* entries[] = {"CMAKE_CACHE_MAJOR_VERSION", + "CMAKE_CACHE_MINOR_VERSION"}; + for (const char* const* nameIt = cmArrayBegin(entries); + nameIt != cmArrayEnd(entries); ++nameIt) + { + this->UnwatchUnusedCli(*nameIt); + } + return result; } bool cmake::SaveCache(const std::string& path) { - return this->CacheManager->SaveCache(path); + bool result = this->State->SaveCache(path); + static const char* entries[] = {"CMAKE_CACHE_MAJOR_VERSION", + "CMAKE_CACHE_MINOR_VERSION", + "CMAKE_CACHE_PATCH_VERSION", + "CMAKE_CACHEFILE_DIR"}; + for (const char* const* nameIt = cmArrayBegin(entries); + nameIt != cmArrayEnd(entries); ++nameIt) + { + this->UnwatchUnusedCli(*nameIt); + } + return result; } bool cmake::DeleteCache(const std::string& path) { - return this->CacheManager->DeleteCache(path); + return this->State->DeleteCache(path); } void cmake::SetProgressCallback(ProgressCallbackType f, void *cd) @@ -1992,7 +1889,7 @@ void cmake::UpdateConversionPathTable() { // Update the path conversion table with any specified file: const char* tablepath = - this->CacheManager + this->State ->GetInitializedCacheValue("CMAKE_PATH_TRANSLATION_FILE"); if(tablepath) @@ -2061,9 +1958,9 @@ int cmake::CheckBuildSystem() cmake cm; cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); + cm.GetCurrentSnapshot().SetDefaultDefinitions(); cmGlobalGenerator gg(&cm); cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); - cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator(mf.get())); if(!mf->ReadListFile(this->CheckBuildSystemArgument.c_str()) || cmSystemTools::GetErrorOccuredFlag()) { @@ -2092,6 +1989,7 @@ int cmake::CheckBuildSystem() ggd(this->CreateGlobalGenerator(genName)); if(ggd.get()) { + cm.GetCurrentSnapshot().SetDefaultDefinitions(); cmsys::auto_ptr<cmMakefile> mfd(new cmMakefile(ggd.get(), cm.GetCurrentSnapshot())); cmsys::auto_ptr<cmLocalGenerator> lgd( @@ -2596,17 +2494,20 @@ bool cmake::PrintMessagePreamble(cmake::MessageType t, std::ostream& msg) { msg << "CMake Deprecation Warning"; } - else if (t == cmake::AUTHOR_WARNING) - { - msg << "CMake Warning (dev)"; - } - else if (t == cmake::AUTHOR_ERROR) - { - msg << "CMake Error (dev)"; - } else { msg << "CMake Warning"; + if(t == cmake::AUTHOR_WARNING) + { + // Allow suppression of these warnings. + const char* suppress = this->State->GetCacheEntryValue( + "CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); + if(suppress && cmSystemTools::IsOn(suppress)) + { + return false; + } + msg << " (dev)"; + } } return true; } @@ -2628,12 +2529,6 @@ void displayMessage(cmake::MessageType t, std::ostringstream& msg) msg << "This warning is for project developers. Use -Wno-dev to suppress it."; } - else if (t == cmake::AUTHOR_ERROR) - { - msg << - "This error is for project developers. Use -Wno-error=dev to suppress " - "it."; - } // Add a terminating blank line. msg << "\n"; @@ -2657,8 +2552,7 @@ void displayMessage(cmake::MessageType t, std::ostringstream& msg) // Output the message. if(t == cmake::FATAL_ERROR || t == cmake::INTERNAL_ERROR - || t == cmake::DEPRECATION_ERROR - || t == cmake::AUTHOR_ERROR) + || t == cmake::DEPRECATION_ERROR) { cmSystemTools::SetErrorOccured(); cmSystemTools::Message(msg.str().c_str(), "Error"); @@ -2855,18 +2749,3 @@ void cmake::RunCheckForUnusedVariables() } #endif } - -void cmake::SetSuppressDevWarnings(bool b) -{ - // equivalent to -Wno-dev - if (b) - { - this->WarningLevels["dev"] = IGNORE_LEVEL; - } - // equivalent to -Wdev - else - { - this->WarningLevels["dev"] = std::max(this->WarningLevels["dev"], - WARNING_LEVEL); - } -} |