summaryrefslogtreecommitdiffstats
path: root/Source/cmake.h
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2020-01-02 16:07:09 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2020-01-07 10:03:11 (GMT)
commita00960288bedb3cd9495222e7917c9a1092ce4c9 (patch)
tree03843ce4517050e051c1a225912841c5dabb8174 /Source/cmake.h
parente353d8bd9bfd90396089e514d5b77f027ac27e99 (diff)
downloadCMake-a00960288bedb3cd9495222e7917c9a1092ce4c9.zip
CMake-a00960288bedb3cd9495222e7917c9a1092ce4c9.tar.gz
CMake-a00960288bedb3cd9495222e7917c9a1092ce4c9.tar.bz2
GlobalGenerator family: modernize memory management
Diffstat (limited to 'Source/cmake.h')
-rw-r--r--Source/cmake.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/Source/cmake.h b/Source/cmake.h
index 266d66c..22d3c39 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -213,21 +213,25 @@ public:
void PreLoadCMakeFiles();
//! Create a GlobalGenerator
- cmGlobalGenerator* CreateGlobalGenerator(const std::string& name);
+ std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
+ const std::string& name);
//! Return the global generator assigned to this instance of cmake
- cmGlobalGenerator* GetGlobalGenerator() { return this->GlobalGenerator; }
+ cmGlobalGenerator* GetGlobalGenerator()
+ {
+ return this->GlobalGenerator.get();
+ }
//! Return the global generator assigned to this instance of cmake, const
const cmGlobalGenerator* GetGlobalGenerator() const
{
- return this->GlobalGenerator;
+ return this->GlobalGenerator.get();
}
//! 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
- void SetGlobalGenerator(cmGlobalGenerator*);
+ void SetGlobalGenerator(std::unique_ptr<cmGlobalGenerator>);
//! Get the names of the current registered generators
void GetRegisteredGenerators(std::vector<GeneratorInfo>& generators,
@@ -547,7 +551,8 @@ protected:
void RunCheckForUnusedVariables();
int HandleDeleteCacheVariables(const std::string& var);
- using RegisteredGeneratorsVector = std::vector<cmGlobalGeneratorFactory*>;
+ using RegisteredGeneratorsVector =
+ std::vector<std::unique_ptr<cmGlobalGeneratorFactory>>;
RegisteredGeneratorsVector Generators;
using RegisteredExtraGeneratorsVector =
std::vector<cmExternalMakefileProjectGeneratorFactory*>;
@@ -557,7 +562,6 @@ protected:
void AddDefaultGenerators();
void AddDefaultExtraGenerators();
- cmGlobalGenerator* GlobalGenerator = nullptr;
std::map<std::string, DiagLevel> DiagLevels;
std::string GeneratorInstance;
std::string GeneratorPlatform;
@@ -638,6 +642,8 @@ private:
std::stack<std::string> CheckInProgressMessages;
+ std::unique_ptr<cmGlobalGenerator> GlobalGenerator;
+
void UpdateConversionPathTable();
//! Print a list of valid generators to stderr.