Attached Files | 15228.patch [^] (17,067 bytes) 2014-11-13 15:01 [Show Content] [Hide Content]From 53e0d72871e796bca4799b14fffbce6ccdf35877 Mon Sep 17 00:00:00 2001
From: Gilles Khouzam <gillesk@microsoft.com>
Date: Thu, 13 Nov 2014 11:47:01 -0800
Subject: [PATCH] Issue: 15228 Better error messages when compiler isn't
detected on Windows
CMake requires both the Desktop SDK and the correct platform SDK
(Windows Phone or Windows Store) to be installed when targeting
the Windows mobile platforms. This change verifies that the right
platform components are installed and gives a more detailed error message
when something is wrong.
---
Source/cmGlobalVisualStudio10Generator.cxx | 18 +++++
Source/cmGlobalVisualStudio10Generator.h | 5 +-
Source/cmGlobalVisualStudio11Generator.cxx | 115 +++++++++++++++++++++++++----
Source/cmGlobalVisualStudio11Generator.h | 11 ++-
Source/cmGlobalVisualStudio12Generator.cxx | 107 +++++++++++++++++++++++----
Source/cmGlobalVisualStudio12Generator.h | 10 ++-
6 files changed, 232 insertions(+), 34 deletions(-)
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index d70d2af..499ac56 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -262,6 +262,24 @@ bool cmGlobalVisualStudio10Generator::InitializeWindowsStore(cmMakefile* mf)
}
//----------------------------------------------------------------------------
+bool
+cmGlobalVisualStudio10Generator::SelectWindowsPhoneToolset(
+ std::string& toolset) const
+{
+ toolset = "";
+ return false;
+}
+
+//----------------------------------------------------------------------------
+bool
+cmGlobalVisualStudio10Generator::SelectWindowsStoreToolset(
+ std::string& toolset) const
+{
+ toolset = "";
+ return false;
+}
+
+//----------------------------------------------------------------------------
std::string cmGlobalVisualStudio10Generator::SelectWindowsCEToolset() const
{
if (this->SystemVersion == "8.0")
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index 686dcdf..3b0a5cf 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -118,9 +118,10 @@ protected:
virtual bool InitializeWindowsCE(cmMakefile* mf);
virtual bool InitializeWindowsPhone(cmMakefile* mf);
virtual bool InitializeWindowsStore(cmMakefile* mf);
+
virtual std::string SelectWindowsCEToolset() const;
- virtual std::string SelectWindowsPhoneToolset() const { return ""; }
- virtual std::string SelectWindowsStoreToolset() const { return ""; }
+ virtual bool SelectWindowsPhoneToolset(std::string& toolset) const;
+ virtual bool SelectWindowsStoreToolset(std::string& toolset) const;
virtual const char* GetIDEVersion() { return "10.0"; }
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index 39bbdc0..ff94301 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -131,12 +131,20 @@ cmGlobalVisualStudio11Generator::MatchesGeneratorName(
//----------------------------------------------------------------------------
bool cmGlobalVisualStudio11Generator::InitializeWindowsPhone(cmMakefile* mf)
{
- this->DefaultPlatformToolset = this->SelectWindowsPhoneToolset();
- if(this->DefaultPlatformToolset.empty())
+ if(!this->SelectWindowsPhoneToolset(this->DefaultPlatformToolset))
{
cmOStringStream e;
- e << this->GetName() << " supports Windows Phone '8.0', but not '"
- << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION.";
+ if(this->DefaultPlatformToolset.empty())
+ {
+ e << this->GetName() << " supports Windows Phone '8.0', but not '"
+ << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION.";
+ }
+ else
+ {
+ e << "A Windows Phone component with CMake requires both the Windows "
+ << "Desktop SDK as well as the Windows Phone '" << this->SystemVersion
+ << "' SDK. Please make sure that you have both installed";
+ }
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
return false;
}
@@ -146,12 +154,20 @@ bool cmGlobalVisualStudio11Generator::InitializeWindowsPhone(cmMakefile* mf)
//----------------------------------------------------------------------------
bool cmGlobalVisualStudio11Generator::InitializeWindowsStore(cmMakefile* mf)
{
- this->DefaultPlatformToolset = this->SelectWindowsStoreToolset();
- if(this->DefaultPlatformToolset.empty())
+ if(!this->SelectWindowsStoreToolset(this->DefaultPlatformToolset))
{
cmOStringStream e;
- e << this->GetName() << " supports Windows Store '8.0', but not '"
- << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION.";
+ if(this->DefaultPlatformToolset.empty())
+ {
+ e << this->GetName() << " supports Windows Store '8.0', but not '"
+ << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION.";
+ }
+ else
+ {
+ e << "A Windows Store component with CMake requires both the Windows "
+ << "Desktop SDK as well as the Windows Store '" << this->SystemVersion
+ << "' SDK. Please make sure that you have both installed";
+ }
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
return false;
}
@@ -159,23 +175,45 @@ bool cmGlobalVisualStudio11Generator::InitializeWindowsStore(cmMakefile* mf)
}
//----------------------------------------------------------------------------
-std::string cmGlobalVisualStudio11Generator::SelectWindowsPhoneToolset() const
+bool
+cmGlobalVisualStudio11Generator::SelectWindowsPhoneToolset(
+ std::string& toolset) const
{
if(this->SystemVersion == "8.0")
{
- return "v110_wp80";
+ if (this->IsWindowsPhoneToolsetInstalled() &&
+ this->IsWindowsDesktopToolsetInstalled())
+ {
+ toolset = "v110_wp80";
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
- return this->cmGlobalVisualStudio10Generator::SelectWindowsPhoneToolset();
+ return this->cmGlobalVisualStudio10Generator::SelectWindowsPhoneToolset(toolset);
}
//----------------------------------------------------------------------------
-std::string cmGlobalVisualStudio11Generator::SelectWindowsStoreToolset() const
+bool
+cmGlobalVisualStudio11Generator::SelectWindowsStoreToolset(
+ std::string& toolset) const
{
if(this->SystemVersion == "8.0")
{
- return "v110";
+ if(this->IsWindowsStoreToolsetInstalled() &&
+ this->IsWindowsDesktopToolsetInstalled())
+ {
+ toolset = "v110";
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
- return this->cmGlobalVisualStudio10Generator::SelectWindowsStoreToolset();
+ return this->cmGlobalVisualStudio10Generator::SelectWindowsStoreToolset(toolset);
}
//----------------------------------------------------------------------------
@@ -256,3 +294,52 @@ cmGlobalVisualStudio11Generator::NeedsDeploy(cmTarget::TargetType type) const
}
return cmGlobalVisualStudio10Generator::NeedsDeploy(type);
}
+
+//----------------------------------------------------------------------------
+bool
+cmGlobalVisualStudio11Generator::IsWindowsDesktopToolsetInstalled() const
+{
+ const char desktop80Key[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
+ "VisualStudio\\11.0\\VC\\Libraries\\Extended";
+
+ const char VS2012DesktopExpressKey[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\"
+ "Microsoft\\WDExpress\\11.0;"
+ "InstallDir";
+
+ std::vector<std::string> subkeys;
+ std::string path;
+ return cmSystemTools::ReadRegistryValue(VS2012DesktopExpressKey,
+ path,
+ cmSystemTools::KeyWOW64_32) ||
+ cmSystemTools::GetRegistrySubKeys(desktop80Key,
+ subkeys,
+ cmSystemTools::KeyWOW64_32);
+}
+
+//----------------------------------------------------------------------------
+bool
+cmGlobalVisualStudio11Generator::IsWindowsPhoneToolsetInstalled() const
+{
+ const char wp80Key[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
+ "Microsoft SDKs\\WindowsPhone\\v8.0\\"
+ "Install Path;Install Path";
+
+ std::string path;
+ cmSystemTools::ReadRegistryValue(wp80Key,
+ path,
+ cmSystemTools::KeyWOW64_32);
+ return !path.empty();
+}
+
+//----------------------------------------------------------------------------
+bool
+cmGlobalVisualStudio11Generator::IsWindowsStoreToolsetInstalled() const
+{
+ const char win80Key[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
+ "VisualStudio\\11.0\\VC\\Libraries\\Core\\Arm";
+
+ std::vector<std::string> subkeys;
+ return cmSystemTools::GetRegistrySubKeys(win80Key,
+ subkeys,
+ cmSystemTools::KeyWOW64_32);
+}
diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h
index bbd935c..c79dc97 100644
--- a/Source/cmGlobalVisualStudio11Generator.h
+++ b/Source/cmGlobalVisualStudio11Generator.h
@@ -36,8 +36,15 @@ public:
protected:
virtual bool InitializeWindowsPhone(cmMakefile* mf);
virtual bool InitializeWindowsStore(cmMakefile* mf);
- virtual std::string SelectWindowsPhoneToolset() const;
- virtual std::string SelectWindowsStoreToolset() const;
+ virtual bool SelectWindowsPhoneToolset(std::string& toolset) const;
+ virtual bool SelectWindowsStoreToolset(std::string& toolset) const;
+
+ // These aren't virtual because we need to check if the selected version
+ // of the toolset is installed
+ bool IsWindowsDesktopToolsetInstalled() const;
+ bool IsWindowsPhoneToolsetInstalled() const;
+ bool IsWindowsStoreToolsetInstalled() const;
+
virtual const char* GetIDEVersion() { return "11.0"; }
bool UseFolderProperty();
static std::set<std::string> GetInstalledWindowsCESDKs();
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
index 29ecfe0..0d99fe1 100644
--- a/Source/cmGlobalVisualStudio12Generator.cxx
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -111,12 +111,20 @@ cmGlobalVisualStudio12Generator::MatchesGeneratorName(
//----------------------------------------------------------------------------
bool cmGlobalVisualStudio12Generator::InitializeWindowsPhone(cmMakefile* mf)
{
- this->DefaultPlatformToolset = this->SelectWindowsPhoneToolset();
- if(this->DefaultPlatformToolset.empty())
+ if(!this->SelectWindowsPhoneToolset(this->DefaultPlatformToolset))
{
cmOStringStream e;
- e << this->GetName() << " supports Windows Phone '8.0' and '8.1', "
- "but not '" << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION.";
+ if(this->DefaultPlatformToolset.empty())
+ {
+ e << this->GetName() << " supports Windows Phone '8.0' and '8.1', but "
+ "not '" << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION.";
+ }
+ else
+ {
+ e << "A Windows Phone component with CMake requires both the Windows "
+ << "Desktop SDK as well as the Windows Phone '" << this->SystemVersion
+ << "' SDK. Please make sure that you have both installed";
+ }
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
return false;
}
@@ -126,12 +134,20 @@ bool cmGlobalVisualStudio12Generator::InitializeWindowsPhone(cmMakefile* mf)
//----------------------------------------------------------------------------
bool cmGlobalVisualStudio12Generator::InitializeWindowsStore(cmMakefile* mf)
{
- this->DefaultPlatformToolset = this->SelectWindowsStoreToolset();
- if(this->DefaultPlatformToolset.empty())
+ if(!this->SelectWindowsStoreToolset(this->DefaultPlatformToolset))
{
cmOStringStream e;
- e << this->GetName() << " supports Windows Store '8.0' and '8.1', "
- "but not '" << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION.";
+ if(this->DefaultPlatformToolset.empty())
+ {
+ e << this->GetName() << " supports Windows Store '8.0' and '8.1', but "
+ "not '" << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION.";
+ }
+ else
+ {
+ e << "A Windows Store component with CMake requires both the Windows "
+ << "Desktop SDK as well as the Windows Store '" << this->SystemVersion
+ << "' SDK. Please make sure that you have both installed";
+ }
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
return false;
}
@@ -139,23 +155,45 @@ bool cmGlobalVisualStudio12Generator::InitializeWindowsStore(cmMakefile* mf)
}
//----------------------------------------------------------------------------
-std::string cmGlobalVisualStudio12Generator::SelectWindowsPhoneToolset() const
+bool
+cmGlobalVisualStudio12Generator::SelectWindowsPhoneToolset(
+ std::string& toolset) const
{
if(this->SystemVersion == "8.1")
{
- return "v120_wp81";
+ if (this->IsWindowsPhoneToolsetInstalled() &&
+ this->IsWindowsDesktopToolsetInstalled())
+ {
+ toolset = "v120_wp81";
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
- return this->cmGlobalVisualStudio11Generator::SelectWindowsPhoneToolset();
+ return this->cmGlobalVisualStudio11Generator::SelectWindowsPhoneToolset(toolset);
}
//----------------------------------------------------------------------------
-std::string cmGlobalVisualStudio12Generator::SelectWindowsStoreToolset() const
+bool
+cmGlobalVisualStudio12Generator::SelectWindowsStoreToolset(
+ std::string& toolset) const
{
if(this->SystemVersion == "8.1")
{
- return "v120";
+ if(this->IsWindowsStoreToolsetInstalled() &&
+ this->IsWindowsDesktopToolsetInstalled())
+ {
+ toolset = "v120";
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
- return this->cmGlobalVisualStudio11Generator::SelectWindowsStoreToolset();
+ return this->cmGlobalVisualStudio11Generator::SelectWindowsStoreToolset(toolset);
}
//----------------------------------------------------------------------------
@@ -180,3 +218,44 @@ cmLocalGenerator *cmGlobalVisualStudio12Generator::CreateLocalGenerator()
lg->SetGlobalGenerator(this);
return lg;
}
+
+//----------------------------------------------------------------------------
+bool
+cmGlobalVisualStudio12Generator::IsWindowsDesktopToolsetInstalled() const
+{
+ const char desktop81Key[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
+ "VisualStudio\\12.0\\VC\\LibraryDesktop";
+
+ std::string path;
+ cmSystemTools::ReadRegistryValue(desktop81Key,
+ path,
+ cmSystemTools::KeyWOW64_32);
+ return !path.empty();
+}
+
+//----------------------------------------------------------------------------
+bool
+cmGlobalVisualStudio12Generator::IsWindowsPhoneToolsetInstalled() const
+{
+ const char wp81Key[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
+ "Microsoft SDKs\\WindowsPhone\\v8.1\\Install Path;Install Path";
+
+ std::string path;
+ cmSystemTools::ReadRegistryValue(wp81Key,
+ path,
+ cmSystemTools::KeyWOW64_32);
+ return !path.empty();
+}
+
+//----------------------------------------------------------------------------
+bool
+cmGlobalVisualStudio12Generator::IsWindowsStoreToolsetInstalled() const
+{
+ const char win81Key[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
+ "VisualStudio\\12.0\\VC\\Libraries\\Core\\Arm";
+
+ std::vector<std::string> subkeys;
+ return cmSystemTools::GetRegistrySubKeys(win81Key,
+ subkeys,
+ cmSystemTools::KeyWOW64_32);
+}
diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h
index ec85f10..a81516f 100644
--- a/Source/cmGlobalVisualStudio12Generator.h
+++ b/Source/cmGlobalVisualStudio12Generator.h
@@ -41,8 +41,14 @@ public:
protected:
virtual bool InitializeWindowsPhone(cmMakefile* mf);
virtual bool InitializeWindowsStore(cmMakefile* mf);
- virtual std::string SelectWindowsPhoneToolset() const;
- virtual std::string SelectWindowsStoreToolset() const;
+ virtual bool SelectWindowsPhoneToolset(std::string& toolset) const;
+ virtual bool SelectWindowsStoreToolset(std::string& toolset) const;
+
+ // These aren't virtual because we need to check if the selected version
+ // of the toolset is installed
+ bool IsWindowsDesktopToolsetInstalled() const;
+ bool IsWindowsPhoneToolsetInstalled() const;
+ bool IsWindowsStoreToolsetInstalled() const;
virtual const char* GetIDEVersion() { return "12.0"; }
private:
class Factory;
--
1.9.4.msysgit.1
15228-2.patch [^] (1,405 bytes) 2014-11-13 15:58 [Show Content] [Hide Content]From b308eac1a624f642eae6603903646553d19415f1 Mon Sep 17 00:00:00 2001
From: Gilles Khouzam <gillesk@microsoft.com>
Date: Thu, 13 Nov 2014 12:44:06 -0800
Subject: [PATCH 2/2] Issue: 15228 Better error messages when compiler isn't
detected on Windows
Missed a detection logic in VS 2013
---
Source/cmGlobalVisualStudio12Generator.cxx | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
index 0d99fe1..640010f 100644
--- a/Source/cmGlobalVisualStudio12Generator.cxx
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -226,11 +226,10 @@ cmGlobalVisualStudio12Generator::IsWindowsDesktopToolsetInstalled() const
const char desktop81Key[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
"VisualStudio\\12.0\\VC\\LibraryDesktop";
- std::string path;
- cmSystemTools::ReadRegistryValue(desktop81Key,
- path,
- cmSystemTools::KeyWOW64_32);
- return !path.empty();
+ std::vector<std::string> subkeys;
+ return cmSystemTools::GetRegistrySubKeys(desktop81Key,
+ subkeys,
+ cmSystemTools::KeyWOW64_32);
}
//----------------------------------------------------------------------------
--
1.9.4.msysgit.1
cmake_obj_lib.tar.bz2 [^] (521 bytes) 2014-11-15 04:50
15228-3.patch [^] (1,027 bytes) 2014-11-16 17:32 [Show Content] [Hide Content]
From d0f3c85f78ee6110e961851f9642ddb282f2a47d Mon Sep 17 00:00:00 2001
From: Gilles Khouzam <gillesk@microsoft.com>
Date: Sun, 16 Nov 2014 14:24:58 -0800
Subject: [PATCH 3/3] Issue: 15228 Better error messages when compiler isn't
detected on Windows
Fix object library producing WinMD file when unnecessary
---
Source/cmVisualStudio10TargetGenerator.cxx | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 26fc317..f9d5e00 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2036,7 +2036,8 @@ WriteMasmOptions(std::string const& configName,
void
cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config)
{
- if(this->Target->GetType() != cmTarget::STATIC_LIBRARY)
+ if(this->Target->GetType() != cmTarget::STATIC_LIBRARY &&
+ this->Target->GetType() != cmTarget::OBJECT_LIBRARY)
{
return;
}
--
1.9.4.msysgit.1
|