diff options
author | Artur Ryt <artur.ryt@gmail.com> | 2018-11-30 18:43:22 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-01-18 17:57:34 (GMT) |
commit | dfd5ae7da71ed9330eca7e352b8f9b42babdf3dd (patch) | |
tree | cc08e60849d92faed7790abf994ebd5196d80a0e /Source/cmake.cxx | |
parent | 6023fe7ff22848bc29ee67395eeb10f066758c06 (diff) | |
download | CMake-dfd5ae7da71ed9330eca7e352b8f9b42babdf3dd.zip CMake-dfd5ae7da71ed9330eca7e352b8f9b42babdf3dd.tar.gz CMake-dfd5ae7da71ed9330eca7e352b8f9b42babdf3dd.tar.bz2 |
Help: Mark default CMake generator with asterisk
Required extracting default generator evaluation
to explicit function, as Visual Studio generators
get validated during their construction.
Fixes: #18544
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r-- | Source/cmake.cxx | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index c53b597..619fd3e 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1519,7 +1519,7 @@ int cmake::ActualConfigure() return 0; } -void cmake::CreateDefaultGlobalGenerator() +std::unique_ptr<cmGlobalGenerator> cmake::EvaluateDefaultGlobalGenerator() { #if defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW) std::string found; @@ -1572,11 +1572,20 @@ void cmake::CreateDefaultGlobalGenerator() if (!gen) { gen = new cmGlobalNMakeMakefileGenerator(this); } - this->SetGlobalGenerator(gen); - std::cout << "-- Building for: " << gen->GetName() << "\n"; + return std::unique_ptr<cmGlobalGenerator>(gen); #else - this->SetGlobalGenerator(new cmGlobalUnixMakefileGenerator3(this)); + return cm::make_unique<cmGlobalUnixMakefileGenerator3>(this); +#endif +} + +void cmake::CreateDefaultGlobalGenerator() +{ + auto gen = this->EvaluateDefaultGlobalGenerator(); +#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW) + // This print could be unified for all platforms + std::cout << "-- Building for: " << gen->GetName() << "\n"; #endif + this->SetGlobalGenerator(gen.release()); } void cmake::PreLoadCMakeFiles() @@ -1927,9 +1936,18 @@ void cmake::SetIsInTryCompile(bool b) void cmake::AppendGlobalGeneratorsDocumentation( std::vector<cmDocumentationEntry>& v) { + const auto defaultGenerator = this->EvaluateDefaultGlobalGenerator(); + const std::string defaultName = defaultGenerator->GetName(); + bool foundDefaultOne = false; + for (cmGlobalGeneratorFactory* g : this->Generators) { cmDocumentationEntry e; g->GetDocumentation(e); + if (!foundDefaultOne && + cmSystemTools::StringStartsWith(e.Name, defaultName.c_str())) { + e.CustomNamePrefix = '*'; + foundDefaultOne = true; + } v.push_back(std::move(e)); } } |