diff options
author | Brad King <brad.king@kitware.com> | 2019-05-22 14:25:50 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-05-22 14:27:01 (GMT) |
commit | f83f29dbaa254053ac7fe2cc0e6403908fc04ac9 (patch) | |
tree | b1c96d76d17009d016752fb22f94f9b04ed4fa2a | |
parent | 9e07ea190bcbd83ffb054cff525fc1a0336a1a7d (diff) | |
parent | 9c07cefee541d47be9c378a9285711e07be7a16f (diff) | |
download | CMake-f83f29dbaa254053ac7fe2cc0e6403908fc04ac9.zip CMake-f83f29dbaa254053ac7fe2cc0e6403908fc04ac9.tar.gz CMake-f83f29dbaa254053ac7fe2cc0e6403908fc04ac9.tar.bz2 |
Merge topic 'vs-ApplicationTypeRevision'
9c07cefee5 VS: Fix ApplicationTypeRevision in builtin check projects
639e14def6 VS: Factor out helper to compute ApplicationTypeRevision
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3350
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 4 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.cxx | 13 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.h | 3 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 16 |
4 files changed, 24 insertions, 12 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 2321e11..c7e5685 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -276,8 +276,8 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} else() set(id_system "") endif() - if(id_system AND CMAKE_SYSTEM_VERSION) - set(id_system_version "<ApplicationTypeRevision>${CMAKE_SYSTEM_VERSION}</ApplicationTypeRevision>") + if(id_system AND CMAKE_SYSTEM_VERSION MATCHES "^([0-9]+\\.[0-9]+)") + set(id_system_version "<ApplicationTypeRevision>${CMAKE_MATCH_1}</ApplicationTypeRevision>") else() set(id_system_version "") endif() diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 4fa89d0..55374a4 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -784,11 +784,11 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) if (this->GetSystemName() == "WindowsPhone") { cmXMLElement(epg, "ApplicationType").Content("Windows Phone"); cmXMLElement(epg, "ApplicationTypeRevision") - .Content(this->GetSystemVersion()); + .Content(this->GetApplicationTypeRevision()); } else if (this->GetSystemName() == "WindowsStore") { cmXMLElement(epg, "ApplicationType").Content("Windows Store"); cmXMLElement(epg, "ApplicationTypeRevision") - .Content(this->GetSystemVersion()); + .Content(this->GetApplicationTypeRevision()); } if (!this->WindowsTargetPlatformVersion.empty()) { cmXMLElement(epg, "WindowsTargetPlatformVersion") @@ -1112,6 +1112,15 @@ std::string cmGlobalVisualStudio10Generator::GetInstalledNsightTegraVersion() return version; } +std::string cmGlobalVisualStudio10Generator::GetApplicationTypeRevision() const +{ + // Return the first two '.'-separated components of the Windows version. + std::string::size_type end1 = this->SystemVersion.find('.'); + std::string::size_type end2 = + end1 == std::string::npos ? end1 : this->SystemVersion.find('.', end1 + 1); + return this->SystemVersion.substr(0, end2); +} + static std::string cmLoadFlagTableString(Json::Value entry, const char* field) { if (entry.isMember(field)) { diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 2f532a6..1d30cd6 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -110,6 +110,9 @@ public: static std::string GetInstalledNsightTegraVersion(); + /** Return the first two components of CMAKE_SYSTEM_VERSION. */ + std::string GetApplicationTypeRevision() const; + cmIDEFlagTable const* GetClFlagTable() const; cmIDEFlagTable const* GetCSharpFlagTable() const; cmIDEFlagTable const* GetRcFlagTable() const; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index ab9ef79..af90383 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -4099,29 +4099,29 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings(Elem& e1) bool isAppContainer = false; bool const isWindowsPhone = this->GlobalGenerator->TargetsWindowsPhone(); bool const isWindowsStore = this->GlobalGenerator->TargetsWindowsStore(); - std::string const& v = this->GlobalGenerator->GetSystemVersion(); + std::string const& rev = this->GlobalGenerator->GetApplicationTypeRevision(); if (isWindowsPhone || isWindowsStore) { e1.Element("ApplicationType", (isWindowsPhone ? "Windows Phone" : "Windows Store")); e1.Element("DefaultLanguage", "en-US"); - if (cmHasLiteralPrefix(v, "10.0")) { - e1.Element("ApplicationTypeRevision", "10.0"); + if (rev == "10.0") { + e1.Element("ApplicationTypeRevision", rev); // Visual Studio 14.0 is necessary for building 10.0 apps e1.Element("MinimumVisualStudioVersion", "14.0"); if (this->GeneratorTarget->GetType() < cmStateEnums::UTILITY) { isAppContainer = true; } - } else if (v == "8.1") { - e1.Element("ApplicationTypeRevision", v); + } else if (rev == "8.1") { + e1.Element("ApplicationTypeRevision", rev); // Visual Studio 12.0 is necessary for building 8.1 apps e1.Element("MinimumVisualStudioVersion", "12.0"); if (this->GeneratorTarget->GetType() < cmStateEnums::UTILITY) { isAppContainer = true; } - } else if (v == "8.0") { - e1.Element("ApplicationTypeRevision", v); + } else if (rev == "8.0") { + e1.Element("ApplicationTypeRevision", rev); // Visual Studio 11.0 is necessary for building 8.0 apps e1.Element("MinimumVisualStudioVersion", "11.0"); @@ -4153,7 +4153,7 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings(Elem& e1) "VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION"); if (targetPlatformMinVersion) { e1.Element("WindowsTargetPlatformMinVersion", targetPlatformMinVersion); - } else if (isWindowsStore && cmHasLiteralPrefix(v, "10.0")) { + } else if (isWindowsStore && rev == "10.0") { // If the min version is not set, then use the TargetPlatformVersion if (!targetPlatformVersion.empty()) { e1.Element("WindowsTargetPlatformMinVersion", targetPlatformVersion); |