89 lines
4.2 KiB
Plaintext
89 lines
4.2 KiB
Plaintext
$OpenBSD: patch-Source_cmNinjaNormalTargetGenerator_cxx,v 1.2 2014/12/31 11:06:02 dcoppa Exp $
|
|
|
|
commit fdbfcfdf0173c34845e495f4c0bd407faafc45b4
|
|
Author: Brad King <brad.king@kitware.com>
|
|
Date: Mon Dec 22 19:41:17 2014 -0500
|
|
|
|
Ninja: Generate rules only for languages compiled in a target (#15325)
|
|
|
|
Refactoring in commit v3.1.0-rc1~688^2~2 (cmTarget: Compute languages
|
|
from object libraries on demand, 2014-03-18) taught cmTarget::GetLanguages
|
|
to (correctly) include the languages of object library sources. Previously
|
|
this was done only in cmTarget::ComputeLinkImplementationLanguages to
|
|
choose the linker language.
|
|
The Ninja generator writes out generic build rules for each language
|
|
compiled within a target using the rule variables defined in the
|
|
directory of the target. This only needs to be done for languages
|
|
actually compiled within the current target. Switch from using the
|
|
cmTarget::GetLanguages method to get the list of languages over to
|
|
using cmTarget::GetSourceFiles directly so we do not get the languages
|
|
in object libraries.
|
|
Strictly speaking this should make no difference because it is not safe
|
|
to use objects from a language not enabled in the directory containing
|
|
a target or else the link information for the language may not be
|
|
considered. However, in cases when no link information happens to be
|
|
needed for a language it was possible in CMake 3.0 and below to enable
|
|
a language only in a subdirectory providing an object library, and then
|
|
use the objects from a containing directory. The above change teaches
|
|
the Ninja generator to continue working in this case.
|
|
|
|
|
|
Use Ninja-1.5's console pool to have visible output during long-running
|
|
tasks which produce status updates on the console (such as test suites)
|
|
|
|
--- Source/cmNinjaNormalTargetGenerator.cxx.orig Mon Dec 15 14:07:43 2014
|
|
+++ Source/cmNinjaNormalTargetGenerator.cxx Tue Dec 23 07:47:11 2014
|
|
@@ -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
|
|
@@ -257,6 +270,7 @@ cmNinjaNormalTargetGenerator
|
|
linkCmd,
|
|
description.str(),
|
|
comment.str(),
|
|
+ /*pool*/ "",
|
|
/*depfile*/ "",
|
|
/*deptype*/ "",
|
|
rspfile,
|
|
@@ -279,6 +293,7 @@ cmNinjaNormalTargetGenerator
|
|
"Creating executable symlink $out",
|
|
"Rule for creating "
|
|
"executable symlink.",
|
|
+ /*pool*/ "",
|
|
/*depfile*/ "",
|
|
/*deptype*/ "",
|
|
/*rspfile*/ "",
|
|
@@ -293,6 +308,7 @@ cmNinjaNormalTargetGenerator
|
|
"Creating library symlink $out",
|
|
"Rule for creating "
|
|
"library symlink.",
|
|
+ /*pool*/ "",
|
|
/*depfile*/ "",
|
|
/*deptype*/ "",
|
|
/*rspfile*/ "",
|