Repository: svenevs/ci_exec

Issue:
add ninja multi config generator
https://cmake.org/cmake/help/latest/generator/Ninja%20Multi-Config.html

Wait until 3.17 comes out to make it easier to test :smirk:

Comments:

Patch:
diff --git a/ci_exec/parsers/cmake_parser.py b/ci_exec/parsers/cmake_parser.py
index 5fa9cd8..267904f 100644
--- a/ci_exec/parsers/cmake_parser.py
+++ b/ci_exec/parsers/cmake_parser.py
@@ -261,6 +261,13 @@ class CMakeParser(argparse.ArgumentParser):
     __ https://cmake.org/cmake/help/latest/generator/Ninja.html
     """
 
+    ninja_multi_generator = {"Ninja Multi-Config"}
+    """
+    The `Ninja Multi-Config Generator`__.
+
+    __ https://cmake.org/cmake/help/latest/generator/Ninja%20Multi-Config.html
+    """
+
     visual_studio_generators = {
         "Visual Studio 9 2008",
         "Visual Studio 10 2010",
@@ -268,7 +275,8 @@ class CMakeParser(argparse.ArgumentParser):
         "Visual Studio 12 2013",
         "Visual Studio 14 2015",
         "Visual Studio 15 2017",
-        "Visual Studio 16 2019"
+        "Visual Studio 16 2019",
+        "Visual Studio 17 2022"
     }
     """
     The `Visual Studio Generators`__.
@@ -286,7 +294,8 @@ class CMakeParser(argparse.ArgumentParser):
     @classmethod
     def is_multi_config_generator(cls, generator: str) -> bool:
         """Whether or not string ``generator`` is a multi-config generator."""
-        return generator in (cls.visual_studio_generators | cls.other_generators)
+        return generator in (cls.visual_studio_generators | cls.other_generators |
+                             cls.ninja_multi_generator)
 
     @classmethod
     def is_single_config_generator(cls, generator: str) -> bool:
@@ -310,7 +319,8 @@ class CMakeParser(argparse.ArgumentParser):
             help="Generator to use (CMake -G flag).",
             choices=sorted(
                 self.makefile_generators | self.ninja_generator |
-                self.visual_studio_generators | self.other_generators
+                self.ninja_multi_generator | self.visual_studio_generators |
+                self.other_generators
             )
         )
 


Test patch:
diff --git a/tests/parsers/cmake_parser.py b/tests/parsers/cmake_parser.py
index 3b60354..10308f0 100644
--- a/tests/parsers/cmake_parser.py
+++ b/tests/parsers/cmake_parser.py
@@ -53,7 +53,8 @@ def test_cmake_parser_is_x_config_generator():
         assert CMakeParser.is_single_config_generator(g)
         assert not CMakeParser.is_multi_config_generator(g)
 
-    for g in chain(CMakeParser.visual_studio_generators, CMakeParser.other_generators):
+    for g in chain(CMakeParser.visual_studio_generators, CMakeParser.other_generators,
+                   CMakeParser.ninja_multi_generator):
         assert not CMakeParser.is_single_config_generator(g)
         assert CMakeParser.is_multi_config_generator(g)
 
@@ -492,3 +493,9 @@ def test_cmake_parser_single_vs_multi_configure_build_args():
     ])
     assert "-DCMAKE_BUILD_TYPE=Debug" not in args.cmake_configure_args
     assert args.cmake_build_args == ["--config", "Debug"]
+
+    args = parser.parse_args([
+        "-G", "Ninja Multi-Config", "--build-type", "Debug"
+    ])
+    assert "-DCMAKE_BUILD_TYPE=Debug" not in args.cmake_configure_args
+    assert args.cmake_build_args == ["--config", "Debug"]