Browse Source

cmake: add supported platforms to cmake -E capabilties report

scheffle 4 years ago
parent
commit
66be34853c

+ 6 - 0
Help/manual/cmake.1.rst

@@ -575,6 +575,12 @@ Available commands are:
       ``true`` if the generator supports toolsets and ``false`` otherwise.
     ``platformSupport``
       ``true`` if the generator supports platforms and ``false`` otherwise.
+    ``supportedPlatforms``
+      .. versionadded:: 3.21
+
+      Optional member that may be present when the generator supports
+      platform specification via :variable:`CMAKE_GENERATOR_PLATFORM`
+      (``-A ...``).  The value is a list of platforms known to be supported.
     ``extraGenerators``
       A list of strings with all the extra generators compatible with
       the generator.

+ 6 - 0
Help/release/dev/capabilties-generator-platforms.rst

@@ -0,0 +1,6 @@
+capabilties-generator-platforms
+-------------------------------
+
+* The :manual:`cmake(1)` ``-E capabilities`` output now contains for each
+  generator a ``supportedPlatforms`` field listing platform known to
+  be supported in :variable:`CMAKE_GENERATOR_PLATFORM`.

+ 7 - 0
Source/cmake.cxx

@@ -259,6 +259,13 @@ Json::Value cmake::ReportCapabilitiesJson() const
       gen["name"] = gi.name;
       gen["toolsetSupport"] = gi.supportsToolset;
       gen["platformSupport"] = gi.supportsPlatform;
+      if (!gi.supportedPlatforms.empty()) {
+        Json::Value supportedPlatforms = Json::arrayValue;
+        for (std::string const& platform : gi.supportedPlatforms) {
+          supportedPlatforms.append(platform);
+        }
+        gen["supportedPlatforms"] = std::move(supportedPlatforms);
+      }
       gen["extraGenerators"] = Json::arrayValue;
       generatorMap[gi.name] = gen;
     } else {