summaryrefslogtreecommitdiff
path: root/Source/cmake.h
diff options
context:
space:
mode:
authorEicke Herbertz <wolletd@posteo.de>2019-04-12 00:16:46 +0200
committerEicke Herbertz <wolletd@posteo.de>2019-05-16 23:00:27 +0200
commit083cf7e8a2515d9f838f3edbb2724fd3b17d83cd (patch)
tree3a4a2620670a542d5a30639b4079856d1957adda /Source/cmake.h
parent2ed688a863671d58513055ad56ab04d6be05295b (diff)
downloadcmake-083cf7e8a2515d9f838f3edbb2724fd3b17d83cd.tar.gz
cmake: Allow default generator to be set by environment variables
When there is no Generator available in the Cache, this will read CMAKE_GENERATOR from environment before using the CMake platform default. If CMAKE_GENERATOR is empty, use the platform default. If a environment default generator is specified, subsequent variables CMAKE_GENERATOR_(INSTANCE,PLATFORM,TOOLSET) are also evaluated in the same way.
Diffstat (limited to 'Source/cmake.h')
-rw-r--r--Source/cmake.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/Source/cmake.h b/Source/cmake.h
index 8b4b396760..beec11d686 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -201,18 +201,21 @@ public:
void SetGeneratorInstance(std::string const& instance)
{
this->GeneratorInstance = instance;
+ this->GeneratorInstanceSet = true;
}
//! Set the name of the selected generator-specific platform.
void SetGeneratorPlatform(std::string const& ts)
{
this->GeneratorPlatform = ts;
+ this->GeneratorPlatformSet = true;
}
//! Set the name of the selected generator-specific toolset.
void SetGeneratorToolset(std::string const& ts)
{
this->GeneratorToolset = ts;
+ this->GeneratorToolsetSet = true;
}
const std::vector<std::string>& GetSourceExtensions() const
@@ -263,6 +266,9 @@ public:
*/
int GetSystemInformation(std::vector<std::string>&);
+ //! Parse environment variables
+ void LoadEnvironmentPresets();
+
//! Parse command line arguments
void SetArgs(const std::vector<std::string>& args);
@@ -461,6 +467,9 @@ protected:
std::string GeneratorInstance;
std::string GeneratorPlatform;
std::string GeneratorToolset;
+ bool GeneratorInstanceSet;
+ bool GeneratorPlatformSet;
+ bool GeneratorToolsetSet;
//! read in a cmake list file to initialize the cache
void ReadListFile(const std::vector<std::string>& args,
@@ -503,6 +512,7 @@ private:
std::string CheckStampFile;
std::string CheckStampList;
std::string VSSolutionFile;
+ std::string EnvironmentGenerator;
std::vector<std::string> SourceFileExtensions;
std::unordered_set<std::string> SourceFileExtensionsSet;
std::vector<std::string> HeaderFileExtensions;