diff options
Diffstat (limited to 'Source')
26 files changed, 191 insertions, 91 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 220040c..4a4f63f 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 13) -set(CMake_VERSION_PATCH 20190110) +set(CMake_VERSION_PATCH 20190114) #set(CMake_VERSION_RC 1) diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 4709194..a6bec4b 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -90,8 +90,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio10Generator::NewFactory() } cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator( - cmake* cm, const std::string& name, const std::string& platformName) - : cmGlobalVisualStudio8Generator(cm, name, platformName) + cmake* cm, const std::string& name, + std::string const& platformInGeneratorName) + : cmGlobalVisualStudio8Generator(cm, name, platformInGeneratorName) { std::string vc10Express; this->ExpressEdition = cmSystemTools::ReadRegistryValue( @@ -406,7 +407,7 @@ bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf) return false; } } else if (this->SystemName == "Android") { - if (this->DefaultPlatformName != "Win32") { + if (this->PlatformInGeneratorName) { std::ostringstream e; e << "CMAKE_SYSTEM_NAME is 'Android' but CMAKE_GENERATOR " << "specifies a platform too: '" << this->GetName() << "'"; @@ -437,7 +438,7 @@ bool cmGlobalVisualStudio10Generator::InitializeWindows(cmMakefile*) bool cmGlobalVisualStudio10Generator::InitializeWindowsCE(cmMakefile* mf) { - if (this->DefaultPlatformName != "Win32") { + if (this->PlatformInGeneratorName) { std::ostringstream e; e << "CMAKE_SYSTEM_NAME is 'WindowsCE' but CMAKE_GENERATOR " << "specifies a platform too: '" << this->GetName() << "'"; diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 1e72959..7f7c516 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -14,8 +14,6 @@ class cmGlobalVisualStudio10Generator : public cmGlobalVisualStudio8Generator { public: - cmGlobalVisualStudio10Generator(cmake* cm, const std::string& name, - const std::string& platformName); static cmGlobalGeneratorFactory* NewFactory(); bool MatchesGeneratorName(const std::string& name) const override; @@ -125,6 +123,9 @@ public: cmIDEFlagTable const* GetNasmFlagTable() const; protected: + cmGlobalVisualStudio10Generator(cmake* cm, const std::string& name, + std::string const& platformInGeneratorName); + void Generate() override; virtual bool InitializeSystem(cmMakefile* mf); virtual bool InitializeWindows(cmMakefile* mf); @@ -168,6 +169,8 @@ protected: private: class Factory; + friend class Factory; + struct LongestSourcePath { LongestSourcePath() diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 499ae32..07318cf 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -92,8 +92,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio11Generator::NewFactory() } cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator( - cmake* cm, const std::string& name, const std::string& platformName) - : cmGlobalVisualStudio10Generator(cm, name, platformName) + cmake* cm, const std::string& name, + std::string const& platformInGeneratorName) + : cmGlobalVisualStudio10Generator(cm, name, platformInGeneratorName) { std::string vc11Express; this->ExpressEdition = cmSystemTools::ReadRegistryValue( diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h index 6346da2..8b4c8b7 100644 --- a/Source/cmGlobalVisualStudio11Generator.h +++ b/Source/cmGlobalVisualStudio11Generator.h @@ -20,13 +20,14 @@ class cmake; class cmGlobalVisualStudio11Generator : public cmGlobalVisualStudio10Generator { public: - cmGlobalVisualStudio11Generator(cmake* cm, const std::string& name, - const std::string& platformName); static cmGlobalGeneratorFactory* NewFactory(); bool MatchesGeneratorName(const std::string& name) const override; protected: + cmGlobalVisualStudio11Generator(cmake* cm, const std::string& name, + std::string const& platformInGeneratorName); + bool InitializeWindowsPhone(cmMakefile* mf) override; bool InitializeWindowsStore(cmMakefile* mf) override; bool SelectWindowsPhoneToolset(std::string& toolset) const override; diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 2cec48c..f9da68c 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -75,8 +75,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio12Generator::NewFactory() } cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator( - cmake* cm, const std::string& name, const std::string& platformName) - : cmGlobalVisualStudio11Generator(cm, name, platformName) + cmake* cm, const std::string& name, + std::string const& platformInGeneratorName) + : cmGlobalVisualStudio11Generator(cm, name, platformInGeneratorName) { std::string vc12Express; this->ExpressEdition = cmSystemTools::ReadRegistryValue( diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h index 1b7bbc9..53b7091 100644 --- a/Source/cmGlobalVisualStudio12Generator.h +++ b/Source/cmGlobalVisualStudio12Generator.h @@ -18,13 +18,14 @@ class cmake; class cmGlobalVisualStudio12Generator : public cmGlobalVisualStudio11Generator { public: - cmGlobalVisualStudio12Generator(cmake* cm, const std::string& name, - const std::string& platformName); static cmGlobalGeneratorFactory* NewFactory(); bool MatchesGeneratorName(const std::string& name) const override; protected: + cmGlobalVisualStudio12Generator(cmake* cm, const std::string& name, + std::string const& platformInGeneratorName); + bool ProcessGeneratorToolsetField(std::string const& key, std::string const& value) override; @@ -44,5 +45,6 @@ protected: private: class Factory; + friend class Factory; }; #endif diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index a6dbc23..8f7dac9 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -75,8 +75,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio14Generator::NewFactory() } cmGlobalVisualStudio14Generator::cmGlobalVisualStudio14Generator( - cmake* cm, const std::string& name, const std::string& platformName) - : cmGlobalVisualStudio12Generator(cm, name, platformName) + cmake* cm, const std::string& name, + std::string const& platformInGeneratorName) + : cmGlobalVisualStudio12Generator(cm, name, platformInGeneratorName) { std::string vc14Express; this->ExpressEdition = cmSystemTools::ReadRegistryValue( diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h index 4be21e0..32008b0 100644 --- a/Source/cmGlobalVisualStudio14Generator.h +++ b/Source/cmGlobalVisualStudio14Generator.h @@ -18,13 +18,14 @@ class cmake; class cmGlobalVisualStudio14Generator : public cmGlobalVisualStudio12Generator { public: - cmGlobalVisualStudio14Generator(cmake* cm, const std::string& name, - const std::string& platformName); static cmGlobalGeneratorFactory* NewFactory(); bool MatchesGeneratorName(const std::string& name) const override; protected: + cmGlobalVisualStudio14Generator(cmake* cm, const std::string& name, + std::string const& platformInGeneratorName); + bool InitializeWindows(cmMakefile* mf) override; bool InitializeWindowsStore(cmMakefile* mf) override; bool SelectWindowsStoreToolset(std::string& toolset) const override; @@ -47,5 +48,6 @@ protected: private: class Factory; + friend class Factory; }; #endif diff --git a/Source/cmGlobalVisualStudio15Generator.cxx b/Source/cmGlobalVisualStudio15Generator.cxx index 2af17e8..eb49e87 100644 --- a/Source/cmGlobalVisualStudio15Generator.cxx +++ b/Source/cmGlobalVisualStudio15Generator.cxx @@ -76,8 +76,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio15Generator::NewFactory() } cmGlobalVisualStudio15Generator::cmGlobalVisualStudio15Generator( - cmake* cm, const std::string& name, const std::string& platformName) - : cmGlobalVisualStudio14Generator(cm, name, platformName) + cmake* cm, const std::string& name, + std::string const& platformInGeneratorName) + : cmGlobalVisualStudio14Generator(cm, name, platformInGeneratorName) { this->ExpressEdition = false; this->DefaultPlatformToolset = "v141"; diff --git a/Source/cmGlobalVisualStudio15Generator.h b/Source/cmGlobalVisualStudio15Generator.h index 233f3bc..da85d23 100644 --- a/Source/cmGlobalVisualStudio15Generator.h +++ b/Source/cmGlobalVisualStudio15Generator.h @@ -18,8 +18,6 @@ class cmake; class cmGlobalVisualStudio15Generator : public cmGlobalVisualStudio14Generator { public: - cmGlobalVisualStudio15Generator(cmake* cm, const std::string& name, - const std::string& platformName); static cmGlobalGeneratorFactory* NewFactory(); bool MatchesGeneratorName(const std::string& name) const override; @@ -32,6 +30,9 @@ public: std::string GetAuxiliaryToolset() const override; protected: + cmGlobalVisualStudio15Generator(cmake* cm, const std::string& name, + std::string const& platformInGeneratorName); + bool InitializeWindows(cmMakefile* mf) override; bool SelectWindowsStoreToolset(std::string& toolset) const override; @@ -53,6 +54,7 @@ protected: private: class Factory; + friend class Factory; mutable cmVSSetupAPIHelper vsSetupAPIHelper; }; #endif diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 3648086..5855177 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -41,19 +41,13 @@ static cmVS7FlagTable cmVS7ExtraFlagTable[] = { }; cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator( - cmake* cm, const std::string& platformName) - : cmGlobalVisualStudioGenerator(cm) + cmake* cm, std::string const& platformInGeneratorName) + : cmGlobalVisualStudioGenerator(cm, platformInGeneratorName) { this->IntelProjectVersion = 0; this->DevEnvCommandInitialized = false; this->MasmEnabled = false; this->NasmEnabled = false; - - if (platformName.empty()) { - this->DefaultPlatformName = "Win32"; - } else { - this->DefaultPlatformName = platformName; - } this->ExtraFlagTable = cmVS7ExtraFlagTable; } @@ -263,14 +257,6 @@ Json::Value cmGlobalVisualStudio7Generator::GetJson() const } #endif -std::string const& cmGlobalVisualStudio7Generator::GetPlatformName() const -{ - if (!this->GeneratorPlatform.empty()) { - return this->GeneratorPlatform; - } - return this->DefaultPlatformName; -} - bool cmGlobalVisualStudio7Generator::SetSystemName(std::string const& s, cmMakefile* mf) { @@ -279,18 +265,6 @@ bool cmGlobalVisualStudio7Generator::SetSystemName(std::string const& s, return this->cmGlobalVisualStudioGenerator::SetSystemName(s, mf); } -bool cmGlobalVisualStudio7Generator::SetGeneratorPlatform(std::string const& p, - cmMakefile* mf) -{ - if (this->GetPlatformName() == "x64") { - mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE"); - } else if (this->GetPlatformName() == "Itanium") { - mf->AddDefinition("CMAKE_FORCE_IA64", "TRUE"); - } - mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName().c_str()); - return this->cmGlobalVisualStudioGenerator::SetGeneratorPlatform(p, mf); -} - void cmGlobalVisualStudio7Generator::Generate() { // first do the superclass method diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index f092b56..d2a2a38 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -18,13 +18,8 @@ struct cmIDEFlagTable; class cmGlobalVisualStudio7Generator : public cmGlobalVisualStudioGenerator { public: - cmGlobalVisualStudio7Generator(cmake* cm, - const std::string& platformName = ""); ~cmGlobalVisualStudio7Generator(); - ///! Get the name for the platform. - std::string const& GetPlatformName() const; - ///! Create a local generator appropriate to this Global Generator cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) override; @@ -34,8 +29,6 @@ public: bool SetSystemName(std::string const& s, cmMakefile* mf) override; - bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf) override; - /** * Utilized by the generator factory to determine if this generator * supports toolsets. @@ -110,6 +103,9 @@ public: cmIDEFlagTable const* ExtraFlagTable; protected: + cmGlobalVisualStudio7Generator(cmake* cm, + std::string const& platformInGeneratorName); + void Generate() override; std::string const& GetDevEnvCommand(); @@ -166,8 +162,6 @@ protected: // Set during OutputSLNFile with the name of the current project. // There is one SLN file per project. std::string CurrentProject; - std::string GeneratorPlatform; - std::string DefaultPlatformName; bool MasmEnabled; bool NasmEnabled; diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index ee118f1..55284c9 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -12,8 +12,9 @@ #include "cmake.h" cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator( - cmake* cm, const std::string& name, const std::string& platformName) - : cmGlobalVisualStudio71Generator(cm, platformName) + cmake* cm, const std::string& name, + std::string const& platformInGeneratorName) + : cmGlobalVisualStudio71Generator(cm, platformInGeneratorName) { this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; this->Name = name; @@ -60,7 +61,7 @@ void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf) bool cmGlobalVisualStudio8Generator::SetGeneratorPlatform(std::string const& p, cmMakefile* mf) { - if (this->DefaultPlatformName == "Win32") { + if (!this->PlatformInGeneratorName) { this->GeneratorPlatform = p; return this->cmGlobalVisualStudio7Generator::SetGeneratorPlatform("", mf); } else { diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index cacfa68..8719bf3 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -13,9 +13,6 @@ class cmGlobalVisualStudio8Generator : public cmGlobalVisualStudio71Generator { public: - cmGlobalVisualStudio8Generator(cmake* cm, const std::string& name, - const std::string& platformName); - ///! Get the name for the generator. std::string GetName() const override { return this->Name; } @@ -45,6 +42,9 @@ public: } protected: + cmGlobalVisualStudio8Generator(cmake* cm, const std::string& name, + std::string const& platformInGeneratorName); + void AddExtraIDETargets() override; std::string FindDevEnvCommand() override; diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index 760cce4..e784595 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -83,8 +83,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio9Generator::NewFactory() } cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator( - cmake* cm, const std::string& name, const std::string& platformName) - : cmGlobalVisualStudio8Generator(cm, name, platformName) + cmake* cm, const std::string& name, + std::string const& platformInGeneratorName) + : cmGlobalVisualStudio8Generator(cm, name, platformInGeneratorName) { this->Version = VS9; std::string vc9Express; diff --git a/Source/cmGlobalVisualStudio9Generator.h b/Source/cmGlobalVisualStudio9Generator.h index e537a3d..7bebfd6 100644 --- a/Source/cmGlobalVisualStudio9Generator.h +++ b/Source/cmGlobalVisualStudio9Generator.h @@ -13,8 +13,6 @@ class cmGlobalVisualStudio9Generator : public cmGlobalVisualStudio8Generator { public: - cmGlobalVisualStudio9Generator(cmake* cm, const std::string& name, - const std::string& platformName); static cmGlobalGeneratorFactory* NewFactory(); /** @@ -30,6 +28,10 @@ public: */ std::string GetUserMacrosRegKeyBase() override; +protected: + cmGlobalVisualStudio9Generator(cmake* cm, const std::string& name, + std::string const& platformInGeneratorName); + private: class Factory; friend class Factory; diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index adf0a81..dc8de03 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -20,12 +20,20 @@ #include "cmState.h" #include "cmTarget.h" -cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator(cmake* cm) +cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator( + cmake* cm, std::string const& platformInGeneratorName) : cmGlobalGenerator(cm) { cm->GetState()->SetIsGeneratorMultiConfig(true); cm->GetState()->SetWindowsShell(true); cm->GetState()->SetWindowsVSIDE(true); + + if (platformInGeneratorName.empty()) { + this->DefaultPlatformName = "Win32"; + } else { + this->DefaultPlatformName = platformInGeneratorName; + this->PlatformInGeneratorName = true; + } } cmGlobalVisualStudioGenerator::~cmGlobalVisualStudioGenerator() @@ -43,6 +51,26 @@ void cmGlobalVisualStudioGenerator::SetVersion(VSVersion v) this->Version = v; } +bool cmGlobalVisualStudioGenerator::SetGeneratorPlatform(std::string const& p, + cmMakefile* mf) +{ + if (this->GetPlatformName() == "x64") { + mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE"); + } else if (this->GetPlatformName() == "Itanium") { + mf->AddDefinition("CMAKE_FORCE_IA64", "TRUE"); + } + mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName().c_str()); + return this->cmGlobalGenerator::SetGeneratorPlatform(p, mf); +} + +std::string const& cmGlobalVisualStudioGenerator::GetPlatformName() const +{ + if (!this->GeneratorPlatform.empty()) { + return this->GeneratorPlatform; + } + return this->DefaultPlatformName; +} + const char* cmGlobalVisualStudioGenerator::GetIDEVersion() const { switch (this->Version) { diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 0d4491d..d44f5a5 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -41,7 +41,6 @@ public: VS15 = 150 }; - cmGlobalVisualStudioGenerator(cmake* cm); virtual ~cmGlobalVisualStudioGenerator(); VSVersion GetVersion() const; @@ -50,6 +49,14 @@ public: /** Is the installed VS an Express edition? */ bool IsExpressEdition() const { return this->ExpressEdition; } + bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf) override; + + /** + * Get the name of the target platform (architecture) for which we generate. + * The names are as defined by VS, e.g. "Win32", "x64", "Itanium", "ARM". + */ + std::string const& GetPlatformName() const; + /** * Configure CMake's Visual Studio macros file into the user's Visual * Studio macros directory. @@ -133,6 +140,9 @@ public: bool dryRun) override; protected: + cmGlobalVisualStudioGenerator(cmake* cm, + std::string const& platformInGeneratorName); + void AddExtraIDETargets() override; // Does this VS version link targets to each other if there are @@ -166,6 +176,10 @@ protected: VSVersion Version; bool ExpressEdition; + std::string GeneratorPlatform; + std::string DefaultPlatformName; + bool PlatformInGeneratorName = false; + private: virtual std::string GetVSMakeProgram() = 0; void PrintCompilerAdvice(std::ostream&, std::string const&, diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 206dd3d..314f27d 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -258,6 +258,9 @@ class cmMakefile; SELECT(POLICY, CMP0087, \ "Install CODE|SCRIPT allow the use of generator " \ "expressions.", \ + 3, 14, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0088, \ + "FindBISON runs bison in CMAKE_CURRENT_BINARY_DIR when executing.", \ 3, 14, 0, cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index 678ff14..f4cf3e0 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -13,6 +13,7 @@ #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" +#include "cmake.h" #include <memory> #include <utility> @@ -86,10 +87,43 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( auto qtVersion = cmQtAutoGenInitializer::GetQtVersion(target); bool const validQt = (qtVersion.Major == 4) || (qtVersion.Major == 5) || (qtVersion.Major == 6); - bool const mocIsValid = moc && (validQt || !mocExec.empty()); - bool const uicIsValid = uic && (validQt || !uicExec.empty()); - bool const rccIsValid = rcc && (validQt || !rccExec.empty()); + bool const mocAvailable = (validQt || !mocExec.empty()); + bool const uicAvailable = (validQt || !uicExec.empty()); + bool const rccAvailable = (validQt || !rccExec.empty()); + bool const mocIsValid = (moc && mocAvailable); + bool const uicIsValid = (uic && uicAvailable); + bool const rccIsValid = (rcc && uicAvailable); + // Disabled AUTOMOC/UIC/RCC warning + bool const mocDisabled = (moc && !mocAvailable); + bool const uicDisabled = (uic && !uicAvailable); + bool const rccDisabled = (rcc && !rccAvailable); + if (mocDisabled || uicDisabled || rccDisabled) { + std::string msg = "AUTOGEN: No valid Qt version found for target "; + msg += target->GetName(); + msg += ". "; + { + std::vector<std::string> lst; + if (mocDisabled) { + lst.emplace_back("AUTOMOC"); + } + if (uicDisabled) { + lst.emplace_back("AUTOUIC"); + } + if (rccDisabled) { + lst.emplace_back("AUTORCC"); + } + msg += cmJoin(lst, ", "); + } + msg += " disabled. Consider adding:\n"; + if (uicDisabled) { + msg += " find_package(Qt5 COMPONENTS Widgets)\n"; + } else { + msg += " find_package(Qt5 COMPONENTS Core)\n"; + } + msg += "to your CMakeLists.txt file."; + target->Makefile->IssueMessage(cmake::AUTHOR_WARNING, msg); + } if (mocIsValid || uicIsValid || rccIsValid) { // Create autogen target initializer Initializers_.emplace_back(cm::make_unique<cmQtAutoGenInitializer>( diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 6d54c12..b0e70ff 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -623,6 +623,7 @@ void cmVisualStudio10TargetGenerator::Generate() Elem(e0, "PropertyGroup").Attribute("Label", "UserMacros"); this->WriteWinRTPackageCertificateKeyFile(e0); this->WritePathAndIncrementalLinkOptions(e0); + this->WriteCEDebugProjectConfigurationValues(e0); this->WriteItemDefinitionGroups(e0); this->WriteCustomCommands(e0); this->WriteAllSources(e0); @@ -1071,6 +1072,32 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues(Elem& e0) } } +void cmVisualStudio10TargetGenerator::WriteCEDebugProjectConfigurationValues( + Elem& e0) +{ + if (!this->GlobalGenerator->TargetsWindowsCE()) { + return; + } + const char* additionalFiles = + this->GeneratorTarget->GetProperty("DEPLOYMENT_ADDITIONAL_FILES"); + const char* remoteDirectory = + this->GeneratorTarget->GetProperty("DEPLOYMENT_REMOTE_DIRECTORY"); + if (!(additionalFiles || remoteDirectory)) { + return; + } + for (std::string const& c : this->Configurations) { + Elem e1(e0, "PropertyGroup"); + e1.Attribute("Condition", this->CalcCondition(c)); + + if (remoteDirectory) { + e1.Element("RemoteDirectory", remoteDirectory); + } + if (additionalFiles) { + e1.Element("CEAdditionalFiles", additionalFiles); + } + } +} + void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues( Elem& e1, std::string const& config) { diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index b17b5f8..7d24e88 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -57,6 +57,7 @@ private: void WriteProjectConfigurations(Elem& e0); void WriteProjectConfigurationValues(Elem& e0); void WriteMSToolConfigurationValues(Elem& e1, std::string const& config); + void WriteCEDebugProjectConfigurationValues(Elem& e0); void WriteMSToolConfigurationValuesManaged(Elem& e1, std::string const& config); void WriteHeaderSource(Elem& e1, cmSourceFile const* sf); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index e1bae34..bfb066d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -610,16 +610,13 @@ bool cmake::FindPackage(const std::vector<std::string>& args) } // Parse the args -void cmake::SetArgs(const std::vector<std::string>& args, - bool directoriesSetBefore) +void cmake::SetArgs(const std::vector<std::string>& args) { - bool directoriesSet = directoriesSetBefore; bool haveToolset = false; bool havePlatform = false; for (unsigned int i = 1; i < args.size(); ++i) { std::string const& arg = args[i]; if (arg.find("-H", 0) == 0 || arg.find("-S", 0) == 0) { - directoriesSet = true; std::string path = arg.substr(2); if (path.empty()) { ++i; @@ -640,7 +637,6 @@ void cmake::SetArgs(const std::vector<std::string>& args, } else if (arg.find("-O", 0) == 0) { // There is no local generate anymore. Ignore -O option. } else if (arg.find("-B", 0) == 0) { - directoriesSet = true; std::string path = arg.substr(2); if (path.empty()) { ++i; @@ -802,16 +798,27 @@ void cmake::SetArgs(const std::vector<std::string>& args, this->SetGlobalGenerator(gen); } } - // no option assume it is the path to the source + // no option assume it is the path to the source or an existing build else { - directoriesSet = true; this->SetDirectoriesFromFile(arg.c_str()); } } - if (!directoriesSet) { - this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory()); + + const bool haveSourceDir = !this->GetHomeDirectory().empty(); + const bool haveBinaryDir = !this->GetHomeOutputDirectory().empty(); + + if (this->CurrentWorkingMode == cmake::NORMAL_MODE && !haveSourceDir && + !haveBinaryDir) { + cmSystemTools::Error("No source or binary directory provided"); + return; + } + + if (!haveSourceDir) { this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory()); } + if (!haveBinaryDir) { + this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory()); + } } void cmake::SetDirectoriesFromFile(const char* arg) diff --git a/Source/cmake.h b/Source/cmake.h index d00acc7..3c06c56 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -277,8 +277,7 @@ public: int GetSystemInformation(std::vector<std::string>&); ///! Parse command line arguments - void SetArgs(const std::vector<std::string>&, - bool directoriesSetBefore = false); + void SetArgs(const std::vector<std::string>& args); ///! Is this cmake running as a result of a TRY_COMPILE command bool GetIsInTryCompile() const; diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 75dabde..e52f2b3 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -285,12 +285,12 @@ int do_cmake(int ac, char const* const* av) } else if (cmHasLiteralPrefix(av[i], "-P")) { if (i == ac - 1) { cmSystemTools::Error("No script specified for argument -P"); - } else { - workingMode = cmake::SCRIPT_MODE; - args.push_back(av[i]); - i++; - args.push_back(av[i]); + return 1; } + workingMode = cmake::SCRIPT_MODE; + args.push_back(av[i]); + i++; + args.push_back(av[i]); } else if (cmHasLiteralPrefix(av[i], "--find-package")) { workingMode = cmake::FIND_PACKAGE_MODE; args.push_back(av[i]); |