diff options
author | Brad King <brad.king@kitware.com> | 2008-01-22 14:13:04 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2008-01-22 14:13:04 (GMT) |
commit | 96fd5909d9dd1ffe740230ce652d574cd01c62d5 (patch) | |
tree | e83b3ce2d5066660256a69cacb6caa7d2d95c416 /Source/cmGlobalGenerator.cxx | |
parent | 0df9e6904cd2416336a85d6d7972ce84dcbab417 (diff) | |
download | CMake-96fd5909d9dd1ffe740230ce652d574cd01c62d5.zip CMake-96fd5909d9dd1ffe740230ce652d574cd01c62d5.tar.gz CMake-96fd5909d9dd1ffe740230ce652d574cd01c62d5.tar.bz2 |
ENH: Implement linking with paths to library files instead of -L and -l separation. See bug #3832
- This is purely an implementation improvement. No interface has changed.
- Create cmComputeLinkInformation class
- Move and re-implement logic from:
cmLocalGenerator::ComputeLinkInformation
cmOrderLinkDirectories
- Link libraries to targets with their full path (if it is known)
- Dirs specified with link_directories command still added with -L
- Make link type specific to library names without paths
(name libfoo.a without path becomes -Wl,-Bstatic -lfoo)
- Make directory ordering specific to a runtime path computation feature
(look for conflicting SONAMEs instead of library names)
- Implement proper rpath support on HP-UX and AIX.
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 8f8325e..448d457 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -27,6 +27,8 @@ #include "cmVersion.h" #include "cmInstallExportGenerator.h" +#include <cmsys/Directory.hxx> + #include <stdlib.h> // required for atof #include <assert.h> @@ -784,7 +786,7 @@ void cmGlobalGenerator::Generate() // Compute the manifest of main targets generated. for (i = 0; i < this->LocalGenerators.size(); ++i) { - this->LocalGenerators[i]->GenerateTargetManifest(this->TargetManifest); + this->LocalGenerators[i]->GenerateTargetManifest(); } // Create a map from local generator to the complete set of targets @@ -1880,3 +1882,42 @@ cmGlobalGenerator this->FilesReplacedDuringGenerate.end(), std::back_inserter(filenames)); } + +//---------------------------------------------------------------------------- +void cmGlobalGenerator::AddToManifest(const char* config, + std::string const& f) +{ + // Add to the main manifest for this configuration. + this->TargetManifest[config].insert(f); + + // Add to the content listing for the file's directory. + std::string dir = cmSystemTools::GetFilenamePath(f); + std::string file = cmSystemTools::GetFilenameName(f); + this->DirectoryContentMap[dir].insert(file); +} + +//---------------------------------------------------------------------------- +std::set<cmStdString> const& +cmGlobalGenerator::GetDirectoryContent(std::string const& dir, bool needDisk) +{ + DirectoryContent& dc = this->DirectoryContentMap[dir]; + if(needDisk && !dc.LoadedFromDisk) + { + // Load the directory content from disk. + cmsys::Directory d; + if(d.Load(dir.c_str())) + { + unsigned long n = d.GetNumberOfFiles(); + for(unsigned long i = 0; i < n; ++i) + { + const char* f = d.GetFile(i); + if(strcmp(f, ".") != 0 && strcmp(f, "..") != 0) + { + dc.insert(f); + } + } + } + dc.LoadedFromDisk = true; + } + return dc; +} |