summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaNormalTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-12-24 11:38:24 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-12-24 11:38:24 (GMT)
commit661622f011810093433afa5c9a4795b3d2f19070 (patch)
tree0f5bf633e9eacfde5787cbf881921b16faf1b841 /Source/cmNinjaNormalTargetGenerator.cxx
parentc20d3d319cb97da5793beebe42a80361b2d247c4 (diff)
parent07fc7b75ef981300e7d873091ee90083b18d1c4a (diff)
downloadCMake-661622f011810093433afa5c9a4795b3d2f19070.zip
CMake-661622f011810093433afa5c9a4795b3d2f19070.tar.gz
CMake-661622f011810093433afa5c9a4795b3d2f19070.tar.bz2
Merge topic 'ninja-fix-subdir-objlib-languages'
07fc7b75 Tests: Test using objects from a language enabled in a subdirectory (#15325) fdbfcfdf Ninja: Generate rules only for languages compiled in a target (#15325)
Diffstat (limited to 'Source/cmNinjaNormalTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx17
1 files changed, 15 insertions, 2 deletions
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 25931f3..53b7a8e 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -110,13 +110,26 @@ void cmNinjaNormalTargetGenerator::WriteLanguagesRules()
<< "\n\n";
#endif
+ // Write rules for languages compiled in this target.
std::set<std::string> languages;
- this->GetTarget()->GetLanguages(languages,
- this->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"));
+ std::vector<cmSourceFile*> sourceFiles;
+ this->GetTarget()->GetSourceFiles(sourceFiles,
+ this->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"));
+ for(std::vector<cmSourceFile*>::const_iterator
+ i = sourceFiles.begin(); i != sourceFiles.end(); ++i)
+ {
+ const std::string& lang = (*i)->GetLanguage();
+ if(!lang.empty())
+ {
+ languages.insert(lang);
+ }
+ }
for(std::set<std::string>::const_iterator l = languages.begin();
l != languages.end();
++l)
+ {
this->WriteLanguageRules(*l);
+ }
}
const char *cmNinjaNormalTargetGenerator::GetVisibleTypeName() const