diff options
author | Brad King <brad.king@kitware.com> | 2008-01-30 02:16:49 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2008-01-30 02:16:49 (GMT) |
commit | 52b3f85642bd54362ec84c7279e3d63047861a53 (patch) | |
tree | 4df72032fa11b810afe9cd879017c34a1f1308fc | |
parent | 66e0b4212fbbaaf3c5aa5af6a51aa3a5af002edf (diff) | |
download | CMake-52b3f85642bd54362ec84c7279e3d63047861a53.zip CMake-52b3f85642bd54362ec84c7279e3d63047861a53.tar.gz CMake-52b3f85642bd54362ec84c7279e3d63047861a53.tar.bz2 |
ENH: Enable use of link script whenever incremental archive construction rules are available. Enable use of archive construction rules on MSYS.
-rw-r--r-- | Source/cmLocalGenerator.cxx | 3 | ||||
-rw-r--r-- | Source/cmLocalGenerator.h | 4 | ||||
-rw-r--r-- | Source/cmMakefileExecutableTargetGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmMakefileLibraryTargetGenerator.cxx | 19 |
4 files changed, 28 insertions, 4 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 493d26e..244c9e5 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -50,6 +50,7 @@ cmLocalGenerator::cmLocalGenerator() this->MinGWMake = false; this->NMake = false; this->MSYSShell = false; + this->LinkScriptShell = false; this->IgnoreLibPrefix = false; this->UseRelativePaths = false; this->Configured = false; @@ -1995,7 +1996,7 @@ std::string cmLocalGenerator::Convert(const char* source, // For the MSYS shell convert drive letters to posix paths, so // that c:/some/path becomes /c/some/path. This is needed to // avoid problems with the shell path translation. - if(this->MSYSShell) + if(this->MSYSShell && !this->LinkScriptShell) { if(result.size() > 2 && result[1] == ':') { diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index d899747..c55f6a3 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -210,6 +210,9 @@ public: const char* Defines; }; + /** Set whether to treat conversions to SHELL as a link script shell. */ + void SetLinkScriptShell(bool b) { this->LinkScriptShell = b; } + /** Escape the given string to be used as a command line argument in the native build system shell. Optionally allow the build system to replace make variable references. Optionally adjust @@ -346,6 +349,7 @@ protected: bool NMake; bool ForceUnixPath; bool MSYSShell; + bool LinkScriptShell; bool UseRelativePaths; bool IgnoreLibPrefix; bool Configured; diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index e67b991..bb54f26 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -367,6 +367,9 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // Expand the rule variables. { + // Set path conversion for link script shells. + this->LocalGenerator->SetLinkScriptShell(useLinkScript); + // Collect up flags to link in needed libraries. cmOStringStream linklibs; this->LocalGenerator->OutputLinkLibraries(linklibs, *this->Target, relink); @@ -428,6 +431,9 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) this->LocalGenerator->ExpandRuleVariables(*i, vars); } this->LocalGenerator->TargetImplib = ""; + + // Restore path conversion to normal shells. + this->LocalGenerator->SetLinkScriptShell(false); } // Optionally convert the build rule to use a script to avoid long diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index a81cfd6..8e96fd6 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -673,7 +673,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules std::vector<std::string> archiveAppendCommands; std::vector<std::string> archiveFinishCommands; std::string::size_type archiveCommandLimit = std::string::npos; - if(useLinkScript && this->Target->GetType() == cmTarget::STATIC_LIBRARY) + if(this->Target->GetType() == cmTarget::STATIC_LIBRARY) { std::string arCreateVar = "CMAKE_"; arCreateVar += linkLanguage; @@ -696,18 +696,28 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules { cmSystemTools::ExpandListArgument(rule, archiveFinishCommands); } + } + + // Decide whether to use archiving rules. + bool useArchiveRules = + !archiveCreateCommands.empty() && !archiveAppendCommands.empty(); + if(useArchiveRules) + { + // Archiving rules are always run with a link script. + useLinkScript = true; // Limit the length of individual object lists to less than the // 32K command line length limit on Windows. We could make this a // platform file variable but this should work everywhere. archiveCommandLimit = 30000; } - bool useArchiveRules = - !archiveCreateCommands.empty() && !archiveAppendCommands.empty(); // Expand the rule variables. std::vector<std::string> real_link_commands; { + // Set path conversion for link script shells. + this->LocalGenerator->SetLinkScriptShell(useLinkScript); + // Collect up flags to link in needed libraries. cmOStringStream linklibs; this->LocalGenerator->OutputLinkLibraries(linklibs, *this->Target, relink); @@ -864,6 +874,9 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules } } this->LocalGenerator->TargetImplib = ""; + + // Restore path conversion to normal shells. + this->LocalGenerator->SetLinkScriptShell(false); } // Optionally convert the build rule to use a script to avoid long |