diff options
author | Peter Kümmel <syntheticpp@gmx.net> | 2012-09-27 09:45:25 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-10-01 21:06:38 (GMT) |
commit | e31df0393973e2995f4543890df31c2b752a8ee1 (patch) | |
tree | d30a57669a93cbf99f12c42156ad91fea4ece7f3 /Source/cmNinjaNormalTargetGenerator.cxx | |
parent | 8d674e78449d4bcde669ee5c4a6c0809c0ee51a5 (diff) | |
download | CMake-e31df0393973e2995f4543890df31c2b752a8ee1.zip CMake-e31df0393973e2995f4543890df31c2b752a8ee1.tar.gz CMake-e31df0393973e2995f4543890df31c2b752a8ee1.tar.bz2 |
Ninja: move <OBJECTS> in front of the first linker option
In the response file also linker options could be passed,
and because <OBJECTS> is replaced by a response file, it
is necessary that no compiler option follows <OBJECTS>.
Diffstat (limited to 'Source/cmNinjaNormalTargetGenerator.cxx')
-rw-r--r-- | Source/cmNinjaNormalTargetGenerator.cxx | 36 |
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()) + |