diff options
author | Brad King <brad.king@kitware.com> | 2021-03-26 16:37:15 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-03-29 13:56:43 (GMT) |
commit | 6dd89529e82cbc9650aff204fe063882ae19043b (patch) | |
tree | 4caf057d920a869e398f67b6c0683f5ecb155da0 /Source | |
parent | e21a80e97de69f0d92bca9ed7d0f8e9d86e89628 (diff) | |
download | CMake-6dd89529e82cbc9650aff204fe063882ae19043b.zip CMake-6dd89529e82cbc9650aff204fe063882ae19043b.tar.gz CMake-6dd89529e82cbc9650aff204fe063882ae19043b.tar.bz2 |
Ninja Multi-Config: Fix crash on custom command config with no output
With generator expressions in a custom command's `OUTPUT` and
`BYPRODUCTS`, it is possible to have no outputs at all for a particular
configuration. Generate no rule in this case.
Fixes: #21989
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmLocalNinjaGenerator.cxx | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index a1b350d..51ad993 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -582,6 +582,11 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( auto ccgs = this->MakeCustomCommandGenerators(*cc, fileConfig); for (cmCustomCommandGenerator const& ccg : ccgs) { + if (ccg.GetOutputs().empty() && ccg.GetByproducts().empty()) { + // Generator expressions evaluate to no output for this config. + continue; + } + cmNinjaDeps orderOnlyDeps; // A custom command may appear on multiple targets. However, some build |