summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaNormalTargetGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmNinjaNormalTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx36
1 files changed, 25 insertions, 11 deletions
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 9490658..d42d7f6 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -168,11 +168,13 @@ cmNinjaNormalTargetGenerator
std::string responseFlag;
if (!useResponseFile) {
vars.Objects = "$in";
- vars.LinkLibraries = "$LINK_LIBRARIES";
+ vars.LinkLibraries = "$LINK_PATH $LINK_LIBRARIES";
} else {
- // handle response file
- std::string cmakeLinkVar = std::string("CMAKE_") +
- this->TargetLinkLanguage + "_RESPONSE_FILE_LINK_FLAG";
+ std::string cmakeVarLang = "CMAKE_";
+ cmakeVarLang += this->TargetLinkLanguage;
+
+ // build response file name
+ std::string cmakeLinkVar = cmakeVarLang + "_RESPONSE_FILE_LINK_FLAG";
const char * flag = GetMakefile()->GetDefinition(cmakeLinkVar.c_str());
if(flag) {
responseFlag = flag;
@@ -181,7 +183,14 @@ cmNinjaNormalTargetGenerator
}
rspfile = "$RSP_FILE";
responseFlag += rspfile;
- rspcontent = "$in $LINK_LIBRARIES";
+
+ // build response file content
+ std::string linkOptionVar = cmakeVarLang;
+ linkOptionVar += "_COMPILER_LINKER_OPTION_FLAG_";
+ linkOptionVar += cmTarget::GetTargetTypeName(targetType);
+ const std::string linkOption =
+ GetMakefile()->GetSafeDefinition(linkOptionVar.c_str());
+ rspcontent = "$in " + linkOption + " $LINK_PATH $LINK_LIBRARIES";
vars.Objects = responseFlag.c_str();
vars.LinkLibraries = "";
}
@@ -430,7 +439,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
this->GetGeneratorTarget());
this->AddModuleDefinitionFlag(vars["LINK_FLAGS"]);
- vars["LINK_FLAGS"] += frameworkPath + linkPath;
+ vars["LINK_PATH"] = frameworkPath + linkPath;
// Compute architecture specific link flags. Yes, these go into a different
// variable for executables, probably due to a mistake made when duplicating
@@ -544,15 +553,20 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
int linkRuleLength = this->GetGlobalGenerator()->
GetRuleCmdLength(this->LanguageLinkerRule());
+
+ int commandLineLengthLimit;
+ if (this->GetMakefile()->IsDefinitionSet("CMAKE_FORCE_RESPONSE_FILE")) {
+ commandLineLengthLimit = 1;
+ } else {
#ifdef _WIN32
- int commandLineLengthLimit = 8000 - linkRuleLength;
+ commandLineLengthLimit = 8000 - linkRuleLength;
#elif defined(__linux) || defined(__APPLE__)
- // for instance ARG_MAX is 2096152 on Ubuntu or 262144 on Mac
- int commandLineLengthLimit = ((int)sysconf(_SC_ARG_MAX))
- - linkRuleLength - 1000;
+ // for instance ARG_MAX is 2096152 on Ubuntu or 262144 on Mac
+ commandLineLengthLimit = ((int)sysconf(_SC_ARG_MAX))-linkRuleLength-1000;
#else
- int commandLineLengthLimit = -1;
+ commandLineLengthLimit = -1;
#endif
+ }
const std::string rspfile = std::string
(cmake::GetCMakeFilesDirectoryPostSlash()) +