This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, master has been updated via 3e129d71bc12a325c0548aaaea24470cd172470b (commit) via 29802ed27227fe91be1d531d6e894e4efbbb3d11 (commit) via fa2dbbbdde6c0861b2a950db1e5e2bb8476a8d19 (commit) via 6b5fb23e362d8e99e5fe78334d4bcec5e2ad8f29 (commit) via 249fb7f71d6ed5feaae0dfbfa48f9bf665b1f551 (commit) via 735c6f39d9bed0ee291ce20368028ae682756095 (commit) via 2d66567dca2a5a80e41493ec0a9d6d86f7d955f5 (commit) via f13aef4de57a74db72c258edb78108da60a030f1 (commit) via e9bbfdd9a115332deb40da10784d478f4930c68f (commit) via 7d19b3091d7d2982a0d6b2b4408011efbb56f167 (commit) via dda01904587627a3d2bda5b684f7bef1e62596bb (commit) via 390f14a24416f23801f5644eb51590f8317d35c7 (commit) via 87341d8328c7b3a1d50cfd534ff4cb44334a2561 (commit) via 5a15c9e7cb63fb5b884271a1184607a8fa87d442 (commit) via 5f6c236481da552dfdbfff6579dc9d833993adad (commit) via 18c30786a9a1444e726e23366dd9badb01f1d464 (commit) from afa2614eea6571c36be130805ff876d25f3edae5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3e129d71bc12a325c0548aaaea24470cd172470b commit 3e129d71bc12a325c0548aaaea24470cd172470b Merge: 29802ed 7d19b30 Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Apr 1 14:48:52 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Mon Apr 1 10:49:02 2019 -0400 Merge topic 'project-include' 7d19b3091d Release note for CMAKE_PROJECT_INCLUDE variable dda0190458 project: Add variable CMAKE_PROJECT_INCLUDE 390f14a244 Test ProjectInclude: Add NONE to avoid enabling languages Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3155 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=29802ed27227fe91be1d531d6e894e4efbbb3d11 commit 29802ed27227fe91be1d531d6e894e4efbbb3d11 Merge: fa2dbbb f13aef4 Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Apr 1 14:46:18 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Mon Apr 1 10:47:13 2019 -0400 Merge topic 'refactor-cmcmd' f13aef4de5 cmcmd: Modernize for loops with cmMakeRange e9bbfdd9a1 cmcmd: Pass args vector by const& Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3168 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fa2dbbbdde6c0861b2a950db1e5e2bb8476a8d19 commit fa2dbbbdde6c0861b2a950db1e5e2bb8476a8d19 Merge: 6b5fb23 2d66567 Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Apr 1 14:46:16 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Mon Apr 1 10:46:24 2019 -0400 Merge topic 'utilize-substr' 2d66567dca Modernize: Prefer .substr in place of .c_str() + int Acked-by: Kitware Robot <kwro...@kitware.com> Acked-by: Sebastian Holtermann <sebh...@xwmw.org> Merge-request: !3169 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6b5fb23e362d8e99e5fe78334d4bcec5e2ad8f29 commit 6b5fb23e362d8e99e5fe78334d4bcec5e2ad8f29 Merge: 249fb7f 735c6f3 Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Apr 1 14:43:39 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Mon Apr 1 10:43:48 2019 -0400 Merge topic 'fix_doxygen_comments' 735c6f39d9 Fix invalid ///! doxygen comment line starts Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3170 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=249fb7f71d6ed5feaae0dfbfa48f9bf665b1f551 commit 249fb7f71d6ed5feaae0dfbfa48f9bf665b1f551 Merge: afa2614 87341d8 Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Apr 1 14:42:49 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Mon Apr 1 10:42:58 2019 -0400 Merge topic 'cmDepends_tweaks' 87341d8328 cmDepends: Define DependencyMap instead of DependencyVector 5a15c9e7cb cmDepends: Refactor cmDepends::CheckDependencies method 5f6c236481 cmFiletimeCache: Add cmFiletimeCache::Remove method 18c30786a9 cmFileTime: Make cmFileTime::Compare method const Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3156 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=735c6f39d9bed0ee291ce20368028ae682756095 commit 735c6f39d9bed0ee291ce20368028ae682756095 Author: Sebastian Holtermann <sebh...@xwmw.org> AuthorDate: Sun Mar 31 11:27:12 2019 +0200 Commit: Sebastian Holtermann <sebh...@xwmw.org> CommitDate: Sun Mar 31 11:27:12 2019 +0200 Fix invalid ///! doxygen comment line starts In various places `///!` was used to start a comment line. This is not valid Doygen syntax. This patch replaces `///!` comment starts with `//!`. diff --git a/Source/CTest/cmCTestBuildAndTestHandler.h b/Source/CTest/cmCTestBuildAndTestHandler.h index 5e6d0aa..2d47b15 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.h +++ b/Source/CTest/cmCTestBuildAndTestHandler.h @@ -44,7 +44,7 @@ public: void Initialize() override; protected: - ///! Run CMake and build a test and then run it as a single test. + //! Run CMake and build a test and then run it as a single test. int RunCMakeAndTest(std::string* output); int RunCMake(std::string* outstring, std::ostringstream& out, std::string& cmakeOutString, cmake* cm); diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h index 8880dac..746d72c 100644 --- a/Source/CTest/cmCTestMemCheckHandler.h +++ b/Source/CTest/cmCTestMemCheckHandler.h @@ -114,7 +114,7 @@ private: // this type of checker void InitializeResultsVectors(); - ///! Initialize memory checking subsystem. + //! Initialize memory checking subsystem. bool InitializeMemoryChecking(); /** @@ -143,11 +143,11 @@ private: void PostProcessTest(cmCTestTestResult& res, int test); void PostProcessBoundsCheckerTest(cmCTestTestResult& res, int test); - ///! append MemoryTesterOutputFile to the test log + //! append MemoryTesterOutputFile to the test log void AppendMemTesterOutput(cmCTestTestHandler::cmCTestTestResult& res, std::string const& filename); - ///! generate the output filename for the given test index + //! generate the output filename for the given test index void TestOutputFileNames(int test, std::vector<std::string>& files); }; diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 17d5f3f..7f3f5e4 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -59,7 +59,7 @@ public: */ void PopulateCustomVectors(cmMakefile* mf) override; - ///! Control the use of the regular expresisons, call these methods to turn + //! Control the use of the regular expresisons, call these methods to turn /// them on void UseIncludeRegExp(); void UseExcludeRegExp(); @@ -78,7 +78,7 @@ public: this->CustomMaximumFailedTestOutputSize = n; } - ///! pass the -I argument down + //! pass the -I argument down void SetTestsToRunInformation(const char*); cmCTestTestHandler(); diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 0c70ed2..65f22f7 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -93,33 +93,33 @@ public: CacheEntry& GetEntry() { return this->Position->second; } }; - ///! return an iterator to iterate through the cache map + //! return an iterator to iterate through the cache map cmCacheManager::CacheIterator NewIterator() { return CacheIterator(*this); } - ///! Load a cache for given makefile. Loads from path/CMakeCache.txt. + //! Load a cache for given makefile. Loads from path/CMakeCache.txt. bool LoadCache(const std::string& path, bool internal, std::set<std::string>& excludes, std::set<std::string>& includes); - ///! Save cache for given makefile. Saves to output path/CMakeCache.txt + //! Save cache for given makefile. Saves to output path/CMakeCache.txt bool SaveCache(const std::string& path, cmMessenger* messenger); - ///! Delete the cache given + //! Delete the cache given bool DeleteCache(const std::string& path); - ///! Print the cache to a stream + //! Print the cache to a stream void PrintCache(std::ostream&) const; - ///! Get the iterator for an entry with a given key. + //! Get the iterator for an entry with a given key. cmCacheManager::CacheIterator GetCacheIterator(const char* key = nullptr); - ///! Remove an entry from the cache + //! Remove an entry from the cache void RemoveCacheEntry(const std::string& key); - ///! Get the number of entries in the cache + //! Get the number of entries in the cache int GetSize() { return static_cast<int>(this->Cache.size()); } - ///! Get a value from the cache given a key + //! Get a value from the cache given a key const std::string* GetInitializedCacheValue(const std::string& key) const; const char* GetCacheEntryValue(const std::string& key) @@ -197,14 +197,14 @@ public: unsigned int GetCacheMinorVersion() const { return this->CacheMinorVersion; } protected: - ///! Add an entry into the cache + //! Add an entry into the cache void AddCacheEntry(const std::string& key, const char* value, const char* helpString, cmStateEnums::CacheEntryType type); - ///! Get a cache entry object for a key + //! Get a cache entry object for a key CacheEntry* GetCacheEntry(const std::string& key); - ///! Clean out the CMakeFiles directory if no CMakeCache.txt + //! Clean out the CMakeFiles directory if no CMakeCache.txt void CleanCMakeFiles(const std::string& path); // Cache version info diff --git a/Source/cmCallVisualStudioMacro.cxx b/Source/cmCallVisualStudioMacro.cxx index ee5feee..2f6cf64 100644 --- a/Source/cmCallVisualStudioMacro.cxx +++ b/Source/cmCallVisualStudioMacro.cxx @@ -35,8 +35,8 @@ static bool LogErrorsAsMessages; # endif # endif -///! Use ReportHRESULT to make a cmSystemTools::Message after calling -///! a COM method that may have failed. +//! Use ReportHRESULT to make a cmSystemTools::Message after calling +//! a COM method that may have failed. # define ReportHRESULT(hr, context) \ if (FAILED(hr)) { \ if (LogErrorsAsMessages) { \ @@ -50,7 +50,7 @@ static bool LogErrorsAsMessages; } \ } -///! Using the given instance of Visual Studio, call the named macro +//! Using the given instance of Visual Studio, call the named macro HRESULT InstanceCallMacro(IDispatch* vsIDE, const std::string& macro, const std::string& args) { @@ -133,7 +133,7 @@ HRESULT InstanceCallMacro(IDispatch* vsIDE, const std::string& macro, return hr; } -///! Get the Solution object from the IDE object +//! Get the Solution object from the IDE object HRESULT GetSolutionObject(IDispatch* vsIDE, IDispatchPtr& vsSolution) { HRESULT hr = E_POINTER; @@ -176,7 +176,7 @@ HRESULT GetSolutionObject(IDispatch* vsIDE, IDispatchPtr& vsSolution) return hr; } -///! Get the FullName property from the Solution object +//! Get the FullName property from the Solution object HRESULT GetSolutionFullName(IDispatch* vsSolution, std::string& fullName) { HRESULT hr = E_POINTER; @@ -220,7 +220,7 @@ HRESULT GetSolutionFullName(IDispatch* vsSolution, std::string& fullName) return hr; } -///! Get the FullName property from the Solution object, given the IDE object +//! Get the FullName property from the Solution object, given the IDE object HRESULT GetIDESolutionFullName(IDispatch* vsIDE, std::string& fullName) { IDispatchPtr vsSolution; @@ -235,8 +235,8 @@ HRESULT GetIDESolutionFullName(IDispatch* vsIDE, std::string& fullName) return hr; } -///! Get all running objects from the Windows running object table. -///! Save them in a map by their display names. +//! Get all running objects from the Windows running object table. +//! Save them in a map by their display names. HRESULT GetRunningInstances(std::map<std::string, IUnknownPtr>& mrot) { // mrot == Map of the Running Object Table @@ -292,8 +292,8 @@ HRESULT GetRunningInstances(std::map<std::string, IUnknownPtr>& mrot) return hr; } -///! Do the two file names refer to the same Visual Studio solution? Or are -///! we perhaps looking for any and all solutions? +//! Do the two file names refer to the same Visual Studio solution? Or are +//! we perhaps looking for any and all solutions? bool FilesSameSolution(const std::string& slnFile, const std::string& slnName) { if (slnFile == "ALL" || slnName == "ALL") { @@ -310,9 +310,9 @@ bool FilesSameSolution(const std::string& slnFile, const std::string& slnName) return s1 == s2; } -///! Find instances of Visual Studio with the given solution file -///! open. Pass "ALL" for slnFile to gather all running instances -///! of Visual Studio. +//! Find instances of Visual Studio with the given solution file +//! open. Pass "ALL" for slnFile to gather all running instances +//! of Visual Studio. HRESULT FindVisualStudioInstances(const std::string& slnFile, std::vector<IDispatchPtr>& instances) { @@ -384,8 +384,8 @@ int cmCallVisualStudioMacro::GetNumberOfRunningVisualStudioInstances( return count; } -///! Get all running objects from the Windows running object table. -///! Save them in a map by their display names. +//! Get all running objects from the Windows running object table. +//! Save them in a map by their display names. int cmCallVisualStudioMacro::CallMacro(const std::string& slnFile, const std::string& macro, const std::string& args, diff --git a/Source/cmCallVisualStudioMacro.h b/Source/cmCallVisualStudioMacro.h index fdc9e66..9b5b3a8 100644 --- a/Source/cmCallVisualStudioMacro.h +++ b/Source/cmCallVisualStudioMacro.h @@ -16,16 +16,16 @@ class cmCallVisualStudioMacro { public: - ///! Call the named macro in instances of Visual Studio with the - ///! given solution file open. Pass "ALL" for slnFile to call the - ///! macro in each Visual Studio instance. + //! Call the named macro in instances of Visual Studio with the + //! given solution file open. Pass "ALL" for slnFile to call the + //! macro in each Visual Studio instance. static int CallMacro(const std::string& slnFile, const std::string& macro, const std::string& args, const bool logErrorsAsMessages); - ///! Count the number of running instances of Visual Studio with the - ///! given solution file open. Pass "ALL" for slnFile to count all - ///! running Visual Studio instances. + //! Count the number of running instances of Visual Studio with the + //! given solution file open. Pass "ALL" for slnFile to count all + //! running Visual Studio instances. static int GetNumberOfRunningVisualStudioInstances( const std::string& slnFile); diff --git a/Source/cmExternalMakefileProjectGenerator.h b/Source/cmExternalMakefileProjectGenerator.h index 4438f28..a472a06 100644 --- a/Source/cmExternalMakefileProjectGenerator.h +++ b/Source/cmExternalMakefileProjectGenerator.h @@ -31,13 +31,13 @@ public: virtual void EnableLanguage(std::vector<std::string> const& languages, cmMakefile*, bool optional); - ///! set the global generator which will generate the makefiles + //! set the global generator which will generate the makefiles virtual void SetGlobalGenerator(cmGlobalGenerator* generator) { this->GlobalGenerator = generator; } - ///! Return the list of global generators supported by this extra generator + //! Return the list of global generators supported by this extra generator const std::vector<std::string>& GetSupportedGlobalGenerators() const { return this->SupportedGlobalGenerators; @@ -49,7 +49,7 @@ public: static std::string CreateFullGeneratorName( const std::string& globalGenerator, const std::string& extraGenerator); - ///! Generate the project files, the Makefiles have already been generated + //! Generate the project files, the Makefiles have already been generated virtual void Generate() = 0; void SetName(const std::string& n) { Name = n; } @@ -59,9 +59,9 @@ public: bool dryRun); protected: - ///! Contains the names of the global generators support by this generator. + //! Contains the names of the global generators support by this generator. std::vector<std::string> SupportedGlobalGenerators; - ///! the global generator which creates the makefiles + //! the global generator which creates the makefiles const cmGlobalGenerator* GlobalGenerator = nullptr; std::string Name; diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index bc966e1..3f2025e 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -69,9 +69,9 @@ public: std::string GetExportName() const; std::vector<std::string> GetPropertyKeys() const; - ///! Might return a nullptr if the property is not set or invalid + //! Might return a nullptr if the property is not set or invalid const char* GetProperty(const std::string& prop) const; - ///! Always returns a valid pointer + //! Always returns a valid pointer const char* GetSafeProperty(const std::string& prop) const; bool GetPropertyAsBool(const std::string& prop) const; void GetSourceFiles(std::vector<cmSourceFile*>& files, @@ -602,7 +602,7 @@ public: pdb output directory is given. */ std::string GetPDBDirectory(const std::string& config) const; - ///! Return the preferred linker language for this target + //! Return the preferred linker language for this target std::string GetLinkerLanguage(const std::string& config) const; /** Does this target have a GNU implib to convert to MS format? */ diff --git a/Source/cmGlobVerificationManager.h b/Source/cmGlobVerificationManager.h index f7146be..48606d3 100644 --- a/Source/cmGlobVerificationManager.h +++ b/Source/cmGlobVerificationManager.h @@ -22,11 +22,11 @@ class cmGlobVerificationManager { protected: - ///! Save verification script for given makefile. - ///! Saves to output <path>/<CMakeFilesDirectory>/VerifyGlobs.cmake + //! Save verification script for given makefile. + //! Saves to output <path>/<CMakeFilesDirectory>/VerifyGlobs.cmake bool SaveVerificationScript(const std::string& path); - ///! Add an entry into the glob cache + //! Add an entry into the glob cache void AddCacheEntry(bool recurse, bool listDirectories, bool followSymlinks, const std::string& relative, const std::string& expression, @@ -34,13 +34,13 @@ protected: const std::string& variable, const cmListFileBacktrace& bt); - ///! Clear the glob cache for state reset. + //! Clear the glob cache for state reset. void Reset(); - ///! Check targets should be written in generated build system. + //! Check targets should be written in generated build system. bool DoWriteVerifyTarget() const; - ///! Get the paths to the generated script and stamp files + //! Get the paths to the generated script and stamp files std::string const& GetVerifyScript() const { return this->VerifyScript; } std::string const& GetVerifyStamp() const { return this->VerifyStamp; } diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx index 281d371..51d681d 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.cxx +++ b/Source/cmGlobalBorlandMakefileGenerator.cxx @@ -34,7 +34,7 @@ void cmGlobalBorlandMakefileGenerator::EnableLanguage( this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional); } -///! Create a local generator appropriate to this Global Generator +//! Create a local generator appropriate to this Global Generator cmLocalGenerator* cmGlobalBorlandMakefileGenerator::CreateLocalGenerator( cmMakefile* mf) { diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h index 02d0d5f..ee7de70 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.h +++ b/Source/cmGlobalBorlandMakefileGenerator.h @@ -22,7 +22,7 @@ public: cmGlobalBorlandMakefileGenerator>(); } - ///! Get the name for the generator. + //! Get the name for the generator. std::string GetName() const override { return cmGlobalBorlandMakefileGenerator::GetActualName(); @@ -32,7 +32,7 @@ public: /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); - ///! Create a local generator appropriate to this Global Generator + //! Create a local generator appropriate to this Global Generator cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) override; /** diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 17eb340..88c586a 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -86,13 +86,13 @@ struct GeneratedMakeCommand class cmGlobalGenerator { public: - ///! Free any memory allocated with the GlobalGenerator + //! Free any memory allocated with the GlobalGenerator cmGlobalGenerator(cmake* cm); virtual ~cmGlobalGenerator(); virtual cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf); - ///! Get the name for this generator + //! Get the name for this generator virtual std::string GetName() const { return "Generic"; } /** Check whether the given name matches the current generator. */ @@ -236,7 +236,7 @@ public: const std::string& native, bool ignoreErrors); - ///! Get the CMake instance + //! Get the CMake instance cmake* GetCMakeInstance() const { return this->CMakeInstance; } void SetConfiguredFilesPath(cmGlobalGenerator* gen); @@ -261,7 +261,7 @@ public: void AddMakefile(cmMakefile* mf); - ///! Set an generator for an "external makefile based project" + //! Set an generator for an "external makefile based project" void SetExternalMakefileProjectGenerator( cmExternalMakefileProjectGenerator* extraGenerator); @@ -290,19 +290,19 @@ public: bool GetForceUnixPaths() const { return this->ForceUnixPaths; } bool GetToolSupportsColor() const { return this->ToolSupportsColor; } - ///! return the language for the given extension + //! return the language for the given extension std::string GetLanguageFromExtension(const char* ext) const; - ///! is an extension to be ignored + //! is an extension to be ignored bool IgnoreFile(const char* ext) const; - ///! What is the preference for linkers and this language (None or Preferred) + //! What is the preference for linkers and this language (None or Preferred) int GetLinkerPreference(const std::string& lang) const; - ///! What is the object file extension for a given source file? + //! What is the object file extension for a given source file? std::string GetLanguageOutputExtension(cmSourceFile const&) const; - ///! What is the configurations directory variable called? + //! What is the configurations directory variable called? virtual const char* GetCMakeCFGIntDir() const { return "."; } - ///! expand CFGIntDir for a configuration + //! expand CFGIntDir for a configuration virtual std::string ExpandCFGIntDir(const std::string& str, const std::string& config) const; @@ -318,7 +318,7 @@ public: */ virtual bool FindMakeProgram(cmMakefile*); - ///! Find a target by name by searching the local generators. + //! Find a target by name by searching the local generators. cmTarget* FindTarget(const std::string& name, bool excludeAliases = false) const; diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index f8df6ef..ae27806 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -34,13 +34,13 @@ public: return new cmGlobalGeneratorSimpleFactory<cmGlobalGhsMultiGenerator>(); } - ///! create the correct local generator + //! create the correct local generator cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) override; /// @return the name of this generator. static std::string GetActualName() { return "Green Hills MULTI"; } - ///! Get the name for this generator + //! Get the name for this generator std::string GetName() const override { return GetActualName(); } /// Overloaded methods. @see cmGlobalGenerator::GetDocumentation() diff --git a/Source/cmGlobalJOMMakefileGenerator.h b/Source/cmGlobalJOMMakefileGenerator.h index 341b2dd..df3aec9 100644 --- a/Source/cmGlobalJOMMakefileGenerator.h +++ b/Source/cmGlobalJOMMakefileGenerator.h @@ -20,7 +20,7 @@ public: { return new cmGlobalGeneratorSimpleFactory<cmGlobalJOMMakefileGenerator>(); } - ///! Get the name for the generator. + //! Get the name for the generator. std::string GetName() const override { return cmGlobalJOMMakefileGenerator::GetActualName(); diff --git a/Source/cmGlobalMSYSMakefileGenerator.h b/Source/cmGlobalMSYSMakefileGenerator.h index 23dbc5e..d6e4847 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.h +++ b/Source/cmGlobalMSYSMakefileGenerator.h @@ -19,7 +19,7 @@ public: return new cmGlobalGeneratorSimpleFactory<cmGlobalMSYSMakefileGenerator>(); } - ///! Get the name for the generator. + //! Get the name for the generator. virtual std::string GetName() const { return cmGlobalMSYSMakefileGenerator::GetActualName(); diff --git a/Source/cmGlobalMinGWMakefileGenerator.h b/Source/cmGlobalMinGWMakefileGenerator.h index a994c92..15297e3 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.h +++ b/Source/cmGlobalMinGWMakefileGenerator.h @@ -19,7 +19,7 @@ public: return new cmGlobalGeneratorSimpleFactory< cmGlobalMinGWMakefileGenerator>(); } - ///! Get the name for the generator. + //! Get the name for the generator. virtual std::string GetName() const { return cmGlobalMinGWMakefileGenerator::GetActualName(); diff --git a/Source/cmGlobalNMakeMakefileGenerator.h b/Source/cmGlobalNMakeMakefileGenerator.h index 1fc2f9c..2fdf1ce 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.h +++ b/Source/cmGlobalNMakeMakefileGenerator.h @@ -21,7 +21,7 @@ public: return new cmGlobalGeneratorSimpleFactory< cmGlobalNMakeMakefileGenerator>(); } - ///! Get the name for the generator. + //! Get the name for the generator. std::string GetName() const override { return cmGlobalNMakeMakefileGenerator::GetActualName(); diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 3381c81..9d64924 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -57,7 +57,7 @@ void cmGlobalUnixMakefileGenerator3::EnableLanguage( } } -///! Create a local generator appropriate to this Global Generator +//! Create a local generator appropriate to this Global Generator cmLocalGenerator* cmGlobalUnixMakefileGenerator3::CreateLocalGenerator( cmMakefile* mf) { diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 496104d..e919d38 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -67,7 +67,7 @@ public: cmGlobalUnixMakefileGenerator3>(); } - ///! Get the name for the generator. + //! Get the name for the generator. std::string GetName() const override { return cmGlobalUnixMakefileGenerator3::GetActualName(); diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 26fd62b..4fa89d0 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -509,7 +509,7 @@ std::string cmGlobalVisualStudio10Generator::SelectWindowsCEToolset() const return ""; } -///! Create a local generator appropriate to this Global Generator +//! Create a local generator appropriate to this Global Generator cmLocalGenerator* cmGlobalVisualStudio10Generator::CreateLocalGenerator( cmMakefile* mf) { diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 26db929..2f532a6 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -29,7 +29,7 @@ public: std::vector<std::string> const& makeOptions = std::vector<std::string>()) override; - ///! create the correct local generator + //! create the correct local generator cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) override; /** diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index c694902..d7630e4 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -248,7 +248,7 @@ cmGlobalVisualStudio7Generator::GenerateBuildCommand( return makeCommands; } -///! Create a local generator appropriate to this Global Generator +//! Create a local generator appropriate to this Global Generator cmLocalGenerator* cmGlobalVisualStudio7Generator::CreateLocalGenerator( cmMakefile* mf) { diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 954d1d3..1e76383 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -20,7 +20,7 @@ class cmGlobalVisualStudio7Generator : public cmGlobalVisualStudioGenerator public: ~cmGlobalVisualStudio7Generator(); - ///! Create a local generator appropriate to this Global Generator + //! Create a local generator appropriate to this Global Generator cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) override; #if defined(CMAKE_BUILD_WITH_CMAKE) @@ -64,7 +64,7 @@ public: */ virtual void OutputSLNFile(); - ///! Lookup a stored GUID or compute one deterministically. + //! Lookup a stored GUID or compute one deterministically. std::string GetGUID(std::string const& name); /** Append the subdirectory for the given configuration. */ @@ -73,7 +73,7 @@ public: const std::string& suffix, std::string& dir) override; - ///! What is the configurations directory variable called? + //! What is the configurations directory variable called? const char* GetCMakeCFGIntDir() const override { return "$(ConfigurationName)"; diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index 75f4778..352bc3c 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -13,7 +13,7 @@ class cmGlobalVisualStudio8Generator : public cmGlobalVisualStudio71Generator { public: - ///! Get the name for the generator. + //! Get the name for the generator. std::string GetName() const override { return this->Name; } /** Get the name of the main stamp list file. */ diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h index c96dc72..3ca5e7d 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.h +++ b/Source/cmGlobalWatcomWMakeGenerator.h @@ -29,7 +29,7 @@ public: { return new cmGlobalGeneratorSimpleFactory<cmGlobalWatcomWMakeGenerator>(); } - ///! Get the name for the generator. + //! Get the name for the generator. std::string GetName() const override { return cmGlobalWatcomWMakeGenerator::GetActualName(); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index ad1a636..af165f6 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -389,7 +389,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( return { std::move(makeCommand) }; } -///! Create a local generator appropriate to this Global Generator +//! Create a local generator appropriate to this Global Generator cmLocalGenerator* cmGlobalXCodeGenerator::CreateLocalGenerator(cmMakefile* mf) { return new cmLocalXCodeGenerator(this, mf); diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 8daa95b..71446f9 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -36,7 +36,7 @@ public: unsigned int version_number); static cmGlobalGeneratorFactory* NewFactory(); - ///! Get the name for the generator. + //! Get the name for the generator. std::string GetName() const override { return cmGlobalXCodeGenerator::GetActualName(); @@ -46,7 +46,7 @@ public: /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); - ///! Create a local generator appropriate to this Global Generator + //! Create a local generator appropriate to this Global Generator cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) override; /** @@ -81,9 +81,9 @@ public: bool FindMakeProgram(cmMakefile*) override; - ///! What is the configurations directory variable called? + //! What is the configurations directory variable called? const char* GetCMakeCFGIntDir() const override; - ///! expand CFGIntDir + //! expand CFGIntDir std::string ExpandCFGIntDir(const std::string& str, const std::string& config) const override; diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index cd71518..69751b6 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -33,7 +33,7 @@ public: this->info.CAPI = &cmStaticCAPI; } - ///! clean up any memory allocated by the plugin + //! clean up any memory allocated by the plugin ~cmLoadedCommand() override; /** diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index de12190..67e3c58 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -76,13 +76,13 @@ public: bool IsRootMakefile() const; - ///! Get the makefile for this generator + //! Get the makefile for this generator cmMakefile* GetMakefile() { return this->Makefile; } - ///! Get the makefile for this generator, const version + //! Get the makefile for this generator, const version const cmMakefile* GetMakefile() const { return this->Makefile; } - ///! Get the GlobalGenerator this is associated with + //! Get the GlobalGenerator this is associated with cmGlobalGenerator* GetGlobalGenerator() { return this->GlobalGenerator; } const cmGlobalGenerator* GetGlobalGenerator() const { @@ -118,7 +118,7 @@ public: void AddCompilerRequirementFlag(std::string& flags, cmGeneratorTarget const* target, const std::string& lang); - ///! Append flags to a string. + //! Append flags to a string. virtual void AppendFlags(std::string& flags, const std::string& newFlags) const; virtual void AppendFlags(std::string& flags, const char* newFlags) const; @@ -131,7 +131,7 @@ public: cmGeneratorTarget* target, const std::string& config, const std::string& lang); - ///! Get the include flags for the current makefile and language + //! Get the include flags for the current makefile and language std::string GetIncludeFlags(const std::vector<std::string>& includes, cmGeneratorTarget* target, const std::string& lang, @@ -403,7 +403,7 @@ public: const std::string& prop); protected: - ///! put all the libraries for a target on into the given stream + //! put all the libraries for a target on into the given stream void OutputLinkLibraries(cmComputeLinkInformation* pcli, cmLinkLineComputer* linkLineComputer, std::string& linkLibraries, diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h index a4150b9..5c6400e 100644 --- a/Source/cmLocalVisualStudio10Generator.h +++ b/Source/cmLocalVisualStudio10Generator.h @@ -21,7 +21,7 @@ class cmMakefile; class cmLocalVisualStudio10Generator : public cmLocalVisualStudio7Generator { public: - ///! Set cache only and recurse to false by default. + //! Set cache only and recurse to false by default. cmLocalVisualStudio10Generator(cmGlobalGenerator* gg, cmMakefile* mf); virtual ~cmLocalVisualStudio10Generator(); diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index b093e6f..ce8eceb 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -43,7 +43,7 @@ public: class cmLocalVisualStudio7Generator : public cmLocalVisualStudioGenerator { public: - ///! Set cache only and recurse to false by default. + //! Set cache only and recurse to false by default. cmLocalVisualStudio7Generator(cmGlobalGenerator* gg, cmMakefile* mf); virtual ~cmLocalVisualStudio7Generator(); diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h index 5c22dcf..42de20b 100644 --- a/Source/cmLocalXCodeGenerator.h +++ b/Source/cmLocalXCodeGenerator.h @@ -24,7 +24,7 @@ class cmSourceFile; class cmLocalXCodeGenerator : public cmLocalGenerator { public: - ///! Set cache only and recurse to false by default. + //! Set cache only and recurse to false by default. cmLocalXCodeGenerator(cmGlobalGenerator* gg, cmMakefile* mf); ~cmLocalXCodeGenerator() override; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 88b4c2f..8cc14f3 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -257,7 +257,7 @@ public: * can be used in CMake to refer to lists, directories, etc. */ void AddDefinition(const std::string& name, const char* value); - ///! Add a definition to this makefile and the global cmake cache. + //! Add a definition to this makefile and the global cmake cache. void AddCacheDefinition(const std::string& name, const char* value, const char* doc, cmStateEnums::CacheEntryType type, bool force = false); @@ -272,7 +272,7 @@ public: * for cache entries, and will only affect the current makefile. */ void RemoveDefinition(const std::string& name); - ///! Remove a definition from the cache. + //! Remove a definition from the cache. void RemoveCacheDefinition(const std::string& name); /** @@ -548,7 +548,7 @@ public: { return this->ListFiles; } - ///! When the file changes cmake will be re-run from the build system. + //! When the file changes cmake will be re-run from the build system. void AddCMakeDependFile(const std::string& file) { this->ListFiles.push_back(file); @@ -626,7 +626,7 @@ public: bool ExecuteCommand(const cmListFileFunction& lff, cmExecutionStatus& status); - ///! Enable support for named language, if nil then all languages are + //! Enable support for named language, if nil then all languages are /// enabled. void EnableLanguage(std::vector<std::string> const& languages, bool optional); @@ -641,7 +641,7 @@ public: cmVariableWatch* GetVariableWatch() const; #endif - ///! Display progress or status message. + //! Display progress or status message. void DisplayStatus(const std::string&, float) const; /** @@ -677,7 +677,7 @@ public: */ cmSourceFile* GetSourceFileWithOutput(const std::string& outName) const; - ///! Add a new cmTest to the list of tests for this makefile. + //! Add a new cmTest to the list of tests for this makefile. cmTest* CreateTest(const std::string& testName); /** Get a cmTest pointer for a given test name, if the name is @@ -701,7 +701,7 @@ public: std::string GetModulesFile(const std::string& name, bool& system) const; - ///! Set/Get a property of this directory + //! Set/Get a property of this directory void SetProperty(const std::string& prop, const char* value); void AppendProperty(const std::string& prop, const char* value, bool asString = false); @@ -710,7 +710,7 @@ public: bool GetPropertyAsBool(const std::string& prop) const; std::vector<std::string> GetPropertyKeys() const; - ///! Initialize a makefile from its parent + //! Initialize a makefile from its parent void InitializeFromParent(cmMakefile* parent); void AddInstallGenerator(cmInstallGenerator* g) diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index 6438c7b..deca767 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -27,7 +27,7 @@ public: std::string ConvertDirectorySeparatorsForShell( const std::string& source) const; - ///! for existing files convert to output path and short path if spaces + //! for existing files convert to output path and short path if spaces std::string ConvertToOutputForExisting(const std::string& remote, OutputFormat format = SHELL) const; diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 0a234c5..61b2fda 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -299,7 +299,7 @@ bool cmPolicies::GetPolicyID(const char* id, cmPolicies::PolicyID& pid) return stringToId(id, pid); } -///! return a warning string for a given policy +//! return a warning string for a given policy std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id) { std::ostringstream msg; @@ -333,7 +333,7 @@ std::string cmPolicies::GetPolicyDeprecatedWarning(cmPolicies::PolicyID id) return msg.str(); } -///! return an error string for when a required policy is unspecified +//! return an error string for when a required policy is unspecified std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id) { std::ostringstream error; @@ -359,7 +359,7 @@ std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id) return error.str(); } -///! Get the default status for a policy +//! Get the default status for a policy cmPolicies::PolicyStatus cmPolicies::GetPolicyStatus( cmPolicies::PolicyID /*unused*/) { diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 7677186..02a6295 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -332,27 +332,27 @@ public: CMPCOUNT }; - ///! convert a string policy ID into a number + //! convert a string policy ID into a number static bool GetPolicyID(const char* id, /* out */ cmPolicies::PolicyID& pid); - ///! Get the default status for a policy + //! Get the default status for a policy static cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id); - ///! Set a policy level for this listfile + //! Set a policy level for this listfile static bool ApplyPolicyVersion(cmMakefile* mf, std::string const& version_min, std::string const& version_max); static bool ApplyPolicyVersion(cmMakefile* mf, unsigned int majorVer, unsigned int minorVer, unsigned int patchVer); - ///! return a warning string for a given policy + //! return a warning string for a given policy static std::string GetPolicyWarning(cmPolicies::PolicyID id); static std::string GetPolicyDeprecatedWarning(cmPolicies::PolicyID id); - ///! return an error string for when a required policy is unspecified + //! return an error string for when a required policy is unspecified static std::string GetRequiredPolicyError(cmPolicies::PolicyID id); - ///! return an error string for when a required policy is unspecified + //! return an error string for when a required policy is unspecified static std::string GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id); /** Represent a set of policy values. */ diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index d579018..edad4c7 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -44,13 +44,13 @@ public: cmCustomCommand const* GetCustomCommand() const; void SetCustomCommand(cmCustomCommand* cc); - ///! Set/Get a property of this source file + //! Set/Get a property of this source file void SetProperty(const std::string& prop, const char* value); void AppendProperty(const std::string& prop, const char* value, bool asString = false); - ///! Might return a nullptr if the property is not set or invalid + //! Might return a nullptr if the property is not set or invalid const char* GetProperty(const std::string& prop) const; - ///! Always returns a valid pointer + //! Always returns a valid pointer const char* GetSafeProperty(const std::string& prop) const; bool GetPropertyAsBool(const std::string& prop) const; @@ -58,7 +58,7 @@ public: command like get_property or get_source_file_property. */ const char* GetPropertyForUser(const std::string& prop); - ///! Checks is the GENERATED property is set and true + //! Checks is the GENERATED property is set and true /// @return Equivalent to GetPropertyAsBool("GENERATED") bool GetIsGenerated() const { return this->IsGenerated; } diff --git a/Source/cmState.h b/Source/cmState.h index 190eafc..6abe71c 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -107,7 +107,7 @@ public: void RemoveCacheEntryProperty(std::string const& key, std::string const& propertyName); - ///! Break up a line like VAR:type="value" into var, type and value + //! Break up a line like VAR:type="value" into var, type and value static bool ParseCacheEntry(const std::string& entry, std::string& var, std::string& value, cmStateEnums::CacheEntryType& type); diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 0b75025..a8b2d37 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -45,7 +45,7 @@ public: static void ExpandRegistryValues(std::string& source, KeyWOW64 view = KeyWOW64_Default); - ///! Escape quotes in a string. + //! Escape quotes in a string. static std::string EscapeQuotes(const std::string& str); /** Map help document name to file name. */ @@ -78,11 +78,11 @@ public: using OutputCallback = std::function<void(std::string const&)>; - ///! Send a string to stdout + //! Send a string to stdout static void Stdout(const std::string& s); static void SetStdoutCallback(OutputCallback f); - ///! Send a string to stderr + //! Send a string to stderr static void Stderr(const std::string& s); static void SetStderrCallback(OutputCallback f); @@ -90,25 +90,25 @@ public: static void SetInterruptCallback(InterruptCallback f); static bool GetInterruptFlag(); - ///! Return true if there was an error at any point. + //! Return true if there was an error at any point. static bool GetErrorOccuredFlag() { return cmSystemTools::s_ErrorOccured || cmSystemTools::s_FatalErrorOccured || GetInterruptFlag(); } - ///! If this is set to true, cmake stops processing commands. + //! If this is set to true, cmake stops processing commands. static void SetFatalErrorOccured() { cmSystemTools::s_FatalErrorOccured = true; } static void SetErrorOccured() { cmSystemTools::s_ErrorOccured = true; } - ///! Return true if there was an error at any point. + //! Return true if there was an error at any point. static bool GetFatalErrorOccured() { return cmSystemTools::s_FatalErrorOccured || GetInterruptFlag(); } - ///! Set the error occurred flag and fatal error back to false + //! Set the error occurred flag and fatal error back to false static void ResetErrorOccuredFlag() { cmSystemTools::s_FatalErrorOccured = false; @@ -138,9 +138,9 @@ public: static bool IsOff(const char* val); static bool IsOff(const std::string& val); - ///! Return true if value is NOTFOUND or ends in -NOTFOUND. + //! Return true if value is NOTFOUND or ends in -NOTFOUND. static bool IsNOTFOUND(const char* value); - ///! Return true if the path is a framework + //! Return true if the path is a framework static bool IsPathToFramework(const std::string& value); static bool DoesFileExistWithExtensions( @@ -177,14 +177,14 @@ public: static bool RenameFile(const std::string& oldname, const std::string& newname); - ///! Compute the hash of a file + //! Compute the hash of a file static std::string ComputeFileHash(const std::string& source, cmCryptoHash::Algo algo); /** Compute the md5sum of a string. */ static std::string ComputeStringMD5(const std::string& input); - ///! Get the SHA thumbprint for a certificate file + //! Get the SHA thumbprint for a certificate file static std::string ComputeCertificateThumbprint(const std::string& source); /** diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 38bff1b..dc9b6d2 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -34,7 +34,7 @@ #include "cmTargetPropertyComputer.h" #include "cmake.h" -///! Append all elements from the second container to the first container +//! Append all elements from the second container to the first container template <class C, class R> static inline void CApp(C& container, R const& range) { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 5d90ba7..0ac5ca7 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -59,22 +59,22 @@ public: cmTarget& operator=(cmTarget const&) = delete; cmTarget& operator=(cmTarget&&) noexcept; - ///! Return the type of target. + //! Return the type of target. cmStateEnums::TargetType GetType() const; - ///! Get the cmMakefile that owns this target. + //! Get the cmMakefile that owns this target. cmMakefile* GetMakefile() const; - ///! Return the global generator. + //! Return the global generator. cmGlobalGenerator* GetGlobalGenerator() const; - ///! Set/Get the name of the target + //! Set/Get the name of the target const std::string& GetName() const; - ///! Get the policy map + //! Get the policy map cmPolicies::PolicyMap const& GetPolicyMap() const; - ///! Get policy status + //! Get policy status cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID policy) const; #define DECLARE_TARGET_POLICY(POLICY) \ @@ -87,30 +87,30 @@ public: #undef DECLARE_TARGET_POLICY - ///! Get the list of the PRE_BUILD custom commands for this target + //! Get the list of the PRE_BUILD custom commands for this target std::vector<cmCustomCommand> const& GetPreBuildCommands() const; void AddPreBuildCommand(cmCustomCommand const& cmd); - ///! Get the list of the PRE_LINK custom commands for this target + //! Get the list of the PRE_LINK custom commands for this target std::vector<cmCustomCommand> const& GetPreLinkCommands() const; void AddPreLinkCommand(cmCustomCommand const& cmd); - ///! Get the list of the POST_BUILD custom commands for this target + //! Get the list of the POST_BUILD custom commands for this target std::vector<cmCustomCommand> const& GetPostBuildCommands() const; void AddPostBuildCommand(cmCustomCommand const& cmd); - ///! Add sources to the target. + //! Add sources to the target. void AddSources(std::vector<std::string> const& srcs); void AddTracedSources(std::vector<std::string> const& srcs); cmSourceFile* AddSourceCMP0049(const std::string& src); cmSourceFile* AddSource(const std::string& src, bool before = false); - ///! how we identify a library, by name and type + //! how we identify a library, by name and type typedef std::pair<std::string, cmTargetLinkLibraryType> LibraryID; typedef std::vector<LibraryID> LinkLibraryVectorType; LinkLibraryVectorType const& GetOriginalLinkLibraries() const; - ///! Clear the dependency information recorded for this target, if any. + //! Clear the dependency information recorded for this target, if any. void ClearDependencyInformation(cmMakefile& mf); void AddLinkLibrary(cmMakefile& mf, const std::string& lib, @@ -159,23 +159,23 @@ public: * commands. It is not a full path nor does it have an extension. */ void AddUtility(std::string const& name, cmMakefile* mf = nullptr); - ///! Get the utilities used by this target + //! Get the utilities used by this target std::set<BT<std::string>> const& GetUtilities() const; - ///! Set/Get a property of this target file + //! Set/Get a property of this target file void SetProperty(const std::string& prop, const char* value); void AppendProperty(const std::string& prop, const char* value, bool asString = false); - ///! Might return a nullptr if the property is not set or invalid + //! Might return a nullptr if the property is not set or invalid const char* GetProperty(const std::string& prop) const; - ///! Always returns a valid pointer + //! Always returns a valid pointer const char* GetSafeProperty(const std::string& prop) const; bool GetPropertyAsBool(const std::string& prop) const; void CheckProperty(const std::string& prop, cmMakefile* context) const; const char* GetComputedProperty(const std::string& prop, cmMessenger* messenger, cmListFileBacktrace const& context) const; - ///! Get all properties + //! Get all properties cmPropertyMap const& GetProperties() const; bool IsImported() const; @@ -184,16 +184,16 @@ public: bool GetMappedConfig(std::string const& desired_config, const char** loc, const char** imp, std::string& suffix) const; - ///! Return whether this target is an executable with symbol exports enabled. + //! Return whether this target is an executable with symbol exports enabled. bool IsExecutableWithExports() const; - ///! Return whether this target is a shared library Framework on Apple. + //! Return whether this target is a shared library Framework on Apple. bool IsFrameworkOnApple() const; - ///! Return whether this target is an executable Bundle on Apple. + //! Return whether this target is an executable Bundle on Apple. bool IsAppBundleOnApple() const; - ///! Get a backtrace from the creation of the target. + //! Get a backtrace from the creation of the target. cmListFileBacktrace const& GetBacktrace() const; void InsertInclude(std::string const& entry, cmListFileBacktrace const& bt, diff --git a/Source/cmTest.h b/Source/cmTest.h index d4839d1..88dc730 100644 --- a/Source/cmTest.h +++ b/Source/cmTest.h @@ -26,14 +26,14 @@ public: cmTest(cmMakefile* mf); ~cmTest(); - ///! Set the test name + //! Set the test name void SetName(const std::string& name); std::string GetName() const { return this->Name; } void SetCommand(std::vector<std::string> const& command); std::vector<std::string> const& GetCommand() const { return this->Command; } - ///! Set/Get a property of this source file + //! Set/Get a property of this source file void SetProperty(const std::string& prop, const char* value); void AppendProperty(const std::string& prop, const char* value, bool asString = false); diff --git a/Source/cmake.h b/Source/cmake.h index 8d22f34..8b4b396 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -162,7 +162,7 @@ public: int Configure(); int ActualConfigure(); - ///! Break up a line like VAR:type="value" into var, type and value + //! Break up a line like VAR:type="value" into var, type and value static bool ParseCacheEntry(const std::string& entry, std::string& var, std::string& value, cmStateEnums::CacheEntryType& type); @@ -176,40 +176,40 @@ public: bool DeleteCache(const std::string& path); void PreLoadCMakeFiles(); - ///! Create a GlobalGenerator + //! Create a GlobalGenerator cmGlobalGenerator* CreateGlobalGenerator(const std::string& name); - ///! Return the global generator assigned to this instance of cmake + //! Return the global generator assigned to this instance of cmake cmGlobalGenerator* GetGlobalGenerator() { return this->GlobalGenerator; } - ///! Return the global generator assigned to this instance of cmake, const + //! Return the global generator assigned to this instance of cmake, const const cmGlobalGenerator* GetGlobalGenerator() const { return this->GlobalGenerator; } - ///! Return the full path to where the CMakeCache.txt file should be. + //! Return the full path to where the CMakeCache.txt file should be. static std::string FindCacheFile(const std::string& binaryDir); - ///! Return the global generator assigned to this instance of cmake + //! Return the global generator assigned to this instance of cmake void SetGlobalGenerator(cmGlobalGenerator*); - ///! Get the names of the current registered generators + //! Get the names of the current registered generators void GetRegisteredGenerators(std::vector<GeneratorInfo>& generators, bool includeNamesWithPlatform = true) const; - ///! Set the name of the selected generator-specific instance. + //! Set the name of the selected generator-specific instance. void SetGeneratorInstance(std::string const& instance) { this->GeneratorInstance = instance; } - ///! Set the name of the selected generator-specific platform. + //! Set the name of the selected generator-specific platform. void SetGeneratorPlatform(std::string const& ts) { this->GeneratorPlatform = ts; } - ///! Set the name of the selected generator-specific toolset. + //! Set the name of the selected generator-specific toolset. void SetGeneratorToolset(std::string const& ts) { this->GeneratorToolset = ts; @@ -244,7 +244,7 @@ public: * Given a variable name, return its value (as a string). */ const char* GetCacheDefinition(const std::string&) const; - ///! Add an entry into the cache + //! Add an entry into the cache void AddCacheEntry(const std::string& key, const char* value, const char* helpString, int type); @@ -263,14 +263,14 @@ public: */ int GetSystemInformation(std::vector<std::string>&); - ///! Parse command line arguments + //! Parse command line arguments void SetArgs(const std::vector<std::string>& args); - ///! Is this cmake running as a result of a TRY_COMPILE command + //! Is this cmake running as a result of a TRY_COMPILE command bool GetIsInTryCompile() const; void SetIsInTryCompile(bool b); - ///! Parse command line arguments that might set cache values + //! Parse command line arguments that might set cache values bool SetCacheArgs(const std::vector<std::string>&); using ProgressCallbackType = std::function<void(const std::string&, float)>; @@ -283,24 +283,24 @@ public: */ void SetProgressCallback(ProgressCallbackType f); - ///! this is called by generators to update the progress + //! this is called by generators to update the progress void UpdateProgress(const std::string& msg, float prog); #if defined(CMAKE_BUILD_WITH_CMAKE) - ///! Get the variable watch object + //! Get the variable watch object cmVariableWatch* GetVariableWatch() { return this->VariableWatch; } #endif std::vector<cmDocumentationEntry> GetGeneratorsDocumentation(); - ///! Set/Get a property of this target file + //! Set/Get a property of this target file void SetProperty(const std::string& prop, const char* value); void AppendProperty(const std::string& prop, const char* value, bool asString = false); const char* GetProperty(const std::string& prop); bool GetPropertyAsBool(const std::string& prop); - ///! Get or create an cmInstalledFile instance and return a pointer to it + //! Get or create an cmInstalledFile instance and return a pointer to it cmInstalledFile* GetOrCreateInstalledFile(cmMakefile* mf, const std::string& name); @@ -311,13 +311,13 @@ public: return this->InstalledFiles; } - ///! Do all the checks before running configure + //! Do all the checks before running configure int DoPreConfigureChecks(); void SetWorkingMode(WorkingMode mode) { this->CurrentWorkingMode = mode; } WorkingMode GetWorkingMode() { return this->CurrentWorkingMode; } - ///! Debug the try compile stuff by not deleting the files + //! Debug the try compile stuff by not deleting the files bool GetDebugTryCompile() { return this->DebugTryCompile; } void DebugTryCompileOn() { this->DebugTryCompile = true; } @@ -423,13 +423,13 @@ public: MessageType t, std::string const& text, cmListFileBacktrace const& backtrace = cmListFileBacktrace()) const; - ///! run the --build option + //! run the --build option int Build(int jobs, const std::string& dir, const std::vector<std::string>& targets, const std::string& config, const std::vector<std::string>& nativeOptions, bool clean, bool verbose); - ///! run the --open option + //! run the --open option bool Open(const std::string& dir, bool dryRun); void UnwatchUnusedCli(const std::string& var); @@ -462,12 +462,12 @@ protected: std::string GeneratorPlatform; std::string GeneratorToolset; - ///! read in a cmake list file to initialize the cache + //! read in a cmake list file to initialize the cache void ReadListFile(const std::vector<std::string>& args, const std::string& path); bool FindPackage(const std::vector<std::string>& args); - ///! Check if CMAKE_CACHEFILE_DIR is set. If it is not, delete the log file. + //! Check if CMAKE_CACHEFILE_DIR is set. If it is not, delete the log file. /// If it is set, truncate it to 50kb void TruncateOutputLog(const char* fname); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2d66567dca2a5a80e41493ec0a9d6d86f7d955f5 commit 2d66567dca2a5a80e41493ec0a9d6d86f7d955f5 Author: Artur Ryt <artur....@gmail.com> AuthorDate: Sat Mar 30 16:11:21 2019 +0100 Commit: Artur Ryt <artur....@gmail.com> CommitDate: Sat Mar 30 16:15:05 2019 +0100 Modernize: Prefer .substr in place of .c_str() + int A lot of temporary/local strings were created out of C-strings substr can utilize current string size, so in theory be a little more efficient. diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index da9575b..3ceb824 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -82,7 +82,7 @@ int cpackDefinitionArgument(const char* argument, const char* cValue, return 0; } std::string key = value.substr(0, pos); - value = value.c_str() + pos + 1; + value = value.substr(pos + 1); def->Map[key] = value; cmCPack_Log(def->Log, cmCPackLog::LOG_DEBUG, "Set CPack variable: " << key << " to \"" << value << "\"" diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 8ea9a83..8480309 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -387,7 +387,7 @@ int cmCTestBuildHandler::ProcessHandler() std::string srcdirrep; for (cc = srcdir.size() - 2; cc > 0; cc--) { if (srcdir[cc] == '/') { - srcdirrep = srcdir.c_str() + cc; + srcdirrep = srcdir.substr(cc); srcdirrep = "/..." + srcdirrep; srcdir = srcdir.substr(0, cc + 1); break; @@ -401,7 +401,7 @@ int cmCTestBuildHandler::ProcessHandler() std::string bindirrep; for (cc = bindir.size() - 2; cc > 0; cc--) { if (bindir[cc] == '/') { - bindirrep = bindir.c_str() + cc; + bindirrep = bindir.substr(cc); bindirrep = "/..." + bindirrep; bindir = bindir.substr(0, cc + 1); break; diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 11cd005..9d9761c 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -547,7 +547,7 @@ private: { // Look for header fields that we need. if (cmHasLiteralPrefix(this->Line, "commit ")) { - this->Rev.Rev = this->Line.c_str() + 7; + this->Rev.Rev = this->Line.substr(7); } else if (cmHasLiteralPrefix(this->Line, "author ")) { Person author; this->ParsePerson(this->Line.c_str() + 7, author); diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index 5e66e05..a96513e 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -308,7 +308,7 @@ void cmCTestLaunch::LoadLabels() if (line[0] == ' ') { // Label lines appear indented by one space. if (inTarget || inSource) { - this->Labels.insert(line.c_str() + 1); + this->Labels.insert(line.substr(1)); } } else if (!this->OptionSource.empty() && !inSource) { // Non-indented lines specify a source file name. The first one diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index b7a4e4c..04749b7 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -515,7 +515,7 @@ private: if (path.size() > this->SVN->SourceDirectory.size() && strncmp(path.c_str(), this->SVN->SourceDirectory.c_str(), this->SVN->SourceDirectory.size()) == 0) { - local_path = path.c_str() + this->SVN->SourceDirectory.size() + 1; + local_path = path.substr(this->SVN->SourceDirectory.size() + 1); } else { local_path = path; } @@ -554,7 +554,7 @@ std::string cmCTestSVN::SVNInfo::BuildLocalPath(std::string const& path) const // Add path with base prefix removed if (path.size() > this->Base.size() && strncmp(path.c_str(), this->Base.c_str(), this->Base.size()) == 0) { - local_path += (path.c_str() + this->Base.size()); + local_path += path.substr(this->Base.size()); } else { local_path += path; } diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index c9783e4..0ed56c8 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -2265,8 +2265,8 @@ bool cmCTestTestHandler::SetTestsProperties( size_t pos = val.find_first_of('='); if (pos != std::string::npos) { std::string mKey = val.substr(0, pos); - const char* mVal = val.c_str() + pos + 1; - rt.Measurements[mKey] = mVal; + std::string mVal = val.substr(pos + 1); + rt.Measurements[mKey] = std::move(mVal); } else { rt.Measurements[val] = "1"; } diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 3f036a9..178e18b 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -295,7 +295,7 @@ void cmDependsFortran::MatchRemoteModules(std::istream& fin, // They do not include the ".mod" extension. mod += ".mod"; } - this->ConsiderModule(mod.c_str() + 1, stampDir); + this->ConsiderModule(mod.substr(1), stampDir); } } else if (line == "provides") { doing_provides = true; diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx index 792db48..12d875d 100644 --- a/Source/cmDependsJavaParserHelper.cxx +++ b/Source/cmDependsJavaParserHelper.cxx @@ -5,6 +5,7 @@ #include "cmDependsJavaLexer.h" #include "cmSystemTools.h" +#include "cm_string_view.hxx" #include "cmsys/FStream.hxx" #include <iostream> #include <stdio.h> @@ -298,14 +299,10 @@ void cmDependsJavaParserHelper::Error(const char* str) unsigned long pos = static_cast<unsigned long>(this->InputBufferPos); fprintf(stderr, "JPError: %s (%lu / Line: %d)\n", str, pos, this->CurrentLine); - int cc; - std::cerr << "String: ["; - for (cc = 0; - cc < 30 && *(this->InputBuffer.c_str() + this->InputBufferPos + cc); - cc++) { - std::cerr << *(this->InputBuffer.c_str() + this->InputBufferPos + cc); - } - std::cerr << "]" << std::endl; + std::cerr << "String: [" + << cm::string_view{ this->InputBuffer }.substr( + this->InputBufferPos, 30) + << "]" << std::endl; } void cmDependsJavaParserHelper::UpdateCombine(const char* str1, diff --git a/Source/cmFileInstaller.cxx b/Source/cmFileInstaller.cxx index f3544c1..d4f76fd 100644 --- a/Source/cmFileInstaller.cxx +++ b/Source/cmFileInstaller.cxx @@ -319,7 +319,7 @@ bool cmFileInstaller::HandleInstallDestination() return false; } } - destination = sdestdir + (destination.c_str() + skip); + destination = sdestdir + destination.substr(skip); this->DestDirLength = int(sdestdir.size()); } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 2c145e0..40b8e19 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2266,7 +2266,7 @@ void cmLocalGenerator::JoinDefines(const std::set<std::string>& defines, def += define.substr(0, eq); if (eq != std::string::npos) { def += "="; - def += this->EscapeForShell(define.c_str() + eq + 1, true); + def += this->EscapeForShell(define.substr(eq + 1), true); } } definesString += itemSeparator; diff --git a/Source/cmTargetPropertyComputer.h b/Source/cmTargetPropertyComputer.h index 97e4fba..efbf95f 100644 --- a/Source/cmTargetPropertyComputer.h +++ b/Source/cmTargetPropertyComputer.h @@ -81,7 +81,7 @@ private: context)) { return nullptr; } - const char* configName = prop.c_str() + 9; + std::string configName = prop.substr(9); return ComputeLocation(tgt, configName); } diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 8d63971..9b635ea 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -620,7 +620,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) std::string const& a = *ai; if (cmHasLiteralPrefix(a, "--unset=")) { // Unset environment variable. - cmSystemTools::UnPutEnv(a.c_str() + 8); + cmSystemTools::UnPutEnv(a.substr(8)); } else if (!a.empty() && a[0] == '-') { // Environment variable and command names cannot start in '-', // so this must be an unknown option. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f13aef4de57a74db72c258edb78108da60a030f1 commit f13aef4de57a74db72c258edb78108da60a030f1 Author: Artur Ryt <artur....@gmail.com> AuthorDate: Sat Mar 30 15:37:36 2019 +0100 Commit: Artur Ryt <artur....@gmail.com> CommitDate: Sat Mar 30 15:39:45 2019 +0100 cmcmd: Modernize for loops with cmMakeRange Also minor loop variable renaming diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 757a46c..da84738 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -381,8 +381,7 @@ int cmcmd::HandleCoCompileCommands(std::vector<std::string> const& args) std::vector<std::string> orig_cmd; bool doing_options = true; - for (std::string::size_type i = 2; i < args.size(); ++i) { - std::string const& arg = args[i]; + for (std::string const& arg : cmMakeRange(args).advance(2)) { // if the arg is -- then the rest of the args after // go into orig_cmd if (arg == "--") { @@ -482,9 +481,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args) } // If error occurs we want to continue copying next files. bool return_value = false; - for (std::string::size_type cc = 2; cc < args.size() - 1; cc++) { - if (!cmsys::SystemTools::CopyFileAlways(args[cc], args.back())) { - std::cerr << "Error copying file \"" << args[cc] << "\" to \"" + for (auto const& arg : cmMakeRange(args).advance(2).retreat(1)) { + if (!cmsys::SystemTools::CopyFileAlways(arg, args.back())) { + std::cerr << "Error copying file \"" << arg << "\" to \"" << args.back() << "\".\n"; return_value = true; } @@ -504,9 +503,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args) } // If error occurs we want to continue copying next files. bool return_value = false; - for (std::string::size_type cc = 2; cc < args.size() - 1; cc++) { - if (!cmSystemTools::CopyFileIfDifferent(args[cc], args.back())) { - std::cerr << "Error copying file (if different) from \"" << args[cc] + for (auto const& arg : cmMakeRange(args).advance(2).retreat(1)) { + if (!cmSystemTools::CopyFileIfDifferent(arg, args.back())) { + std::cerr << "Error copying file (if different) from \"" << arg << "\" to \"" << args.back() << "\".\n"; return_value = true; } @@ -518,10 +517,10 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args) if (args[1] == "copy_directory" && args.size() > 3) { // If error occurs we want to continue copying next files. bool return_value = false; - for (std::string::size_type cc = 2; cc < args.size() - 1; cc++) { - if (!cmSystemTools::CopyADirectory(args[cc], args.back())) { - std::cerr << "Error copying directory from \"" << args[cc] - << "\" to \"" << args.back() << "\".\n"; + for (auto const& arg : cmMakeRange(args).advance(2).retreat(1)) { + if (!cmSystemTools::CopyADirectory(arg, args.back())) { + std::cerr << "Error copying directory from \"" << arg << "\" to \"" + << args.back() << "\".\n"; return_value = true; } } @@ -614,8 +613,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args) } if (args[1] == "env") { - std::vector<std::string>::const_iterator ai = args.begin() + 2; - std::vector<std::string>::const_iterator ae = args.end(); + auto ai = args.cbegin() + 2; + auto ae = args.cend(); for (; ai != ae; ++ai) { std::string const& a = *ai; if (cmHasLiteralPrefix(a, "--unset=")) { @@ -654,10 +653,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args) #if defined(CMAKE_BUILD_WITH_CMAKE) if (args[1] == "environment") { - std::vector<std::string> env = cmSystemTools::GetEnvironmentVariables(); - std::vector<std::string>::iterator it; - for (it = env.begin(); it != env.end(); ++it) { - std::cout << *it << std::endl; + for (auto const& env : cmSystemTools::GetEnvironmentVariables()) { + std::cout << env << std::endl; } return 0; } @@ -666,9 +663,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args) if (args[1] == "make_directory" && args.size() > 2) { // If error occurs we want to continue copying next files. bool return_value = false; - for (std::string::size_type cc = 2; cc < args.size(); cc++) { - if (!cmSystemTools::MakeDirectory(args[cc])) { - std::cerr << "Error creating directory \"" << args[cc] << "\".\n"; + for (auto const& arg : cmMakeRange(args).advance(2)) { + if (!cmSystemTools::MakeDirectory(arg)) { + std::cerr << "Error creating directory \"" << arg << "\".\n"; return_value = true; } } @@ -687,14 +684,14 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args) // Remove file if (args[1] == "remove" && args.size() > 2) { bool force = false; - for (std::string::size_type cc = 2; cc < args.size(); cc++) { - if (args[cc] == "\\-f" || args[cc] == "-f") { + for (auto const& arg : cmMakeRange(args).advance(2)) { + if (arg == "\\-f" || arg == "-f") { force = true; } else { // Complain if the file could not be removed, still exists, // and the -f option was not given. - if (!cmSystemTools::RemoveFile(args[cc]) && !force && - cmSystemTools::FileExists(args[cc])) { + if (!cmSystemTools::RemoveFile(arg) && !force && + cmSystemTools::FileExists(arg)) { return 1; } } @@ -704,10 +701,10 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args) // Touch file if (args[1] == "touch" && args.size() > 2) { - for (std::string::size_type cc = 2; cc < args.size(); cc++) { - if (!cmSystemTools::Touch(args[cc], true)) { + for (auto const& arg : cmMakeRange(args).advance(2)) { + if (!cmSystemTools::Touch(arg, true)) { std::cerr << "cmake -E touch: failed to update \""; - std::cerr << args[cc] << "\".\n"; + std::cerr << arg << "\".\n"; return 1; } } @@ -716,10 +713,10 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args) // Touch file if (args[1] == "touch_nocreate" && args.size() > 2) { - for (std::string::size_type cc = 2; cc < args.size(); cc++) { - if (!cmSystemTools::Touch(args[cc], false)) { + for (auto const& arg : cmMakeRange(args).advance(2)) { + if (!cmSystemTools::Touch(arg, false)) { std::cerr << "cmake -E touch_nocreate: failed to update \""; - std::cerr << args[cc] << "\".\n"; + std::cerr << arg << "\".\n"; return 1; } } @@ -744,15 +741,15 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args) // Sleep command if (args[1] == "sleep" && args.size() > 2) { double total = 0; - for (size_t i = 2; i < args.size(); ++i) { + for (auto const& arg : cmMakeRange(args).advance(2)) { double num = 0.0; char unit; char extra; - int n = sscanf(args[i].c_str(), "%lg%c%c", &num, &unit, &extra); + int n = sscanf(arg.c_str(), "%lg%c%c", &num, &unit, &extra); if ((n == 1 || (n == 2 && unit == 's')) && num >= 0) { total += num; } else { - std::cerr << "Unknown sleep time format \"" << args[i] << "\".\n"; + std::cerr << "Unknown sleep time format \"" << arg << "\".\n"; return 1; } } @@ -1047,8 +1044,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args) std::string mtime; std::string format; bool doing_options = true; - for (std::string::size_type cc = 4; cc < args.size(); cc++) { - std::string const& arg = args[cc]; + for (auto const& arg : cmMakeRange(args).advance(4)) { if (doing_options && cmHasLiteralPrefix(arg, "--")) { if (arg == "--") { doing_options = false; @@ -1180,17 +1176,15 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args) bool isDebug = false; std::string pipe; - for (size_t i = 2; i < args.size(); ++i) { - const std::string& a = args[i]; - - if (a == "--experimental") { + for (auto const& arg : cmMakeRange(args).advance(2)) { + if (arg == "--experimental") { supportExperimental = true; - } else if (a == "--debug") { + } else if (arg == "--debug") { pipe.clear(); isDebug = true; - } else if (a.substr(0, pipePrefix.size()) == pipePrefix) { + } else if (arg.substr(0, pipePrefix.size()) == pipePrefix) { isDebug = false; - pipe = a.substr(pipePrefix.size()); + pipe = arg.substr(pipePrefix.size()); if (pipe.empty()) { cmSystemTools::Error("No pipe given after --pipe="); return 2; @@ -1270,8 +1264,7 @@ int cmcmd::HashSumFile(std::vector<std::string> const& args, } int retval = 0; - for (std::string::size_type cc = 2; cc < args.size(); cc++) { - const char* filename = args[cc].c_str(); + for (auto const& filename : cmMakeRange(args).advance(2)) { // Cannot compute sum of a directory if (cmSystemTools::FileIsDirectory(filename)) { std::cerr << "Error: " << filename << " is a directory" << std::endl; @@ -1398,48 +1391,47 @@ int cmcmd::ExecuteEchoColor(std::vector<std::string> const& args) int color = cmsysTerminal_Color_Normal; bool newline = true; std::string progressDir; - for (unsigned int i = 2; i < args.size(); ++i) { - if (args[i].find("--switch=") == 0) { + for (auto const& arg : cmMakeRange(args).advance(2)) { + if (arg.find("--switch=") == 0) { // Enable or disable color based on the switch value. - std::string value = args[i].substr(9); + std::string value = arg.substr(9); if (!value.empty()) { enabled = cmSystemTools::IsOn(value); } - } else if (cmHasLiteralPrefix(args[i], "--progress-dir=")) { - progressDir = args[i].substr(15); - } else if (cmHasLiteralPrefix(args[i], "--progress-num=")) { + } else if (cmHasLiteralPrefix(arg, "--progress-dir=")) { + progressDir = arg.substr(15); + } else if (cmHasLiteralPrefix(arg, "--progress-num=")) { if (!progressDir.empty()) { - std::string const& progressNum = args[i].substr(15); + std::string const& progressNum = arg.substr(15); cmcmdProgressReport(progressDir, progressNum); } - } else if (args[i] == "--normal") { + } else if (arg == "--normal") { color = cmsysTerminal_Color_Normal; - } else if (args[i] == "--black") { + } else if (arg == "--black") { color = cmsysTerminal_Color_ForegroundBlack; - } else if (args[i] == "--red") { + } else if (arg == "--red") { color = cmsysTerminal_Color_ForegroundRed; - } else if (args[i] == "--green") { + } else if (arg == "--green") { color = cmsysTerminal_Color_ForegroundGreen; - } else if (args[i] == "--yellow") { + } else if (arg == "--yellow") { color = cmsysTerminal_Color_ForegroundYellow; - } else if (args[i] == "--blue") { + } else if (arg == "--blue") { color = cmsysTerminal_Color_ForegroundBlue; - } else if (args[i] == "--magenta") { + } else if (arg == "--magenta") { color = cmsysTerminal_Color_ForegroundMagenta; - } else if (args[i] == "--cyan") { + } else if (arg == "--cyan") { color = cmsysTerminal_Color_ForegroundCyan; - } else if (args[i] == "--white") { + } else if (arg == "--white") { color = cmsysTerminal_Color_ForegroundWhite; - } else if (args[i] == "--bold") { + } else if (arg == "--bold") { color |= cmsysTerminal_Color_ForegroundBold; - } else if (args[i] == "--no-newline") { + } else if (arg == "--no-newline") { newline = false; - } else if (args[i] == "--newline") { + } else if (arg == "--newline") { newline = true; } else { // Color is enabled. Print with the current color. - cmSystemTools::MakefileColorEcho(color, args[i].c_str(), newline, - enabled); + cmSystemTools::MakefileColorEcho(color, arg.c_str(), newline, enabled); } } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e9bbfdd9a115332deb40da10784d478f4930c68f commit e9bbfdd9a115332deb40da10784d478f4930c68f Author: Artur Ryt <artur....@gmail.com> AuthorDate: Sat Mar 30 15:34:59 2019 +0100 Commit: Artur Ryt <artur....@gmail.com> CommitDate: Sat Mar 30 15:34:59 2019 +0100 cmcmd: Pass args vector by const& diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 8d63971..757a46c 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -368,7 +368,7 @@ struct CoCompileJob }; // called when args[0] == "__run_co_compile" -int cmcmd::HandleCoCompileCommands(std::vector<std::string>& args) +int cmcmd::HandleCoCompileCommands(std::vector<std::string> const& args) { std::vector<CoCompileJob> jobs; std::string sourceFile; // store --source= @@ -466,7 +466,7 @@ int cmcmd::HandleCoCompileCommands(std::vector<std::string>& args) return ret; } -int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) +int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args) { // IF YOU ADD A NEW COMMAND, DOCUMENT IT ABOVE and in cmakemain.cxx if (args.size() > 1) { @@ -1262,7 +1262,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) return 1; } -int cmcmd::HashSumFile(std::vector<std::string>& args, cmCryptoHash::Algo algo) +int cmcmd::HashSumFile(std::vector<std::string> const& args, + cmCryptoHash::Algo algo) { if (args.size() < 3) { return -1; @@ -1289,7 +1290,7 @@ int cmcmd::HashSumFile(std::vector<std::string>& args, cmCryptoHash::Algo algo) return retval; } -int cmcmd::SymlinkLibrary(std::vector<std::string>& args) +int cmcmd::SymlinkLibrary(std::vector<std::string> const& args) { int result = 0; std::string realName = args[2]; @@ -1313,7 +1314,7 @@ int cmcmd::SymlinkLibrary(std::vector<std::string>& args) return result; } -int cmcmd::SymlinkExecutable(std::vector<std::string>& args) +int cmcmd::SymlinkExecutable(std::vector<std::string> const& args) { int result = 0; std::string const& realName = args[2]; @@ -1387,7 +1388,7 @@ static void cmcmdProgressReport(std::string const& dir, std::string const& num) } } -int cmcmd::ExecuteEchoColor(std::vector<std::string>& args) +int cmcmd::ExecuteEchoColor(std::vector<std::string> const& args) { // The arguments are // args[0] == <cmake-executable> @@ -1445,7 +1446,7 @@ int cmcmd::ExecuteEchoColor(std::vector<std::string>& args) return 0; } -int cmcmd::ExecuteLinkScript(std::vector<std::string>& args) +int cmcmd::ExecuteLinkScript(std::vector<std::string> const& args) { // The arguments are // args[0] == <cmake-executable> @@ -1658,9 +1659,9 @@ std::ostream& operator<<(std::ostream& stream, return stream; } -static bool RunCommand(const char* comment, std::vector<std::string>& command, - bool verbose, NumberFormat exitFormat, - int* retCodeOut = nullptr, +static bool RunCommand(const char* comment, + std::vector<std::string> const& command, bool verbose, + NumberFormat exitFormat, int* retCodeOut = nullptr, bool (*retCodeOkay)(int) = nullptr) { if (verbose) { diff --git a/Source/cmcmd.h b/Source/cmcmd.h index d1e03d0..69a7ecb 100644 --- a/Source/cmcmd.h +++ b/Source/cmcmd.h @@ -16,18 +16,18 @@ public: * Execute commands during the build process. Supports options such * as echo, remove file etc. */ - static int ExecuteCMakeCommand(std::vector<std::string>&); + static int ExecuteCMakeCommand(std::vector<std::string> const&); protected: - static int HandleCoCompileCommands(std::vector<std::string>& args); - static int HashSumFile(std::vector<std::string>& args, + static int HandleCoCompileCommands(std::vector<std::string> const& args); + static int HashSumFile(std::vector<std::string> const& args, cmCryptoHash::Algo algo); - static int SymlinkLibrary(std::vector<std::string>& args); - static int SymlinkExecutable(std::vector<std::string>& args); + static int SymlinkLibrary(std::vector<std::string> const& args); + static int SymlinkExecutable(std::vector<std::string> const& args); static bool SymlinkInternal(std::string const& file, std::string const& link); - static int ExecuteEchoColor(std::vector<std::string>& args); - static int ExecuteLinkScript(std::vector<std::string>& args); + static int ExecuteEchoColor(std::vector<std::string> const& args); + static int ExecuteLinkScript(std::vector<std::string> const& args); static int WindowsCEEnvironment(const char* version, const std::string& name); static int VisualStudioLink(std::vector<std::string> const& args, int type); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7d19b3091d7d2982a0d6b2b4408011efbb56f167 commit 7d19b3091d7d2982a0d6b2b4408011efbb56f167 Author: Ruslan Baratov <ruslan_bara...@yahoo.com> AuthorDate: Fri Mar 29 18:53:12 2019 +0300 Commit: Ruslan Baratov <ruslan_bara...@yahoo.com> CommitDate: Fri Mar 29 18:53:12 2019 +0300 Release note for CMAKE_PROJECT_INCLUDE variable diff --git a/Help/release/dev/project-include.rst b/Help/release/dev/project-include.rst new file mode 100644 index 0000000..659e933 --- /dev/null +++ b/Help/release/dev/project-include.rst @@ -0,0 +1,5 @@ +cmake_project_include +--------------------- + +* A variable :variable:`CMAKE_PROJECT_INCLUDE` was added to allow injection + of custom code into the project without knowing the project name a priori. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dda01904587627a3d2bda5b684f7bef1e62596bb commit dda01904587627a3d2bda5b684f7bef1e62596bb Author: Ruslan Baratov <ruslan_bara...@yahoo.com> AuthorDate: Wed Mar 27 22:36:51 2019 +0300 Commit: Ruslan Baratov <ruslan_bara...@yahoo.com> CommitDate: Wed Mar 27 22:39:02 2019 +0300 project: Add variable CMAKE_PROJECT_INCLUDE diff --git a/Help/command/project.rst b/Help/command/project.rst index 688e56c..a95012d 100644 --- a/Help/command/project.rst +++ b/Help/command/project.rst @@ -31,9 +31,9 @@ Further variables are set by the optional arguments described in the following. If any of these arguments is not used, then the corresponding variables are set to the empty string. -If the variable :variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE` exists, -the file pointed to by that variable will be included as the last step of the -project command. +If the variable :variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE` +or :variable:`CMAKE_PROJECT_INCLUDE` exists, the file pointed to by that +variable will be included as the last step of the project command. Options ^^^^^^^ diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 48d7550..e1584ef 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -195,6 +195,7 @@ Variables that Change Behavior /variable/CMAKE_POLICY_WARNING_CMPNNNN /variable/CMAKE_PREFIX_PATH /variable/CMAKE_PROGRAM_PATH + /variable/CMAKE_PROJECT_INCLUDE /variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE /variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY /variable/CMAKE_STAGING_PREFIX diff --git a/Help/variable/CMAKE_PROJECT_INCLUDE.rst b/Help/variable/CMAKE_PROJECT_INCLUDE.rst new file mode 100644 index 0000000..7de767a --- /dev/null +++ b/Help/variable/CMAKE_PROJECT_INCLUDE.rst @@ -0,0 +1,6 @@ +CMAKE_PROJECT_INCLUDE +--------------------- + +A CMake language file or module to be included by the :command:`project` +command. This is intended for injecting custom code into project +builds without modifying their source. diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index 2fe9fe8..de5d1ed 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -319,21 +319,41 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args, languages.emplace_back("CXX"); } this->Makefile->EnableLanguage(languages, false); - std::string extraInclude = "CMAKE_PROJECT_" + projectName + "_INCLUDE"; - const char* include = this->Makefile->GetDefinition(extraInclude); - if (include) { - bool readit = this->Makefile->ReadDependentFile(include); - if (!readit && !cmSystemTools::GetFatalErrorOccured()) { - std::string m = "could not find file:\n" - " "; - m += include; - this->SetError(m); - return false; - } + + if (!this->IncludeByVariable("CMAKE_PROJECT_INCLUDE")) { + return false; + } + + if (!this->IncludeByVariable("CMAKE_PROJECT_" + projectName + "_INCLUDE")) { + return false; } + return true; } +bool cmProjectCommand::IncludeByVariable(const std::string& variable) +{ + const char* include = this->Makefile->GetDefinition(variable); + if (!include) { + return true; + } + + const bool readit = this->Makefile->ReadDependentFile(include); + if (readit) { + return true; + } + + if (cmSystemTools::GetFatalErrorOccured()) { + return true; + } + + std::string m = "could not find file:\n" + " "; + m += include; + this->SetError(m); + return false; +} + void cmProjectCommand::TopLevelCMakeVarCondSet(const char* const name, const char* const value) { diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h index 365d448..f1d03e7 100644 --- a/Source/cmProjectCommand.h +++ b/Source/cmProjectCommand.h @@ -36,6 +36,7 @@ public: cmExecutionStatus& status) override; private: + bool IncludeByVariable(const std::string& variable); void TopLevelCMakeVarCondSet(const char* name, const char* value); }; diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt index f40524f..57f0cf8 100644 --- a/Tests/CMakeOnly/CMakeLists.txt +++ b/Tests/CMakeOnly/CMakeLists.txt @@ -56,6 +56,12 @@ add_test(CMakeOnly.ProjectInclude ${CMAKE_CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/Test.cmake ) +add_test(CMakeOnly.ProjectIncludeAny ${CMAKE_CMAKE_COMMAND} + -DTEST=ProjectIncludeAny + -DCMAKE_ARGS=-DCMAKE_PROJECT_INCLUDE=${CMAKE_CURRENT_SOURCE_DIR}/ProjectInclude/include.cmake + -P ${CMAKE_CURRENT_BINARY_DIR}/Test.cmake + ) + include(CMakeParseArguments) function(add_major_test module) diff --git a/Tests/CMakeOnly/ProjectIncludeAny/CMakeLists.txt b/Tests/CMakeOnly/ProjectIncludeAny/CMakeLists.txt new file mode 100644 index 0000000..ffce488 --- /dev/null +++ b/Tests/CMakeOnly/ProjectIncludeAny/CMakeLists.txt @@ -0,0 +1,4 @@ +project(ProjectInclude LANGUAGES NONE) +if(NOT AUTO_INCLUDE) + message(FATAL_ERROR "include file not found") +endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=390f14a24416f23801f5644eb51590f8317d35c7 commit 390f14a24416f23801f5644eb51590f8317d35c7 Author: Ruslan Baratov <ruslan_bara...@yahoo.com> AuthorDate: Wed Mar 27 22:33:37 2019 +0300 Commit: Ruslan Baratov <ruslan_bara...@yahoo.com> CommitDate: Wed Mar 27 22:33:37 2019 +0300 Test ProjectInclude: Add NONE to avoid enabling languages diff --git a/Tests/CMakeOnly/ProjectInclude/CMakeLists.txt b/Tests/CMakeOnly/ProjectInclude/CMakeLists.txt index a9abb4a..ffce488 100644 --- a/Tests/CMakeOnly/ProjectInclude/CMakeLists.txt +++ b/Tests/CMakeOnly/ProjectInclude/CMakeLists.txt @@ -1,4 +1,4 @@ -project(ProjectInclude) +project(ProjectInclude LANGUAGES NONE) if(NOT AUTO_INCLUDE) message(FATAL_ERROR "include file not found") endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=87341d8328c7b3a1d50cfd534ff4cb44334a2561 commit 87341d8328c7b3a1d50cfd534ff4cb44334a2561 Author: Sebastian Holtermann <sebh...@xwmw.org> AuthorDate: Wed Mar 27 15:50:17 2019 +0100 Commit: Sebastian Holtermann <sebh...@xwmw.org> CommitDate: Wed Mar 27 18:12:43 2019 +0100 cmDepends: Define DependencyMap instead of DependencyVector In `cmDepends` use `typedef std::map<std::string, std::vector<std::string>> DependencyMap` instead of defining a `class DependencyVector : public std::vector<std::string>` and using it in `std::map<std::string, DependencyVector>`. Since `std::map<std::string, std::vector<std::string>>` is used in various other places, we now reuse all of it's auto generated methods. This doesn't happen when we use `DependencyVector` in a `std::map`, because it is a different class than `std::vector<std::string>`. diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index 334f1e5..ed76dbf 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -61,7 +61,7 @@ bool cmDepends::Finalize(std::ostream& /*unused*/, std::ostream& /*unused*/) bool cmDepends::Check(const std::string& makeFile, const std::string& internalFile, - std::map<std::string, DependencyVector>& validDeps) + DependencyMap& validDeps) { // Check whether dependencies must be regenerated. bool okay = true; @@ -101,9 +101,9 @@ bool cmDepends::WriteDependencies(const std::set<std::string>& /*unused*/, return false; } -bool cmDepends::CheckDependencies( - std::istream& internalDepends, const std::string& internalDependsFileName, - std::map<std::string, DependencyVector>& validDeps) +bool cmDepends::CheckDependencies(std::istream& internalDepends, + const std::string& internalDependsFileName, + DependencyMap& validDeps) { // Read internal depends file time cmFileTime internalDependsTime; @@ -124,7 +124,7 @@ bool cmDepends::CheckDependencies( std::string dependee; cmFileTime dependerTime; cmFileTime dependeeTime; - DependencyVector* currentDependencies = nullptr; + std::vector<std::string>* currentDependencies = nullptr; while (std::getline(internalDepends, line)) { // Check if this an empty or a comment line diff --git a/Source/cmDepends.h b/Source/cmDepends.h index d9d5c67..b7475f0 100644 --- a/Source/cmDepends.h +++ b/Source/cmDepends.h @@ -24,6 +24,9 @@ class cmLocalGenerator; class cmDepends { public: + typedef std::map<std::string, std::vector<std::string>> DependencyMap; + +public: /** Instances need to know the build directory name and the relative path from the build directory to the target file. */ cmDepends(cmLocalGenerator* lg = nullptr, std::string targetDir = ""); @@ -55,17 +58,13 @@ public: /** Write dependencies for the target file. */ bool Write(std::ostream& makeDepends, std::ostream& internalDepends); - class DependencyVector : public std::vector<std::string> - { - }; - /** Check dependencies for the target file. Returns true if dependencies are okay and false if they must be generated. If they must be generated Clear has already been called to wipe out the old dependencies. Dependencies which are still valid will be stored in validDeps. */ bool Check(const std::string& makeFile, const std::string& internalFile, - std::map<std::string, DependencyVector>& validDeps); + DependencyMap& validDeps); /** Clear dependencies for the target file so they will be regenerated. */ void Clear(const std::string& file); @@ -84,9 +83,9 @@ protected: // Check dependencies for the target file in the given stream. // Return false if dependencies must be regenerated and true // otherwise. - virtual bool CheckDependencies( - std::istream& internalDepends, const std::string& internalDependsFileName, - std::map<std::string, DependencyVector>& validDeps); + virtual bool CheckDependencies(std::istream& internalDepends, + const std::string& internalDependsFileName, + DependencyMap& validDeps); // Finalize the dependency information for the target. virtual bool Finalize(std::ostream& makeDepends, diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 7b78767..dc49c18 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -21,9 +21,8 @@ cmDependsC::cmDependsC() = default; -cmDependsC::cmDependsC( - cmLocalGenerator* lg, const std::string& targetDir, const std::string& lang, - const std::map<std::string, DependencyVector>* validDeps) +cmDependsC::cmDependsC(cmLocalGenerator* lg, const std::string& targetDir, + const std::string& lang, const DependencyMap* validDeps) : cmDepends(lg, targetDir) , ValidDeps(validDeps) { @@ -102,8 +101,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources, this->LocalGenerator->MaybeConvertToRelativePath(binDir, obj); if (this->ValidDeps != nullptr) { - std::map<std::string, DependencyVector>::const_iterator tmpIt = - this->ValidDeps->find(obj_i); + auto const tmpIt = this->ValidDeps->find(obj_i); if (tmpIt != this->ValidDeps->end()) { dependencies.insert(tmpIt->second.begin(), tmpIt->second.end()); haveDeps = true; diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h index eee5ae1..3fc839e 100644 --- a/Source/cmDependsC.h +++ b/Source/cmDependsC.h @@ -27,8 +27,7 @@ public: relative path from the build directory to the target file. */ cmDependsC(); cmDependsC(cmLocalGenerator* lg, const std::string& targetDir, - const std::string& lang, - const std::map<std::string, DependencyVector>* validDeps); + const std::string& lang, const DependencyMap* validDeps); /** Virtual destructor to cleanup subclasses properly. */ ~cmDependsC() override; @@ -81,7 +80,7 @@ public: }; protected: - const std::map<std::string, DependencyVector>* ValidDeps = nullptr; + const DependencyMap* ValidDeps = nullptr; std::set<std::string> Encountered; std::queue<UnscannedEntry> Unscanned; diff --git a/Source/cmDependsJava.cxx b/Source/cmDependsJava.cxx index 2485e15..b17b2ba 100644 --- a/Source/cmDependsJava.cxx +++ b/Source/cmDependsJava.cxx @@ -24,8 +24,7 @@ bool cmDependsJava::WriteDependencies(const std::set<std::string>& sources, bool cmDependsJava::CheckDependencies( std::istream& /*internalDepends*/, - const std::string& /*internalDependsFileName*/, - std::map<std::string, DependencyVector>& /*validDeps*/) + const std::string& /*internalDependsFileName*/, DependencyMap& /*validDeps*/) { return true; } diff --git a/Source/cmDependsJava.h b/Source/cmDependsJava.h index 109ef13..dd671a1 100644 --- a/Source/cmDependsJava.h +++ b/Source/cmDependsJava.h @@ -8,7 +8,6 @@ #include "cmDepends.h" #include <iosfwd> -#include <map> #include <set> #include <string> @@ -33,9 +32,9 @@ protected: bool WriteDependencies(const std::set<std::string>& sources, const std::string& file, std::ostream& makeDepends, std::ostream& internalDepends) override; - bool CheckDependencies( - std::istream& internalDepends, const std::string& internalDependsFileName, - std::map<std::string, DependencyVector>& validDeps) override; + bool CheckDependencies(std::istream& internalDepends, + const std::string& internalDependsFileName, + DependencyMap& validDeps) override; }; #endif diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index f3d5a94..2857d39 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1312,7 +1312,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies( // The build.make file may have explicit dependencies for the object // files but these will not affect the scanning process so they need // not be considered. - std::map<std::string, cmDepends::DependencyVector> validDependencies; + cmDepends::DependencyMap validDependencies; bool needRescanDependencies = false; if (!needRescanDirInfo) { cmDependsC checker; @@ -1352,8 +1352,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies( bool cmLocalUnixMakefileGenerator3::ScanDependencies( std::string const& targetDir, std::string const& dependFile, - std::string const& internalDependFile, - std::map<std::string, cmDepends::DependencyVector>& validDeps) + std::string const& internalDependFile, cmDepends::DependencyMap& validDeps) { // Read the directory information file. cmMakefile* mf = this->Makefile; diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index ba882da..7a0ea98 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -143,8 +143,7 @@ public: // File pairs for implicit dependency scanning. The key of the map // is the depender and the value is the explicit dependee. - struct ImplicitDependFileMap - : public std::map<std::string, cmDepends::DependencyVector> + struct ImplicitDependFileMap : public cmDepends::DependencyMap { }; struct ImplicitDependLanguageMap @@ -230,10 +229,10 @@ protected: const char* filename = nullptr); // Helper methods for dependency updates. - bool ScanDependencies( - std::string const& targetDir, std::string const& dependFile, - std::string const& internalDependFile, - std::map<std::string, cmDepends::DependencyVector>& validDeps); + bool ScanDependencies(std::string const& targetDir, + std::string const& dependFile, + std::string const& internalDependFile, + cmDepends::DependencyMap& validDeps); void CheckMultipleOutputs(bool verbose); private: https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5a15c9e7cb63fb5b884271a1184607a8fa87d442 commit 5a15c9e7cb63fb5b884271a1184607a8fa87d442 Author: Sebastian Holtermann <sebh...@xwmw.org> AuthorDate: Wed Mar 27 14:35:05 2019 +0100 Commit: Sebastian Holtermann <sebh...@xwmw.org> CommitDate: Wed Mar 27 18:11:36 2019 +0100 cmDepends: Refactor cmDepends::CheckDependencies method This patch changes the following issues in `cmDepends::CheckDependencies`: - Use the `std::string` based `std::getline` interface to read lines from a file instead of using raw reads into raw buffers. - To reduce the file system access, we load file times only once from `cmFileTimeCache` and keep them on the stack for later comparison. - When a file is removed from the file system we remove it from the `cmFileTimeCache` as well. diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index efadaf1..334f1e5 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmDepends.h" +#include "cmFileTime.h" #include "cmFileTimeCache.h" #include "cmGeneratedFileStream.h" #include "cmLocalGenerator.h" @@ -10,22 +11,15 @@ #include "cmsys/FStream.hxx" #include <sstream> -#include <string.h> #include <utility> cmDepends::cmDepends(cmLocalGenerator* lg, std::string targetDir) : LocalGenerator(lg) , TargetDirectory(std::move(targetDir)) - , Dependee(new char[MaxPath]) - , Depender(new char[MaxPath]) { } -cmDepends::~cmDepends() -{ - delete[] this->Dependee; - delete[] this->Depender; -} +cmDepends::~cmDepends() = default; bool cmDepends::Write(std::ostream& makeDepends, std::ostream& internalDepends) { @@ -76,9 +70,9 @@ bool cmDepends::Check(const std::string& makeFile, // Clear all dependencies so they will be regenerated. this->Clear(makeFile); cmSystemTools::RemoveFile(internalFile); + this->FileTimeCache->Remove(internalFile); okay = false; } - return okay; } @@ -111,44 +105,58 @@ bool cmDepends::CheckDependencies( std::istream& internalDepends, const std::string& internalDependsFileName, std::map<std::string, DependencyVector>& validDeps) { + // Read internal depends file time + cmFileTime internalDependsTime; + if (!this->FileTimeCache->Load(internalDependsFileName, + internalDependsTime)) { + return false; + } + // Parse dependencies from the stream. If any dependee is missing // or newer than the depender then dependencies should be // regenerated. bool okay = true; bool dependerExists = false; + + std::string line; + line.reserve(1024); + std::string depender; + std::string dependee; + cmFileTime dependerTime; + cmFileTime dependeeTime; DependencyVector* currentDependencies = nullptr; - while (internalDepends.getline(this->Dependee, this->MaxPath)) { - if (this->Dependee[0] == 0 || this->Dependee[0] == '#' || - this->Dependee[0] == '\r') { + while (std::getline(internalDepends, line)) { + // Check if this an empty or a comment line + if (line.empty() || line.front() == '#') { continue; } - size_t len = internalDepends.gcount() - 1; - if (this->Dependee[len - 1] == '\r') { - len--; - this->Dependee[len] = 0; + // Drop carriage return character at the end + if (line.back() == '\r') { + line.pop_back(); + if (line.empty()) { + continue; + } } - if (this->Dependee[0] != ' ') { - memcpy(this->Depender, this->Dependee, len + 1); - // Calling FileExists() for the depender here saves in many cases 50% - // of the calls to FileExists() further down in the loop. E.g. for - // kdelibs/khtml this reduces the number of calls from 184k down to 92k, - // or the time for cmake -E cmake_depends from 0.3 s down to 0.21 s. - dependerExists = cmSystemTools::FileExists(this->Depender); + // Check if this a depender line + if (line.front() != ' ') { + depender = line; + dependerExists = this->FileTimeCache->Load(depender, dependerTime); // If we erase validDeps[this->Depender] by overwriting it with an empty // vector, we lose dependencies for dependers that have multiple // entries. No need to initialize the entry, std::map will do so on first // access. - currentDependencies = &validDeps[this->Depender]; + currentDependencies = &validDeps[depender]; continue; } - /* - // Parse the dependency line. - if(!this->ParseDependency(line.c_str())) - { - continue; - } - */ + + // This is a dependee line + dependee = line.substr(1); + + // Add dependee to depender's list + if (currentDependencies != nullptr) { + currentDependencies->push_back(dependee); + } // Dependencies must be regenerated // * if the dependee does not exist @@ -156,13 +164,8 @@ bool cmDepends::CheckDependencies( // * if the depender does not exist, but the dependee is newer than the // depends file bool regenerate = false; - const std::string dependee(this->Dependee + 1); - const std::string depender(this->Depender); - if (currentDependencies != nullptr) { - currentDependencies->push_back(dependee); - } - - if (!cmSystemTools::FileExists(dependee)) { + bool dependeeExists = this->FileTimeCache->Load(dependee, dependeeTime); + if (!dependeeExists) { // The dependee does not exist. regenerate = true; @@ -173,44 +176,38 @@ bool cmDepends::CheckDependencies( << depender << "\"." << std::endl; cmSystemTools::Stdout(msg.str()); } - } else { - if (dependerExists) { - // The dependee and depender both exist. Compare file times. - int result = 0; - if ((!this->FileTimeCache->Compare(depender, dependee, &result) || - result < 0)) { - // The depender is older than the dependee. - regenerate = true; - - // Print verbose output. - if (this->Verbose) { - std::ostringstream msg; - msg << "Dependee \"" << dependee << "\" is newer than depender \"" - << depender << "\"." << std::endl; - cmSystemTools::Stdout(msg.str()); - } + } else if (dependerExists) { + // The dependee and depender both exist. Compare file times. + if (dependerTime.Older(dependeeTime)) { + // The depender is older than the dependee. + regenerate = true; + + // Print verbose output. + if (this->Verbose) { + std::ostringstream msg; + msg << "Dependee \"" << dependee << "\" is newer than depender \"" + << depender << "\"." << std::endl; + cmSystemTools::Stdout(msg.str()); } - } else { - // The dependee exists, but the depender doesn't. Regenerate if the - // internalDepends file is older than the dependee. - int result = 0; - if ((!this->FileTimeCache->Compare(internalDependsFileName, dependee, - &result) || - result < 0)) { - // The depends-file is older than the dependee. - regenerate = true; - - // Print verbose output. - if (this->Verbose) { - std::ostringstream msg; - msg << "Dependee \"" << dependee - << "\" is newer than depends file \"" - << internalDependsFileName << "\"." << std::endl; - cmSystemTools::Stdout(msg.str()); - } + } + } else { + // The dependee exists, but the depender doesn't. Regenerate if the + // internalDepends file is older than the dependee. + if (internalDependsTime.Older(dependeeTime)) { + // The depends-file is older than the dependee. + regenerate = true; + + // Print verbose output. + if (this->Verbose) { + std::ostringstream msg; + msg << "Dependee \"" << dependee + << "\" is newer than depends file \"" << internalDependsFileName + << "\"." << std::endl; + cmSystemTools::Stdout(msg.str()); } } } + if (regenerate) { // Dependencies must be regenerated. okay = false; @@ -218,13 +215,14 @@ bool cmDepends::CheckDependencies( // Remove the information of this depender from the map, it needs // to be rescanned if (currentDependencies != nullptr) { - validDeps.erase(this->Depender); + validDeps.erase(depender); currentDependencies = nullptr; } // Remove the depender to be sure it is rebuilt. if (dependerExists) { cmSystemTools::RemoveFile(depender); + this->FileTimeCache->Remove(depender); dependerExists = false; } } diff --git a/Source/cmDepends.h b/Source/cmDepends.h index fc6571d..d9d5c67 100644 --- a/Source/cmDepends.h +++ b/Source/cmDepends.h @@ -8,7 +8,6 @@ #include <iosfwd> #include <map> #include <set> -#include <stddef.h> #include <string> #include <vector> @@ -105,10 +104,6 @@ protected: // The full path to the target's build directory. std::string TargetDirectory; - size_t MaxPath = 16384; - char* Dependee; - char* Depender; - // The include file search path. std::vector<std::string> IncludePath; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5f6c236481da552dfdbfff6579dc9d833993adad commit 5f6c236481da552dfdbfff6579dc9d833993adad Author: Sebastian Holtermann <sebh...@xwmw.org> AuthorDate: Wed Mar 27 13:43:08 2019 +0100 Commit: Sebastian Holtermann <sebh...@xwmw.org> CommitDate: Wed Mar 27 18:09:53 2019 +0100 cmFiletimeCache: Add cmFiletimeCache::Remove method diff --git a/Source/cmFileTimeCache.cxx b/Source/cmFileTimeCache.cxx index 1fff6a9..24d6bf6 100644 --- a/Source/cmFileTimeCache.cxx +++ b/Source/cmFileTimeCache.cxx @@ -14,8 +14,8 @@ bool cmFileTimeCache::Load(std::string const& fileName, cmFileTime& fileTime) { // Use the stored time if available. { - auto fit = this->FileTimes.find(fileName); - if (fit != this->FileTimes.end()) { + auto fit = this->Cache.find(fileName); + if (fit != this->Cache.end()) { fileTime = fit->second; return true; } @@ -25,10 +25,15 @@ bool cmFileTimeCache::Load(std::string const& fileName, cmFileTime& fileTime) return false; } // Store file time in cache - this->FileTimes[fileName] = fileTime; + this->Cache[fileName] = fileTime; return true; } +bool cmFileTimeCache::Remove(std::string const& fileName) +{ + return (this->Cache.erase(fileName) != 0); +} + bool cmFileTimeCache::Compare(std::string const& f1, std::string const& f2, int* result) { diff --git a/Source/cmFileTimeCache.h b/Source/cmFileTimeCache.h index a47904c..4f1a3a2 100644 --- a/Source/cmFileTimeCache.h +++ b/Source/cmFileTimeCache.h @@ -5,7 +5,7 @@ #include "cmConfigure.h" // IWYU pragma: keep -#include "cmFileTime.h" +#include "cmFileTime.h" // IWYU pragma: keep #include <string> #include <unordered_map> @@ -28,6 +28,12 @@ public: bool Load(std::string const& fileName, cmFileTime& fileTime); /** + * @brief Removes a file time from the cache + * @return true if the file was found in the cache and removed + */ + bool Remove(std::string const& fileName); + + /** * @brief Compare file modification times. * @return true for successful comparison and false for error. * @@ -44,8 +50,7 @@ public: bool DifferS(std::string const& f1, std::string const& f2); private: - typedef std::unordered_map<std::string, cmFileTime> FileTimeMap; - FileTimeMap FileTimes; + std::unordered_map<std::string, cmFileTime> Cache; }; #endif https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=18c30786a9a1444e726e23366dd9badb01f1d464 commit 18c30786a9a1444e726e23366dd9badb01f1d464 Author: Sebastian Holtermann <sebh...@xwmw.org> AuthorDate: Wed Mar 27 15:19:28 2019 +0100 Commit: Sebastian Holtermann <sebh...@xwmw.org> CommitDate: Wed Mar 27 18:09:53 2019 +0100 cmFileTime: Make cmFileTime::Compare method const diff --git a/Source/cmFileTime.h b/Source/cmFileTime.h index 4c8e556..d4de4e0 100644 --- a/Source/cmFileTime.h +++ b/Source/cmFileTime.h @@ -50,7 +50,7 @@ public: * @brief Compare file modification times. * @return -1, 0, +1 for this older, same, or newer than ftm. */ - int Compare(cmFileTime const& ftm) + int Compare(cmFileTime const& ftm) const { NSC const diff = this->NS - ftm.NS; if (diff == 0) { ----------------------------------------------------------------------- Summary of changes: Help/command/project.rst | 6 +- Help/manual/cmake-variables.7.rst | 1 + Help/release/dev/project-include.rst | 5 + ...-NAME_INCLUDE.rst => CMAKE_PROJECT_INCLUDE.rst} | 4 +- Source/CPack/cpack.cxx | 2 +- Source/CTest/cmCTestBuildAndTestHandler.h | 2 +- Source/CTest/cmCTestBuildHandler.cxx | 4 +- Source/CTest/cmCTestGIT.cxx | 2 +- Source/CTest/cmCTestLaunch.cxx | 2 +- Source/CTest/cmCTestMemCheckHandler.h | 6 +- Source/CTest/cmCTestSVN.cxx | 4 +- Source/CTest/cmCTestTestHandler.cxx | 4 +- Source/CTest/cmCTestTestHandler.h | 4 +- Source/cmCacheManager.h | 24 ++-- Source/cmCallVisualStudioMacro.cxx | 30 ++-- Source/cmCallVisualStudioMacro.h | 12 +- Source/cmDepends.cxx | 154 ++++++++++----------- Source/cmDepends.h | 20 +-- Source/cmDependsC.cxx | 8 +- Source/cmDependsC.h | 5 +- Source/cmDependsFortran.cxx | 2 +- Source/cmDependsJava.cxx | 3 +- Source/cmDependsJava.h | 7 +- Source/cmDependsJavaParserHelper.cxx | 13 +- Source/cmExternalMakefileProjectGenerator.h | 10 +- Source/cmFileInstaller.cxx | 2 +- Source/cmFileTime.h | 2 +- Source/cmFileTimeCache.cxx | 11 +- Source/cmFileTimeCache.h | 11 +- Source/cmGeneratorTarget.h | 6 +- Source/cmGlobVerificationManager.h | 12 +- Source/cmGlobalBorlandMakefileGenerator.cxx | 2 +- Source/cmGlobalBorlandMakefileGenerator.h | 4 +- Source/cmGlobalGenerator.h | 22 +-- Source/cmGlobalGhsMultiGenerator.h | 4 +- Source/cmGlobalJOMMakefileGenerator.h | 2 +- Source/cmGlobalMSYSMakefileGenerator.h | 2 +- Source/cmGlobalMinGWMakefileGenerator.h | 2 +- Source/cmGlobalNMakeMakefileGenerator.h | 2 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 2 +- Source/cmGlobalUnixMakefileGenerator3.h | 2 +- Source/cmGlobalVisualStudio10Generator.cxx | 2 +- Source/cmGlobalVisualStudio10Generator.h | 2 +- Source/cmGlobalVisualStudio7Generator.cxx | 2 +- Source/cmGlobalVisualStudio7Generator.h | 6 +- Source/cmGlobalVisualStudio8Generator.h | 2 +- Source/cmGlobalWatcomWMakeGenerator.h | 2 +- Source/cmGlobalXCodeGenerator.cxx | 2 +- Source/cmGlobalXCodeGenerator.h | 8 +- Source/cmLoadCommandCommand.cxx | 2 +- Source/cmLocalGenerator.cxx | 2 +- Source/cmLocalGenerator.h | 12 +- Source/cmLocalUnixMakefileGenerator3.cxx | 5 +- Source/cmLocalUnixMakefileGenerator3.h | 11 +- Source/cmLocalVisualStudio10Generator.h | 2 +- Source/cmLocalVisualStudio7Generator.h | 2 +- Source/cmLocalXCodeGenerator.h | 2 +- Source/cmMakefile.h | 16 +-- Source/cmOutputConverter.h | 2 +- Source/cmPolicies.cxx | 6 +- Source/cmPolicies.h | 12 +- Source/cmProjectCommand.cxx | 42 ++++-- Source/cmProjectCommand.h | 1 + Source/cmSourceFile.h | 8 +- Source/cmState.h | 2 +- Source/cmSystemTools.h | 22 +-- Source/cmTarget.cxx | 2 +- Source/cmTarget.h | 42 +++--- Source/cmTargetPropertyComputer.h | 2 +- Source/cmTest.h | 4 +- Source/cmake.h | 48 +++---- Source/cmcmd.cxx | 147 ++++++++++---------- Source/cmcmd.h | 14 +- Tests/CMakeOnly/CMakeLists.txt | 6 + Tests/CMakeOnly/ProjectInclude/CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- 76 files changed, 442 insertions(+), 424 deletions(-) create mode 100644 Help/release/dev/project-include.rst copy Help/variable/{CMAKE_PROJECT_PROJECT-NAME_INCLUDE.rst => CMAKE_PROJECT_INCLUDE.rst} (70%) copy Tests/CMakeOnly/{ProjectInclude => ProjectIncludeAny}/CMakeLists.txt (66%) hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org https://cmake.org/mailman/listinfo/cmake-commits