diff options
author | Brad King <brad.king@kitware.com> | 2016-10-18 19:35:10 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-10-18 19:35:10 (GMT) |
commit | 3a9e92bce1c10e0082d431a61e100485fd6cf270 (patch) | |
tree | b2dc2e604a1f4745d748ba04ed7aedea16cb8e44 /Source | |
parent | 96f6fe6b5737494fc560e126b7c797d232d9307e (diff) | |
download | CMake-3a9e92bce1c10e0082d431a61e100485fd6cf270.zip CMake-3a9e92bce1c10e0082d431a61e100485fd6cf270.tar.gz CMake-3a9e92bce1c10e0082d431a61e100485fd6cf270.tar.bz2 |
Ninja: Add compile rules only for languages that are actually compiled
In `WriteLanguageRules` we collect all languages used for source files
in a target. However, this only needs to include sources that are
actually going to be compiled into object files. No object file build
statements will be generated for other sources.
This avoids generating language compile rules for source files that
are not compiled due to being marked as `HEADER_FILE_ONLY`.
Issue: #16373
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmNinjaNormalTargetGenerator.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index b28b19a..80d6d93 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -106,10 +106,11 @@ void cmNinjaNormalTargetGenerator::WriteLanguagesRules() // Write rules for languages compiled in this target. std::set<std::string> languages; - std::vector<cmSourceFile*> sourceFiles; - this->GetGeneratorTarget()->GetSourceFiles( + std::vector<cmSourceFile const*> sourceFiles; + this->GetGeneratorTarget()->GetObjectSources( sourceFiles, this->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE")); - for (std::vector<cmSourceFile*>::const_iterator i = sourceFiles.begin(); + for (std::vector<cmSourceFile const*>::const_iterator i = + sourceFiles.begin(); i != sourceFiles.end(); ++i) { const std::string& lang = (*i)->GetLanguage(); if (!lang.empty()) { |