diff options
Diffstat (limited to 'Source')
54 files changed, 521 insertions, 312 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index c847bc8..786e3eb 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -159,6 +159,8 @@ set(SRCS cmCacheManager.cxx cmCacheManager.h "${CMAKE_CURRENT_BINARY_DIR}/cmCommands.cxx" + cmCLocaleEnvironmentScope.h + cmCLocaleEnvironmentScope.cxx cmCommands.h cmCommandArgumentLexer.cxx cmCommandArgumentParser.cxx @@ -219,6 +221,8 @@ set(SRCS cmExportSet.cxx cmExportSetMap.h cmExportSetMap.cxx + cmExternalMakefileProjectGenerator.cxx + cmExternalMakefileProjectGenerator.h cmExtraCodeBlocksGenerator.cxx cmExtraCodeBlocksGenerator.h cmExtraCodeLiteGenerator.cxx @@ -244,6 +248,8 @@ set(SRCS cmGeneratorExpressionContext.h cmGeneratorExpressionDAGChecker.cxx cmGeneratorExpressionDAGChecker.h + cmGeneratorExpressionEvaluationFile.cxx + cmGeneratorExpressionEvaluationFile.h cmGeneratorExpressionEvaluator.cxx cmGeneratorExpressionEvaluator.h cmGeneratorExpressionLexer.cxx diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index eed106d..f91acbe 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 20150407) +set(CMake_VERSION_PATCH 20150413) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/cmCPack7zGenerator.cxx b/Source/CPack/cmCPack7zGenerator.cxx index ce31ad4..2809e56 100644 --- a/Source/CPack/cmCPack7zGenerator.cxx +++ b/Source/CPack/cmCPack7zGenerator.cxx @@ -15,7 +15,7 @@ //---------------------------------------------------------------------- cmCPack7zGenerator::cmCPack7zGenerator() :cmCPackArchiveGenerator(cmArchiveWrite::CompressNone, - cmArchiveWrite::Type7Zip) + "7zip") { } diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 05b5cd9..58bd947 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -27,10 +27,10 @@ //---------------------------------------------------------------------- cmCPackArchiveGenerator::cmCPackArchiveGenerator(cmArchiveWrite::Compress t, - cmArchiveWrite::Type at) + std::string const& format) { this->Compress = t; - this->Archive = at; + this->ArchiveFormat = format; } //---------------------------------------------------------------------- @@ -108,7 +108,7 @@ if (!GenerateHeader(&gf)) \ << ">." << std::endl); \ return 0; \ } \ -cmArchiveWrite archive(gf,this->Compress, this->Archive); \ +cmArchiveWrite archive(gf,this->Compress, this->ArchiveFormat); \ if (!archive) \ { \ cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem to create archive < " \ diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h index 6411b1e..16e7632 100644 --- a/Source/CPack/cmCPackArchiveGenerator.h +++ b/Source/CPack/cmCPackArchiveGenerator.h @@ -31,7 +31,7 @@ public: /** * Construct generator */ - cmCPackArchiveGenerator(cmArchiveWrite::Compress, cmArchiveWrite::Type); + cmCPackArchiveGenerator(cmArchiveWrite::Compress, std::string const& format); virtual ~cmCPackArchiveGenerator(); // Used to add a header to the archive virtual int GenerateHeader(std::ostream* os); @@ -68,7 +68,7 @@ protected: int PackageComponentsAllInOne(); virtual const char* GetOutputExtension() = 0; cmArchiveWrite::Compress Compress; - cmArchiveWrite::Type Archive; + std::string ArchiveFormat; }; #endif diff --git a/Source/CPack/cmCPackTGZGenerator.cxx b/Source/CPack/cmCPackTGZGenerator.cxx index 509c7f8..3fa2b64 100644 --- a/Source/CPack/cmCPackTGZGenerator.cxx +++ b/Source/CPack/cmCPackTGZGenerator.cxx @@ -15,7 +15,7 @@ //---------------------------------------------------------------------- cmCPackTGZGenerator::cmCPackTGZGenerator() :cmCPackArchiveGenerator(cmArchiveWrite::CompressGZip, - cmArchiveWrite::TypeTAR) + "paxr") { } diff --git a/Source/CPack/cmCPackTXZGenerator.cxx b/Source/CPack/cmCPackTXZGenerator.cxx index ecfc177..6d4ede1 100644 --- a/Source/CPack/cmCPackTXZGenerator.cxx +++ b/Source/CPack/cmCPackTXZGenerator.cxx @@ -15,7 +15,7 @@ //---------------------------------------------------------------------- cmCPackTXZGenerator::cmCPackTXZGenerator() :cmCPackArchiveGenerator(cmArchiveWrite::CompressXZ, - cmArchiveWrite::TypeTAR) + "paxr") { } diff --git a/Source/CPack/cmCPackTarBZip2Generator.cxx b/Source/CPack/cmCPackTarBZip2Generator.cxx index ae73c37..9ff588b 100644 --- a/Source/CPack/cmCPackTarBZip2Generator.cxx +++ b/Source/CPack/cmCPackTarBZip2Generator.cxx @@ -14,7 +14,7 @@ //---------------------------------------------------------------------- cmCPackTarBZip2Generator::cmCPackTarBZip2Generator() :cmCPackArchiveGenerator(cmArchiveWrite::CompressBZip2, - cmArchiveWrite::TypeTAR) + "paxr") { } diff --git a/Source/CPack/cmCPackTarCompressGenerator.cxx b/Source/CPack/cmCPackTarCompressGenerator.cxx index df29408..1c8311b 100644 --- a/Source/CPack/cmCPackTarCompressGenerator.cxx +++ b/Source/CPack/cmCPackTarCompressGenerator.cxx @@ -15,7 +15,7 @@ //---------------------------------------------------------------------- cmCPackTarCompressGenerator::cmCPackTarCompressGenerator() :cmCPackArchiveGenerator(cmArchiveWrite::CompressCompress, - cmArchiveWrite::TypeTAR) + "paxr") { } diff --git a/Source/CPack/cmCPackZIPGenerator.cxx b/Source/CPack/cmCPackZIPGenerator.cxx index e6e4e77..7ef7729 100644 --- a/Source/CPack/cmCPackZIPGenerator.cxx +++ b/Source/CPack/cmCPackZIPGenerator.cxx @@ -15,7 +15,7 @@ //---------------------------------------------------------------------- cmCPackZIPGenerator::cmCPackZIPGenerator() :cmCPackArchiveGenerator(cmArchiveWrite::CompressNone, - cmArchiveWrite::TypeZIP) + "zip") { } diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index b9da8a0..10927e7 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -21,6 +21,7 @@ #include "cmGeneratedFileStream.h" #include "cmXMLParser.h" #include "cmXMLSafe.h" +#include "cmCLocaleEnvironmentScope.h" #include "cmCTestVC.h" #include "cmCTestCVS.h" @@ -66,46 +67,6 @@ static const char* cmCTestUpdateHandlerUpdateToString(int type) return cmCTestUpdateHandlerUpdateStrings[type]; } -class cmCTestUpdateHandlerLocale -{ -public: - cmCTestUpdateHandlerLocale(); - ~cmCTestUpdateHandlerLocale(); -private: - std::string saveLCAll; -}; - -cmCTestUpdateHandlerLocale::cmCTestUpdateHandlerLocale() -{ - const char* lcall = cmSystemTools::GetEnv("LC_ALL"); - if(lcall) - { - saveLCAll = lcall; - } - // if LC_ALL is not set to C, then - // set it, so that svn/cvs info will be in english ascii - if(! (lcall && strcmp(lcall, "C") == 0)) - { - cmSystemTools::PutEnv("LC_ALL=C"); - } -} - -cmCTestUpdateHandlerLocale::~cmCTestUpdateHandlerLocale() -{ - // restore the value of LC_ALL after running the version control - // commands - if(!saveLCAll.empty()) - { - std::string put = "LC_ALL="; - put += saveLCAll; - cmSystemTools::PutEnv(put); - } - else - { - cmSystemTools::UnsetEnv("LC_ALL"); - } -} - //---------------------------------------------------------------------- cmCTestUpdateHandler::cmCTestUpdateHandler() { @@ -194,7 +155,7 @@ int cmCTestUpdateHandler::DetermineType(const char* cmd, const char* type) int cmCTestUpdateHandler::ProcessHandler() { // Make sure VCS tool messages are in English so we can parse them. - cmCTestUpdateHandlerLocale fixLocale; + cmCLocaleEnvironmentScope fixLocale; static_cast<void>(fixLocale); // Get source dir diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx index cf2fe82..72818f5 100644 --- a/Source/cmArchiveWrite.cxx +++ b/Source/cmArchiveWrite.cxx @@ -79,11 +79,12 @@ struct cmArchiveWrite::Callback }; //---------------------------------------------------------------------------- -cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c, Type t): - Stream(os), - Archive(archive_write_new()), - Disk(archive_read_disk_new()), - Verbose(false) +cmArchiveWrite::cmArchiveWrite( + std::ostream& os, Compress c, std::string const& format): + Stream(os), + Archive(archive_write_new()), + Disk(archive_read_disk_new()), + Verbose(false) { switch (c) { @@ -141,35 +142,16 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c, Type t): { this->Error = "archive_read_disk_set_standard_lookup: "; this->Error += cm_archive_error_string(this->Archive); - return;; + return; } #endif - switch (t) + + if(archive_write_set_format_by_name(this->Archive, format.c_str()) + != ARCHIVE_OK) { - case TypeZIP: - if(archive_write_set_format_zip(this->Archive) != ARCHIVE_OK) - { - this->Error = "archive_write_set_format_zip: "; - this->Error += cm_archive_error_string(this->Archive); - return; - } - break; - case TypeTAR: - if(archive_write_set_format_pax_restricted(this->Archive) != ARCHIVE_OK) - { - this->Error = "archive_write_set_format_pax_restricted: "; - this->Error += cm_archive_error_string(this->Archive); - return; - } - break; - case Type7Zip: - if(archive_write_set_format_7zip(this->Archive) != ARCHIVE_OK) - { - this->Error = "archive_write_set_format_7zip: "; - this->Error += cm_archive_error_string(this->Archive); - return; - } - break; + this->Error = "archive_write_set_format_by_name: "; + this->Error += cm_archive_error_string(this->Archive); + return; } // do not pad the last block!! diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h index 17357b4..794cb28 100644 --- a/Source/cmArchiveWrite.h +++ b/Source/cmArchiveWrite.h @@ -38,16 +38,10 @@ public: CompressXZ }; - /** Archive Type */ - enum Type - { - TypeTAR, - TypeZIP, - Type7Zip - }; - /** Construct with output stream to which to write archive. */ - cmArchiveWrite(std::ostream& os, Compress c = CompressNone, Type = TypeTAR); + cmArchiveWrite(std::ostream& os, Compress c = CompressNone, + std::string const& format = "paxr"); + ~cmArchiveWrite(); /** diff --git a/Source/cmBootstrapCommands1.cxx b/Source/cmBootstrapCommands1.cxx index 4274d85..1184514 100644 --- a/Source/cmBootstrapCommands1.cxx +++ b/Source/cmBootstrapCommands1.cxx @@ -42,7 +42,6 @@ #include "cmEndWhileCommand.cxx" #include "cmExecProgramCommand.cxx" #include "cmExecuteProcessCommand.cxx" -#include "cmExternalMakefileProjectGenerator.cxx" #include "cmFindBase.cxx" #include "cmFindCommon.cxx" #include "cmFileCommand.cxx" @@ -56,7 +55,7 @@ #include "cmPathLabel.cxx" #include "cmSearchPath.cxx" -void GetBootstrapCommands1(std::list<cmCommand*>& commands) +void GetBootstrapCommands1(std::vector<cmCommand*>& commands) { commands.push_back(new cmAddCustomCommandCommand); commands.push_back(new cmAddCustomTargetCommand); diff --git a/Source/cmBootstrapCommands2.cxx b/Source/cmBootstrapCommands2.cxx index 5675295..e522d8c 100644 --- a/Source/cmBootstrapCommands2.cxx +++ b/Source/cmBootstrapCommands2.cxx @@ -16,7 +16,6 @@ #include "cmCommands.h" #include "cmConditionEvaluator.cxx" #include "cmExpandedCommandArgument.cxx" -#include "cmGeneratorExpressionEvaluationFile.cxx" #include "cmGetCMakePropertyCommand.cxx" #include "cmGetDirectoryPropertyCommand.cxx" #include "cmGetFilenameComponentCommand.cxx" @@ -60,7 +59,7 @@ #include "cmUnsetCommand.cxx" #include "cmWhileCommand.cxx" -void GetBootstrapCommands2(std::list<cmCommand*>& commands) +void GetBootstrapCommands2(std::vector<cmCommand*>& commands) { commands.push_back(new cmGetCMakePropertyCommand); commands.push_back(new cmGetDirectoryPropertyCommand); diff --git a/Source/cmCLocaleEnvironmentScope.cxx b/Source/cmCLocaleEnvironmentScope.cxx new file mode 100644 index 0000000..5792302 --- /dev/null +++ b/Source/cmCLocaleEnvironmentScope.cxx @@ -0,0 +1,67 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#include "cmCLocaleEnvironmentScope.h" + +#include "cmSystemTools.h" + +#include <sstream> + +cmCLocaleEnvironmentScope::cmCLocaleEnvironmentScope() +{ + this->SetEnv("LANGUAGE", ""); + this->SetEnv("LC_MESSAGES", "C"); + + std::string lcAll = this->GetEnv("LC_ALL"); + + if(!lcAll.empty()) + { + this->SetEnv("LC_ALL", ""); + this->SetEnv("LC_CTYPE", lcAll); + } +} + +std::string cmCLocaleEnvironmentScope::GetEnv(std::string const& key) +{ + const char* value = cmSystemTools::GetEnv(key); + return value ? value : std::string(); +} + +void cmCLocaleEnvironmentScope::SetEnv( + std::string const& key, std::string const& value) +{ + std::string oldValue = this->GetEnv(key); + + this->EnvironmentBackup.insert(std::make_pair(key, oldValue)); + + if(value.empty()) + { + cmSystemTools::UnsetEnv(key.c_str()); + } + else + { + std::stringstream tmp; + tmp << key << "=" << value; + cmSystemTools::PutEnv(tmp.str()); + } +} + +cmCLocaleEnvironmentScope::~cmCLocaleEnvironmentScope() +{ + for(backup_map_t::const_iterator i = this->EnvironmentBackup.begin(); + i != this->EnvironmentBackup.end(); ++i) + { + std::stringstream tmp; + tmp << i->first << "=" << i->second; + cmSystemTools::PutEnv(tmp.str()); + } +} diff --git a/Source/cmCLocaleEnvironmentScope.h b/Source/cmCLocaleEnvironmentScope.h new file mode 100644 index 0000000..b011741 --- /dev/null +++ b/Source/cmCLocaleEnvironmentScope.h @@ -0,0 +1,32 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#ifndef cmCLocaleEnvironmentScope_h +#define cmCLocaleEnvironmentScope_h + +#include "cmStandardIncludes.h" + +class cmCLocaleEnvironmentScope +{ +public: + cmCLocaleEnvironmentScope(); + ~cmCLocaleEnvironmentScope(); + +private: + std::string GetEnv(std::string const& key); + void SetEnv(std::string const& key, std::string const& value); + + typedef std::map<std::string, std::string> backup_map_t; + backup_map_t EnvironmentBackup; +}; + +#endif diff --git a/Source/cmCommands.cxx.in b/Source/cmCommands.cxx.in index f0745d7..e23bbd1 100644 --- a/Source/cmCommands.cxx.in +++ b/Source/cmCommands.cxx.in @@ -13,7 +13,7 @@ @COMMAND_INCLUDES@ -void GetPredefinedCommands(std::list<cmCommand*>& commands) +void GetPredefinedCommands(std::vector<cmCommand*>& commands) { @NEW_COMMANDS@ } diff --git a/Source/cmCommands.h b/Source/cmCommands.h index e902853..7a94423 100644 --- a/Source/cmCommands.h +++ b/Source/cmCommands.h @@ -13,7 +13,7 @@ #define cmCommands_h #include "cmStandardIncludes.h" -#include <list> +#include <vector> class cmCommand; /** @@ -23,9 +23,9 @@ class cmCommand; * It is up to the caller to delete the commands created by this * call. */ -void GetBootstrapCommands1(std::list<cmCommand*>& commands); -void GetBootstrapCommands2(std::list<cmCommand*>& commands); -void GetPredefinedCommands(std::list<cmCommand*>& commands); +void GetBootstrapCommands1(std::vector<cmCommand*>& commands); +void GetBootstrapCommands2(std::vector<cmCommand*>& commands); +void GetPredefinedCommands(std::vector<cmCommand*>& commands); #endif diff --git a/Source/cmCommandsForBootstrap.cxx b/Source/cmCommandsForBootstrap.cxx index 15b664e..5f397a1 100644 --- a/Source/cmCommandsForBootstrap.cxx +++ b/Source/cmCommandsForBootstrap.cxx @@ -11,6 +11,6 @@ ============================================================================*/ #include "cmCommands.h" -void GetPredefinedCommands(std::list<cmCommand*>&) +void GetPredefinedCommands(std::vector<cmCommand*>&) { } diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index b0e0f36..8880667 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -411,6 +411,10 @@ cmComputeLinkInformation std::vector<std::string> const& dirs = this->Target->GetLinkDirectories(); this->OldLinkDirMask.insert(dirs.begin(), dirs.end()); } + + this->CMP0060Warn = + this->Makefile->PolicyOptionalWarningEnabled( + "CMAKE_POLICY_WARNING_CMP0060"); } //---------------------------------------------------------------------------- @@ -548,6 +552,22 @@ bool cmComputeLinkInformation::Compute() // Add implicit language runtime libraries and directories. this->AddImplicitLinkInfo(); + if (!this->CMP0060WarnItems.empty()) + { + std::ostringstream w; + w << (this->Makefile->GetCMakeInstance()->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0060)) << "\n" + "Some library files are in directories implicitly searched by " + "the linker when invoked for " << this->LinkLanguage << ":\n" + " " << cmJoin(this->CMP0060WarnItems, "\n ") << "\n" + "For compatibility with older versions of CMake, the generated " + "link line will ask the linker to search for these by library " + "name." + ; + this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(), + this->Target->GetBacktrace()); + } + return true; } @@ -1190,6 +1210,28 @@ bool cmComputeLinkInformation::CheckImplicitDirItem(std::string const& item) return false; } + // Check the policy for whether we should use the approach below. + switch (this->Target->GetPolicyStatusCMP0060()) + { + case cmPolicies::WARN: + if (this->CMP0060Warn) + { + // Print the warning at most once for this item. + std::string const& wid = "CMP0060-WARNING-GIVEN-" + item; + if (!this->CMakeInstance->GetPropertyAsBool(wid)) + { + this->CMakeInstance->SetProperty(wid, "1"); + this->CMP0060WarnItems.insert(item); + } + } + case cmPolicies::OLD: + break; + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::NEW: + return false; + } + // Many system linkers support multiple architectures by // automatically selecting the implicit linker search path for the // current architecture. If the library appears in an implicit link diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index e5d674a..8847141 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -175,6 +175,10 @@ private: std::vector<std::string> OldUserFlagItems; bool OldLinkDirMode; + // CMP0060 warnings. + bool CMP0060Warn; + std::set<std::string> CMP0060WarnItems; + // Runtime path computation. cmOrderDirectories* OrderRuntimeSearchPath; void AddLibraryRuntimeInfo(std::string const& fullPath, diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 8c17536..4f34755 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -138,6 +138,8 @@ bool cmDocumentation::PrintDocumentation(Type ht, std::ostream& os) return this->PrintHelpListVariables(os); case cmDocumentation::ListPolicies: return this->PrintHelpListPolicies(os); + case cmDocumentation::ListGenerators: + return this->PrintHelpListGenerators(os); case cmDocumentation::Version: return this->PrintVersion(os); case cmDocumentation::OldCustomModules: @@ -817,6 +819,19 @@ bool cmDocumentation::PrintHelpListPolicies(std::ostream& os) } //---------------------------------------------------------------------------- +bool cmDocumentation::PrintHelpListGenerators(std::ostream& os) +{ + std::map<std::string,cmDocumentationSection*>::iterator si; + si = this->AllSections.find("Generators"); + if(si != this->AllSections.end()) + { + this->Formatter.SetIndent(" "); + this->Formatter.PrintSection(os, *si->second); + } + return true; +} + +//---------------------------------------------------------------------------- bool cmDocumentation::PrintHelpOneVariable(std::ostream& os) { std::string vname = cmSystemTools::HelpFileName(this->CurrentArgument); diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index b72b5fe..8854c36 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -117,6 +117,7 @@ private: bool PrintHelpListProperties(std::ostream& os); bool PrintHelpListVariables(std::ostream& os); bool PrintHelpListPolicies(std::ostream& os); + bool PrintHelpListGenerators(std::ostream& os); bool PrintOldCustomModules(std::ostream& os); const char* GetNameString() const; diff --git a/Source/cmDocumentationFormatter.cxx b/Source/cmDocumentationFormatter.cxx index 4de59c0..6869e2f 100644 --- a/Source/cmDocumentationFormatter.cxx +++ b/Source/cmDocumentationFormatter.cxx @@ -204,7 +204,7 @@ void cmDocumentationFormatter if(!op->Name.empty()) { os << " " << op->Name; - this->TextIndent = " "; + this->TextIndent = " "; int align = static_cast<int>(strlen(this->TextIndent))-4; for(int i = static_cast<int>(op->Name.size()); i < align; ++i) { diff --git a/Source/cmDocumentationFormatter.h b/Source/cmDocumentationFormatter.h index 59513cc..6e19b7d 100644 --- a/Source/cmDocumentationFormatter.h +++ b/Source/cmDocumentationFormatter.h @@ -26,8 +26,8 @@ public: /** Types of help provided. */ enum Type { - None, Version, Usage, Help, Full, ListManuals, - ListCommands, ListModules, ListProperties, ListVariables, ListPolicies, + None, Version, Usage, Help, Full, ListManuals, ListCommands, + ListModules, ListProperties, ListVariables, ListPolicies, ListGenerators, OneManual, OneCommand, OneModule, OneProperty, OneVariable, OnePolicy, OldCustomModules }; diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 93e3ac4..6ac0def 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -15,6 +15,8 @@ #include "cmHexFileConverter.h" #include "cmInstallType.h" #include "cmFileTimeComparison.h" +#include "cmLocalGenerator.h" +#include "cmGlobalGenerator.h" #include "cmCryptoHash.h" #include "cmAlgorithms.h" diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 4a93446..171d62a 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -969,7 +969,13 @@ void cmGlobalGenerator::SetLanguageEnabled(const std::string& l, void cmGlobalGenerator::SetLanguageEnabledFlag(const std::string& l, cmMakefile* mf) { - this->LanguageEnabled[l] = true; + std::vector<std::string>::iterator it = + std::lower_bound(this->LanguageEnabled.begin(), + this->LanguageEnabled.end(), l); + if (it == this->LanguageEnabled.end() || *it != l) + { + this->LanguageEnabled.insert(it, l); + } // Fill the language-to-extension map with the current variable // settings to make sure it is available for the try_compile() @@ -1080,7 +1086,8 @@ bool cmGlobalGenerator::IgnoreFile(const char* ext) const bool cmGlobalGenerator::GetLanguageEnabled(const std::string& l) const { - return (this->LanguageEnabled.find(l)!= this->LanguageEnabled.end()); + return std::binary_search(this->LanguageEnabled.begin(), + this->LanguageEnabled.end(), l); } void cmGlobalGenerator::ClearEnabledLanguages() @@ -1959,11 +1966,7 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root, void cmGlobalGenerator::GetEnabledLanguages(std::vector<std::string>& lang) const { - for(std::map<std::string, bool>::const_iterator i = - this->LanguageEnabled.begin(); i != this->LanguageEnabled.end(); ++i) - { - lang.push_back(i->first); - } + lang = this->LanguageEnabled; } int cmGlobalGenerator::GetLinkerPreference(const std::string& lang) const diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 5b9ddee..ce3f037 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -441,7 +441,7 @@ private: // If you add a new map here, make sure it is copied // in EnableLanguagesFromGenerator std::map<std::string, bool> IgnoreExtensions; - std::map<std::string, bool> LanguageEnabled; + std::vector<std::string> LanguageEnabled; std::set<std::string> LanguagesReady; // Ready for try_compile std::map<std::string, std::string> OutputExtensions; std::map<std::string, std::string> LanguageToOutputExtension; diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 18d40e1..1c6ac88 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -71,8 +71,11 @@ public: virtual void GetDocumentation(cmDocumentationEntry& entry) const { - entry.Name = vs10generatorName; - entry.Brief = "Generates Visual Studio 10 (VS 2010) project files."; + entry.Name = std::string(vs10generatorName) + " [arch]"; + entry.Brief = + "Generates Visual Studio 2010 project files. " + "Optional [arch] can be \"Win64\" or \"IA64\"." + ; } virtual void GetGenerators(std::vector<std::string>& names) const diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index ed828b6..5d3ae16 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -78,8 +78,11 @@ public: virtual void GetDocumentation(cmDocumentationEntry& entry) const { - entry.Name = vs11generatorName; - entry.Brief = "Generates Visual Studio 11 (VS 2012) project files."; + entry.Name = std::string(vs11generatorName) + " [arch]"; + entry.Brief = + "Generates Visual Studio 2012 project files. " + "Optional [arch] can be \"Win64\" or \"ARM\"." + ; } virtual void GetGenerators(std::vector<std::string>& names) const diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index c2e6f47..e70e082 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -66,8 +66,11 @@ public: virtual void GetDocumentation(cmDocumentationEntry& entry) const { - entry.Name = vs12generatorName; - entry.Brief = "Generates Visual Studio 12 (VS 2013) project files."; + entry.Name = std::string(vs12generatorName) + " [arch]"; + entry.Brief = + "Generates Visual Studio 2013 project files. " + "Optional [arch] can be \"Win64\" or \"ARM\"." + ; } virtual void GetGenerators(std::vector<std::string>& names) const diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index b551c65..7b1dd24 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -66,8 +66,11 @@ public: virtual void GetDocumentation(cmDocumentationEntry& entry) const { - entry.Name = vs14generatorName; - entry.Brief = "Generates Visual Studio 14 (VS 2015) project files."; + entry.Name = std::string(vs14generatorName) + " [arch]"; + entry.Brief = + "Generates Visual Studio 2015 project files. " + "Optional [arch] can be \"Win64\" or \"ARM\"." + ; } virtual void GetGenerators(std::vector<std::string>& names) const diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index e6ce45d..726db0f 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -66,8 +66,11 @@ public: } virtual void GetDocumentation(cmDocumentationEntry& entry) const { - entry.Name = vs8generatorName; - entry.Brief = "Generates Visual Studio 8 2005 project files."; + entry.Name = std::string(vs8generatorName) + " [arch]"; + entry.Brief = + "Generates Visual Studio 2005 project files. " + "Optional [arch] can be \"Win64\"." + ; } virtual void GetGenerators(std::vector<std::string>& names) const { diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index 1d73b5c..1bc627f 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -70,8 +70,11 @@ public: } virtual void GetDocumentation(cmDocumentationEntry& entry) const { - entry.Name = vs9generatorName; - entry.Brief = "Generates Visual Studio 9 2008 project files."; + entry.Name = std::string(vs9generatorName) + " [arch]"; + entry.Brief = + "Generates Visual Studio 2008 project files. " + "Optional [arch] can be \"Win64\" or \"IA64\"." + ; } virtual void GetGenerators(std::vector<std::string>& names) const { diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index e1998e4..c143bce 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -252,7 +252,6 @@ void cmLocalGenerator::SetGlobalGenerator(cmGlobalGenerator *gg) this->Makefile->SetLocalGenerator(this); // setup the home directories - this->Makefile->GetProperties().SetCMakeInstance(gg->GetCMakeInstance()); this->Makefile->SetHomeDirectory( gg->GetCMakeInstance()->GetHomeDirectory()); this->Makefile->SetHomeOutputDirectory( diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 6aa5224..ad3cce4 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -741,6 +741,7 @@ void cmMakefile::SetLocalGenerator(cmLocalGenerator* lg) this->AddSourceGroup("Object Files", "\\.(lo|o|obj)$"); #endif + this->Properties.SetCMakeInstance(this->GetCMakeInstance()); this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused(); this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars(); } @@ -1657,7 +1658,6 @@ void cmMakefile::InitializeFromParent() void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2) { - // copy our variables from the child makefile lg2->GetMakefile()->InitializeFromParent(); lg2->GetMakefile()->MakeStartDirectoriesCurrent(); if (this->GetCMakeInstance()->GetDebugOutput()) @@ -1676,33 +1676,6 @@ void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2) } } -void cmMakefile::AddSubDirectory(const std::string& sub, - bool excludeFromAll) -{ - // the source path must be made full if it isn't already - std::string srcPath = sub; - if (!cmSystemTools::FileIsFullPath(srcPath.c_str())) - { - srcPath = this->GetCurrentDirectory(); - srcPath += "/"; - srcPath += sub; - } - - // binary path must be made full if it isn't already - std::string binPath = sub; - if (!cmSystemTools::FileIsFullPath(binPath.c_str())) - { - binPath = this->GetCurrentOutputDirectory(); - binPath += "/"; - binPath += sub; - } - - - this->AddSubDirectory(srcPath, binPath, - excludeFromAll, false); -} - - void cmMakefile::AddSubDirectory(const std::string& srcPath, const std::string& binPath, bool excludeFromAll, @@ -3462,6 +3435,11 @@ cmMakefile::LexicalPushPop::~LexicalPushPop() this->Makefile->PopFunctionBlockerBarrier(this->ReportError); } +const char* cmMakefile::GetHomeDirectory() const +{ + return this->cmHomeDirectory.c_str(); +} + void cmMakefile::SetHomeDirectory(const std::string& dir) { this->cmHomeDirectory = dir; @@ -3473,6 +3451,11 @@ void cmMakefile::SetHomeDirectory(const std::string& dir) } } +const char* cmMakefile::GetHomeOutputDirectory() const +{ + return this->HomeOutputDirectory.c_str(); +} + void cmMakefile::SetHomeOutputDirectory(const std::string& lib) { this->HomeOutputDirectory = lib; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index da92ad7..57a4180 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -281,7 +281,6 @@ public: /** * Add a subdirectory to the build. */ - void AddSubDirectory(const std::string&, bool excludeFromAll=false); void AddSubDirectory(const std::string& fullSrcDir, const std::string& fullBinDir, bool excludeFromAll, @@ -438,15 +437,9 @@ public: * and going up until it reaches the HomeDirectory. */ void SetHomeDirectory(const std::string& dir); - const char* GetHomeDirectory() const - { - return this->cmHomeDirectory.c_str(); - } + const char* GetHomeDirectory() const; void SetHomeOutputDirectory(const std::string& lib); - const char* GetHomeOutputDirectory() const - { - return this->HomeOutputDirectory.c_str(); - } + const char* GetHomeOutputDirectory() const; //@} /** diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 2cd2d3e..bd9c579 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -778,7 +778,7 @@ cmMakefileTargetGenerator // Write the rule. this->WriteMakeRule(*this->BuildFileStream, 0, outputs, - depends, commands, false); + depends, commands); bool do_preprocess_rules = lang_has_preprocessor && this->LocalGenerator->GetCreatePreprocessedSourceRules(); @@ -1000,18 +1000,30 @@ void cmMakefileTargetGenerator::WriteTargetCleanRules() } //---------------------------------------------------------------------------- -void cmMakefileTargetGenerator::WriteMakeRule( +bool cmMakefileTargetGenerator::WriteMakeRule( std::ostream& os, const char* comment, const std::vector<std::string>& outputs, const std::vector<std::string>& depends, const std::vector<std::string>& commands, - bool symbolic, bool in_help) { + bool symbolic = false; if (outputs.size() == 0) { - return; + return symbolic; + } + + // Check whether we need to bother checking for a symbolic output. + bool need_symbolic = this->GlobalGenerator->GetNeedSymbolicMark(); + + // Check whether the first output is marked as symbolic. + if(need_symbolic) + { + if(cmSourceFile* sf = this->Makefile->GetSource(outputs[0])) + { + symbolic = sf->GetPropertyAsBool("SYMBOLIC"); + } } // We always attach the actual commands to the first output. @@ -1021,7 +1033,7 @@ void cmMakefileTargetGenerator::WriteMakeRule( // For single outputs, we are done. if (outputs.size() == 1) { - return; + return symbolic; } // For multiple outputs, make the extra ones depend on the first one. @@ -1034,14 +1046,25 @@ void cmMakefileTargetGenerator::WriteMakeRule( std::string const out = this->Convert(*o, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::SHELL); std::vector<std::string> output_commands; - if (!symbolic) + + bool o_symbolic = false; + if(need_symbolic) + { + if(cmSourceFile* sf = this->Makefile->GetSource(*o)) + { + o_symbolic = sf->GetPropertyAsBool("SYMBOLIC"); + } + } + symbolic = symbolic && o_symbolic; + + if (!o_symbolic) { output_commands.push_back("@$(CMAKE_COMMAND) -E touch_nocreate " + out); } this->LocalGenerator->WriteMakeRule(os, 0, *o, output_depends, - output_commands, symbolic, in_help); + output_commands, o_symbolic, in_help); - if (!symbolic) + if (!o_symbolic) { // At build time, remove the first output if this one does not exist // so that "make" will rerun the real commands that create this one. @@ -1049,6 +1072,7 @@ void cmMakefileTargetGenerator::WriteMakeRule( this->MultipleOutputPairs.insert(p); } } + return symbolic; } //---------------------------------------------------------------------------- @@ -1269,30 +1293,16 @@ void cmMakefileTargetGenerator std::vector<std::string> depends; this->LocalGenerator->AppendCustomDepend(depends, ccg); - // Check whether we need to bother checking for a symbolic output. - bool need_symbolic = this->GlobalGenerator->GetNeedSymbolicMark(); - // Write the rule. const std::vector<std::string>& outputs = ccg.GetOutputs(); - std::vector<std::string>::const_iterator o = outputs.begin(); - { - bool symbolic = false; - if(need_symbolic) - { - if(cmSourceFile* sf = this->Makefile->GetSource(*o)) - { - symbolic = sf->GetPropertyAsBool("SYMBOLIC"); - } - } - this->WriteMakeRule(*this->BuildFileStream, 0, outputs, - depends, commands, symbolic); + bool symbolic = this->WriteMakeRule(*this->BuildFileStream, 0, + outputs, depends, commands); // If the rule has changed make sure the output is rebuilt. if(!symbolic) { this->GlobalGenerator->AddRuleHash(ccg.GetOutputs(), content.str()); } - } // Setup implicit dependency scanning. for(cmCustomCommand::ImplicitDependsList::const_iterator diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 98017be..58044e8 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -224,12 +224,11 @@ protected: typedef std::map<std::string, std::string> MultipleOutputPairsType; MultipleOutputPairsType MultipleOutputPairs; - void WriteMakeRule(std::ostream& os, + bool WriteMakeRule(std::ostream& os, const char* comment, const std::vector<std::string>& outputs, const std::vector<std::string>& depends, const std::vector<std::string>& commands, - bool symbolic, bool in_help = false); // Target name info. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 0a61bca..e7678cb 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -390,6 +390,11 @@ cmPolicies::cmPolicies() CMP0059, "CMP0059", "Do no treat DEFINITIONS as a built-in directory property.", 3,3,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0060, "CMP0060", + "Link libraries by full path even in implicit directories.", + 3,3,0, cmPolicies::WARN); } cmPolicies::~cmPolicies() diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index ced9d8c..1d108c1 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -118,6 +118,7 @@ public: CMP0058, ///< Ninja requires custom command byproducts to be explicit CMP0059, ///< Do not treat ``DEFINITIONS`` as a built-in directory /// property. + CMP0060, ///< Link libraries by full path even in implicit directories. /** \brief Always the last entry. * diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 5264123..95d05a6 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1475,7 +1475,8 @@ bool cmSystemTools::IsPathToFramework(const char* path) bool cmSystemTools::CreateTar(const char* outFileName, const std::vector<std::string>& files, cmTarCompression compressType, - bool verbose, std::string const& mtime) + bool verbose, std::string const& mtime, + std::string const& format) { #if defined(CMAKE_BUILD_WITH_CMAKE) std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); @@ -1505,8 +1506,10 @@ bool cmSystemTools::CreateTar(const char* outFileName, compress = cmArchiveWrite::CompressNone; break; } + cmArchiveWrite a(fout, compress, - cmArchiveWrite::TypeTAR); + format.empty() ? "paxr" : format); + a.SetMTime(mtime); a.SetVerbose(verbose); for(std::vector<std::string>::const_iterator i = files.begin(); diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index c59ae96..433ef46 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -395,7 +395,8 @@ public: static bool CreateTar(const char* outFileName, const std::vector<std::string>& files, cmTarCompression compressType, bool verbose, - std::string const& mtime = std::string()); + std::string const& mtime = std::string(), + std::string const& format = std::string()); static bool ExtractTar(const char* inFileName, bool verbose); // This should be called first thing in main // it will keep child processes from inheriting the diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 1702a7d..6711e86 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -442,6 +442,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) if(this->TargetTypeValue == cmTarget::EXECUTABLE) { this->SetPropertyDefault("ANDROID_GUI", 0); + this->SetPropertyDefault("CROSSCOMPILING_EMULATOR", 0); } if(this->TargetTypeValue == cmTarget::SHARED_LIBRARY || this->TargetTypeValue == cmTarget::MODULE_LIBRARY) @@ -1156,7 +1157,7 @@ cmTarget::LinkLibraryType cmTarget::ComputeLinkType( } // Get the list of configurations considered to be DEBUG. - std::vector<std::string> const& debugConfigs = + std::vector<std::string> debugConfigs = this->Makefile->GetCMakeInstance()->GetDebugConfigs(); // Check if any entry in the list matches this configuration. @@ -1215,7 +1216,7 @@ std::string cmTarget::GetDebugGeneratorExpressions(const std::string &value, } // Get the list of configurations considered to be DEBUG. - std::vector<std::string> const& debugConfigs = + std::vector<std::string> debugConfigs = this->Makefile->GetCMakeInstance()->GetDebugConfigs(); std::string configString = "$<CONFIG:" + debugConfigs[0] + ">"; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index a4ef977..55bf234 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -34,7 +34,8 @@ F(CMP0041) \ F(CMP0042) \ F(CMP0046) \ - F(CMP0052) + F(CMP0052) \ + F(CMP0060) class cmake; class cmMakefile; diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 75c94c5..9be7d46 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -467,7 +467,7 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, } // Get the list of configurations considered to be DEBUG. - std::vector<std::string> const& debugConfigs = + std::vector<std::string> debugConfigs = this->Makefile->GetCMakeInstance()->GetDebugConfigs(); std::string prop; diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index f87a535..add80fa 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -82,11 +82,31 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, // be translated. std::string exe = command[0]; cmMakefile* mf = this->Test->GetMakefile(); + cmLocalGenerator* lg = mf->GetLocalGenerator(); cmTarget* target = mf->FindTargetToUse(exe); if(target && target->GetType() == cmTarget::EXECUTABLE) { // Use the target file on disk. exe = target->GetFullPath(config); + + // Prepend with the emulator when cross compiling if required. + const char * emulator = + target->GetProperty("CROSSCOMPILING_EMULATOR"); + if (emulator != 0) + { + std::vector<std::string> emulatorWithArgs; + cmSystemTools::ExpandListArgument(emulator, emulatorWithArgs); + std::string emulatorExe(emulatorWithArgs[0]); + cmSystemTools::ConvertToUnixSlashes(emulatorExe); + os << lg->EscapeForCMake(emulatorExe) << " "; + for(std::vector<std::string>::const_iterator ei = + emulatorWithArgs.begin()+1; + ei != emulatorWithArgs.end(); + ++ei) + { + os << lg->EscapeForCMake(*ei) << " "; + } + } } else { @@ -96,7 +116,6 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, } // Generate the command line with full escapes. - cmLocalGenerator* lg = mf->GetLocalGenerator(); os << lg->EscapeForCMake(exe); for(std::vector<std::string>::const_iterator ci = command.begin()+1; ci != command.end(); ++ci) diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index bcc4a83..c9e7a46 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -148,7 +148,8 @@ bool cmTryRunCommand { // "run" it and capture the output std::string runOutputContents; - if (this->Makefile->IsOn("CMAKE_CROSSCOMPILING")) + if (this->Makefile->IsOn("CMAKE_CROSSCOMPILING") && + !this->Makefile->IsDefinitionSet("CMAKE_CROSSCOMPILING_EMULATOR")) { this->DoNotRunExecutable(runArgs, argv[3], @@ -194,7 +195,28 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs, std::string* out) { int retVal = -1; - std::string finalCommand = cmSystemTools::ConvertToRunCommandPath( + + std::string finalCommand; + const std::string emulator = + this->Makefile->GetSafeDefinition("CMAKE_CROSSCOMPILING_EMULATOR"); + if (!emulator.empty()) + { + std::vector<std::string> emulatorWithArgs; + cmSystemTools::ExpandListArgument(emulator, emulatorWithArgs); + finalCommand += cmSystemTools::ConvertToRunCommandPath( + emulatorWithArgs[0].c_str()); + finalCommand += " "; + for (std::vector<std::string>::const_iterator ei = + emulatorWithArgs.begin()+1; + ei != emulatorWithArgs.end(); ++ei) + { + finalCommand += "\""; + finalCommand += *ei; + finalCommand += "\""; + finalCommand += " "; + } + } + finalCommand += cmSystemTools::ConvertToRunCommandPath( this->OutputFile.c_str()); if (!runArgs.empty()) { diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx index 3302a8d..5a90fd9 100644 --- a/Source/cmXCodeObject.cxx +++ b/Source/cmXCodeObject.cxx @@ -242,6 +242,7 @@ void cmXCodeObject::PrintString(std::ostream& os,std::string String) // considered special by the Xcode project file parser. bool needQuote = (String.empty() || + String.find("//") != String.npos || String.find_first_of(" <>.+-=@$[],") != String.npos); const char* quote = needQuote? "\"" : ""; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index b1eea98..8cdf96f 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -191,7 +191,6 @@ cmake::~cmake() void cmake::InitializeProperties() { this->Properties.clear(); - this->Properties.SetCMakeInstance(this); this->PropertyDefinitions.clear(); // initialize properties @@ -227,20 +226,19 @@ void cmake::CleanupCommandsAndMacros() bool cmake::CommandExists(const std::string& name) const { - std::string sName = cmSystemTools::LowerCase(name); - return (this->Commands.find(sName) != this->Commands.end()); + return this->GetCommand(name) ? true : false; } -cmCommand *cmake::GetCommand(const std::string& name) +cmCommand *cmake::GetCommand(const std::string& name) const { - cmCommand* rm = 0; + cmCommand* command = 0; std::string sName = cmSystemTools::LowerCase(name); - RegisteredCommandsMap::iterator pos = this->Commands.find(sName); + RegisteredCommandsMap::const_iterator pos = this->Commands.find(sName); if (pos != this->Commands.end()) { - rm = (*pos).second; + command = (*pos).second; } - return rm; + return command; } void cmake::RenameCommand(const std::string& oldName, @@ -248,12 +246,12 @@ void cmake::RenameCommand(const std::string& oldName, { // if the command already exists, free the old one std::string sOldName = cmSystemTools::LowerCase(oldName); - std::string sNewName = cmSystemTools::LowerCase(newName); RegisteredCommandsMap::iterator pos = this->Commands.find(sOldName); if ( pos == this->Commands.end() ) { return; } + std::string sNewName = cmSystemTools::LowerCase(newName); cmCommand* cmd = pos->second; pos = this->Commands.find(sNewName); @@ -262,7 +260,7 @@ void cmake::RenameCommand(const std::string& oldName, delete pos->second; this->Commands.erase(pos); } - this->Commands.insert(RegisteredCommandsMap::value_type(sNewName, cmd)); + this->Commands.insert(std::make_pair(sNewName, cmd)); pos = this->Commands.find(sOldName); this->Commands.erase(pos); } @@ -278,9 +276,9 @@ void cmake::RemoveCommand(const std::string& name) } } -void cmake::AddCommand(cmCommand* wg) +void cmake::AddCommand(cmCommand* command) { - std::string name = cmSystemTools::LowerCase(wg->GetName()); + std::string name = cmSystemTools::LowerCase(command->GetName()); // if the command already exists, free the old one RegisteredCommandsMap::iterator pos = this->Commands.find(name); if (pos != this->Commands.end()) @@ -288,16 +286,16 @@ void cmake::AddCommand(cmCommand* wg) delete pos->second; this->Commands.erase(pos); } - this->Commands.insert( RegisteredCommandsMap::value_type(name, wg)); + this->Commands.insert(std::make_pair(name, command)); } void cmake::RemoveUnscriptableCommands() { std::vector<std::string> unscriptableCommands; - cmake::RegisteredCommandsMap* commands = this->GetCommands(); - for (cmake::RegisteredCommandsMap::const_iterator pos = commands->begin(); - pos != commands->end(); + for (cmake::RegisteredCommandsMap::const_iterator + pos = this->Commands.begin(); + pos != this->Commands.end(); ++pos) { if (!pos->second->IsScriptable()) @@ -818,6 +816,7 @@ void cmake::SetArgs(const std::vector<std::string>& args, if(i >= args.size()) { cmSystemTools::Error("No generator specified for -G"); + this->PrintGeneratorList(); return; } value = args[i]; @@ -828,6 +827,7 @@ void cmake::SetArgs(const std::vector<std::string>& args, { cmSystemTools::Error("Could not create named generator ", value.c_str()); + this->PrintGeneratorList(); } else { @@ -845,12 +845,8 @@ void cmake::SetArgs(const std::vector<std::string>& args, { this->SetHomeOutputDirectory (cmSystemTools::GetCurrentWorkingDirectory()); - this->SetStartOutputDirectory - (cmSystemTools::GetCurrentWorkingDirectory()); this->SetHomeDirectory (cmSystemTools::GetCurrentWorkingDirectory()); - this->SetStartDirectory - (cmSystemTools::GetCurrentWorkingDirectory()); } this->SetStartDirectory(this->GetHomeDirectory()); @@ -1114,12 +1110,44 @@ void cmake::SetHomeDirectory(const std::string& dir) cmSystemTools::ConvertToUnixSlashes(this->cmHomeDirectory); } -void cmake::SetHomeOutputDirectory(const std::string& lib) +const char* cmake::GetHomeDirectory() const +{ + return this->cmHomeDirectory.c_str(); +} + +void cmake::SetHomeOutputDirectory(const std::string& dir) { - this->HomeOutputDirectory = lib; + this->HomeOutputDirectory = dir; cmSystemTools::ConvertToUnixSlashes(this->HomeOutputDirectory); } +const char* cmake::GetHomeOutputDirectory() const +{ + return this->HomeOutputDirectory.c_str(); +} + +const char* cmake::GetStartDirectory() const +{ + return this->cmStartDirectory.c_str(); +} + +void cmake::SetStartDirectory(const std::string& dir) +{ + this->cmStartDirectory = dir; + cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory); +} + +const char* cmake::GetStartOutputDirectory() const +{ + return this->StartOutputDirectory.c_str(); +} + +void cmake::SetStartOutputDirectory(const std::string& dir) +{ + this->StartOutputDirectory = dir; + cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory); +} + void cmake::SetGlobalGenerator(cmGlobalGenerator *gg) { if(!gg) @@ -1533,11 +1561,7 @@ int cmake::ActualConfigure() if (!this->InTryCompile) { this->GlobalGenerator->ClearEnabledLanguages(); - } - // Truncate log files - if (!this->InTryCompile) - { this->TruncateOutputLog("CMakeOutput.log"); this->TruncateOutputLog("CMakeError.log"); } @@ -1814,11 +1838,11 @@ const char* cmake::GetCacheDefinition(const std::string& name) const void cmake::AddDefaultCommands() { - std::list<cmCommand*> commands; + std::vector<cmCommand*> commands; GetBootstrapCommands1(commands); GetBootstrapCommands2(commands); GetPredefinedCommands(commands); - for(std::list<cmCommand*>::iterator i = commands.begin(); + for(std::vector<cmCommand*>::iterator i = commands.begin(); i != commands.end(); ++i) { this->AddCommand(*i); @@ -1830,23 +1854,23 @@ void cmake::AddDefaultGenerators() #if defined(_WIN32) && !defined(__CYGWIN__) # if !defined(CMAKE_BOOT_MINGW) this->Generators.push_back( - cmGlobalVisualStudio6Generator::NewFactory()); - this->Generators.push_back( - cmGlobalVisualStudio7Generator::NewFactory()); + cmGlobalVisualStudio14Generator::NewFactory()); this->Generators.push_back( - cmGlobalVisualStudio10Generator::NewFactory()); + cmGlobalVisualStudio12Generator::NewFactory()); this->Generators.push_back( cmGlobalVisualStudio11Generator::NewFactory()); this->Generators.push_back( - cmGlobalVisualStudio12Generator::NewFactory()); + cmGlobalVisualStudio10Generator::NewFactory()); this->Generators.push_back( - cmGlobalVisualStudio14Generator::NewFactory()); + cmGlobalVisualStudio9Generator::NewFactory()); + this->Generators.push_back( + cmGlobalVisualStudio8Generator::NewFactory()); this->Generators.push_back( cmGlobalVisualStudio71Generator::NewFactory()); this->Generators.push_back( - cmGlobalVisualStudio8Generator::NewFactory()); + cmGlobalVisualStudio7Generator::NewFactory()); this->Generators.push_back( - cmGlobalVisualStudio9Generator::NewFactory()); + cmGlobalVisualStudio6Generator::NewFactory()); this->Generators.push_back( cmGlobalBorlandMakefileGenerator::NewFactory()); this->Generators.push_back( @@ -1944,6 +1968,16 @@ void cmake::UpdateProgress(const char *msg, float prog) } } +bool cmake::GetIsInTryCompile() const +{ + return this->InTryCompile; +} + +void cmake::SetIsInTryCompile(bool b) +{ + this->InTryCompile = b; +} + void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v) { for(RegisteredGeneratorsVector::const_iterator i = @@ -1965,6 +1999,18 @@ void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v) } } +void cmake::PrintGeneratorList() +{ +#ifdef CMAKE_BUILD_WITH_CMAKE + cmDocumentation doc; + std::vector<cmDocumentationEntry> generators; + this->GetGeneratorDocumentation(generators); + doc.AppendSection("Generators",generators); + std::cerr << "\n"; + doc.PrintDocumentation(cmDocumentation::ListGenerators, std::cerr); +#endif +} + void cmake::UpdateConversionPathTable() { // Update the path conversion table with any specified file: @@ -2288,24 +2334,12 @@ bool cmake::IsPropertyChained(const std::string& name, void cmake::SetProperty(const std::string& prop, const char* value) { - // Special hook to invalidate cached value. - if(prop == "DEBUG_CONFIGURATIONS") - { - this->DebugConfigs.clear(); - } - this->Properties.SetProperty(prop, value, cmProperty::GLOBAL); } void cmake::AppendProperty(const std::string& prop, const char* value, bool asString) { - // Special hook to invalidate cached value. - if(prop == "DEBUG_CONFIGURATIONS") - { - this->DebugConfigs.clear(); - } - this->Properties.AppendProperty(prop, value, cmProperty::GLOBAL, asString); } @@ -2327,8 +2361,8 @@ const char *cmake::GetProperty(const std::string& prop, else if ( prop == "COMMANDS" ) { cmake::RegisteredCommandsMap::iterator cmds - = this->GetCommands()->begin(); - for (unsigned int cc=0 ; cmds != this->GetCommands()->end(); ++ cmds ) + = this->Commands.begin(); + for (unsigned int cc=0 ; cmds != this->Commands.end(); ++ cmds ) { if ( cc > 0 ) { @@ -2441,6 +2475,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args) if(i >= args.size()) { cmSystemTools::Error("No generator specified for -G"); + this->PrintGeneratorList(); return -1; } value = args[i]; @@ -2451,6 +2486,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args) { cmSystemTools::Error("Could not create named generator ", value.c_str()); + this->PrintGeneratorList(); } else { @@ -2762,27 +2798,24 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text, } //---------------------------------------------------------------------------- -std::vector<std::string> const& cmake::GetDebugConfigs() +std::vector<std::string> cmake::GetDebugConfigs() { - // Compute on-demand. - if(this->DebugConfigs.empty()) + std::vector<std::string> configs; + if(const char* config_list = this->GetProperty("DEBUG_CONFIGURATIONS")) { - if(const char* config_list = this->GetProperty("DEBUG_CONFIGURATIONS")) - { - // Expand the specified list and convert to upper-case. - cmSystemTools::ExpandListArgument(config_list, this->DebugConfigs); - std::transform(this->DebugConfigs.begin(), - this->DebugConfigs.end(), - this->DebugConfigs.begin(), - cmSystemTools::UpperCase); - } - // If no configurations were specified, use a default list. - if(this->DebugConfigs.empty()) - { - this->DebugConfigs.push_back("DEBUG"); - } + // Expand the specified list and convert to upper-case. + cmSystemTools::ExpandListArgument(config_list, configs); + std::transform(configs.begin(), + configs.end(), + configs.begin(), + cmSystemTools::UpperCase); + } + // If no configurations were specified, use a default list. + if(configs.empty()) + { + configs.push_back("DEBUG"); } - return this->DebugConfigs; + return configs; } diff --git a/Source/cmake.h b/Source/cmake.h index bbeb95d..e80cc1c 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -115,15 +115,9 @@ class cmake * and going up until it reaches the HomeDirectory. */ void SetHomeDirectory(const std::string& dir); - const char* GetHomeDirectory() const - { - return this->cmHomeDirectory.c_str(); - } - void SetHomeOutputDirectory(const std::string& lib); - const char* GetHomeOutputDirectory() const - { - return this->HomeOutputDirectory.c_str(); - } + const char* GetHomeDirectory() const; + void SetHomeOutputDirectory(const std::string& dir); + const char* GetHomeOutputDirectory() const; //@} //@{ @@ -134,24 +128,10 @@ class cmake * recursing up the tree starting at the StartDirectory and going up until * it reaches the HomeDirectory. */ - void SetStartDirectory(const std::string& dir) - { - this->cmStartDirectory = dir; - cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory); - } - const char* GetStartDirectory() const - { - return this->cmStartDirectory.c_str(); - } - void SetStartOutputDirectory(const std::string& lib) - { - this->StartOutputDirectory = lib; - cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory); - } - const char* GetStartOutputDirectory() const - { - return this->StartOutputDirectory.c_str(); - } + void SetStartDirectory(const std::string& dir); + const char* GetStartDirectory() const; + void SetStartOutputDirectory(const std::string& dir); + const char* GetStartOutputDirectory() const; //@} /** @@ -249,10 +229,7 @@ class cmake /** * Get a command by its name */ - cmCommand *GetCommand(const std::string& name); - - /** Get list of all commands */ - RegisteredCommandsMap* GetCommands() { return &this->Commands; } + cmCommand *GetCommand(const std::string& name) const; /** Check if a command exists. */ bool CommandExists(const std::string& name) const; @@ -262,10 +239,8 @@ class cmake bool directoriesSetBefore = false); ///! Is this cmake running as a result of a TRY_COMPILE command - bool GetIsInTryCompile() { return this->InTryCompile; } - - ///! Is this cmake running as a result of a TRY_COMPILE command - void SetIsInTryCompile(bool i) { this->InTryCompile = i; } + bool GetIsInTryCompile() const; + void SetIsInTryCompile(bool b); ///! Parse command line arguments that might set cache values bool SetCacheArgs(const std::vector<std::string>&); @@ -364,7 +339,7 @@ class cmake /** Get the list of configurations (in upper case) considered to be debugging configurations.*/ - std::vector<std::string> const& GetDebugConfigs(); + std::vector<std::string> GetDebugConfigs(); void SetCMakeEditCommand(std::string const& s) { this->CMakeEditCommand = s; } @@ -477,12 +452,14 @@ private: bool DebugTryCompile; cmFileTimeComparison* FileComparison; std::string GraphVizFile; - std::vector<std::string> DebugConfigs; InstalledFilesMap InstalledFiles; cmState* State; void UpdateConversionPathTable(); + + // Print a list of valid generators to stderr. + void PrintGeneratorList(); }; #define CMAKE_STANDARD_OPTIONS_TABLE \ diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 9f2ea46..2ef04ef 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -703,10 +703,20 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) // Tar files else if (args[1] == "tar" && args.size() > 3) { + const char* knownFormats[] = + { + "7zip", + "gnutar", + "pax", + "paxr", + "zip" + }; + std::string flags = args[2]; std::string outFile = args[3]; std::vector<std::string> files; std::string mtime; + std::string format; bool doing_options = true; for (std::string::size_type cc = 4; cc < args.size(); cc ++) { @@ -729,6 +739,19 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) return 1; } } + else if (cmHasLiteralPrefix(arg, "--format=")) + { + format = arg.substr(9); + bool isKnown = std::find(cmArrayBegin(knownFormats), + cmArrayEnd(knownFormats), format) != cmArrayEnd(knownFormats); + + if(!isKnown) + { + cmSystemTools::Error("Unknown -E tar --format= argument: ", + format.c_str()); + return 1; + } + } else { cmSystemTools::Error("Unknown option to -E tar: ", arg.c_str()); @@ -759,7 +782,13 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) compress = cmSystemTools::TarCompressGZip; ++nCompress; } - if ( nCompress > 1 ) + if ( (format == "7zip" || format == "zip") && nCompress > 0 ) + { + cmSystemTools::Error("Can not use compression flags with format: ", + format.c_str()); + return 1; + } + else if ( nCompress > 1 ) { cmSystemTools::Error("Can only compress a tar file one way; " "at most one flag of z, j, or J may be used"); @@ -781,7 +810,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) else if ( flags.find_first_of('c') != flags.npos ) { if ( !cmSystemTools::CreateTar( - outFile.c_str(), files, compress, verbose, mtime) ) + outFile.c_str(), files, compress, verbose, mtime, format) ) { cmSystemTools::Error("Problem creating tar: ", outFile.c_str()); return 1; diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 8a481d6..6c4a7a6 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -1260,15 +1260,22 @@ bool SystemTools::PathCygwinToWin32(const char *path, char *win32_path) bool SystemTools::Touch(const kwsys_stl::string& filename, bool create) { - if(create && !SystemTools::FileExists(filename)) + if (!SystemTools::FileExists(filename)) { - FILE* file = Fopen(filename, "a+b"); - if(file) + if(create) + { + FILE* file = Fopen(filename, "a+b"); + if(file) + { + fclose(file); + return true; + } + return false; + } + else { - fclose(file); return true; } - return false; } #if defined(_WIN32) && !defined(__CYGWIN__) HANDLE h = CreateFileW( |