Skip to content

Commit d5c039d

Browse files
committed
Automatically set Ninja generator for --use-make=ninja
When using `--use-make=ninja` or `--use-make=ninja.exe`, the build would previously fail because CMake was not instructed to generate the corresponding Ninja build files. It would default to generating Makefiles for Linux or Visual Studio MSBuild files for Windows. This change detects when the specified make program is ninja and automatically adds the `-G Ninja` flag to the CMake config step.
1 parent a57eea6 commit d5c039d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lnt/tests/test_suite.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,11 @@ def _configure(self, path, extra_cmake_defs=[], execute=True):
448448
defs['CMAKE_CXX_COMPILER'] = self.opts.cxx
449449
if self.opts.make:
450450
defs['CMAKE_MAKE_PROGRAM'] = self.opts.make
451+
if self.opts.make and (self.opts.make.endswith('ninja') or
452+
self.opts.make.endswith('ninja.exe')):
453+
cmake_flags = ['-G', 'Ninja']
454+
else:
455+
cmake_flags = []
451456

452457
cmake_build_types = ('DEBUG', 'MINSIZEREL', 'RELEASE',
453458
'RELWITHDEBINFO')

0 commit comments

Comments
 (0)