diff options
author | Brad King <brad.king@kitware.com> | 2006-09-15 18:09:10 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-09-15 18:09:10 (GMT) |
commit | 1d0502927c32cb3a14c101da16d7ab97901dc2a2 (patch) | |
tree | a42fea8061717baf973c3d1588f7ca0f136aa3d1 /Source/cmOrderLinkDirectories.h | |
parent | 429571bd1f35541f1d5c64d3d46bdc2e6b0a95ac (diff) | |
download | CMake-1d0502927c32cb3a14c101da16d7ab97901dc2a2.zip CMake-1d0502927c32cb3a14c101da16d7ab97901dc2a2.tar.gz CMake-1d0502927c32cb3a14c101da16d7ab97901dc2a2.tar.bz2 |
ENH: Adding support to link specifically to an archive or a shared library based on the file name specified. This fixes the problem of having -lfoo linking to libfoo.so even when it came from libfoo.a being specified.
Diffstat (limited to 'Source/cmOrderLinkDirectories.h')
-rw-r--r-- | Source/cmOrderLinkDirectories.h | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/Source/cmOrderLinkDirectories.h b/Source/cmOrderLinkDirectories.h index 3f42143..0da6e85 100644 --- a/Source/cmOrderLinkDirectories.h +++ b/Source/cmOrderLinkDirectories.h @@ -66,10 +66,19 @@ public: // should be set from CMAKE_STATIC_LIBRARY_SUFFIX, // CMAKE_SHARED_LIBRARY_SUFFIX // CMAKE_LINK_LIBRARY_SUFFIX - void AddLinkExtension(const char* e) + enum LinkType { LinkUnknown, LinkStatic, LinkShared }; + void AddLinkExtension(const char* e, LinkType type = LinkUnknown) { if(e && *e) { + if(type == LinkStatic) + { + this->StaticLinkExtensions.push_back(e); + } + if(type == LinkShared) + { + this->SharedLinkExtensions.push_back(e); + } this->LinkExtensions.push_back(e); } } @@ -86,6 +95,11 @@ public: // return a list of all full path libraries void GetFullPathLibraries(std::vector<cmStdString>& libs); + // Provide flags for switching library link type. + void SetLinkTypeInformation(LinkType start_link_type, + const char* static_link_type_flag, + const char* shared_link_type_flag); + // structure to hold a full path library link item struct Library { @@ -101,6 +115,7 @@ public: private: void CreateRegularExpressions(); + std::string CreateExtensionRegex(std::vector<cmStdString> const& exts); void DetermineLibraryPathOrder(std::vector<cmStdString>& searchPaths, std::vector<cmStdString>& libs, std::vector<cmStdString>& sortedPaths); @@ -145,6 +160,8 @@ private: // This is the set of -L paths unsorted, but unique std::set<cmStdString> LinkPathSet; // the names of link extensions + std::vector<cmStdString> StaticLinkExtensions; + std::vector<cmStdString> SharedLinkExtensions; std::vector<cmStdString> LinkExtensions; // the names of link prefixes cmStdString LinkPrefix; @@ -154,10 +171,20 @@ private: cmStdString TargetName; // Subdirectory used for this configuration if any. cmStdString ConfigSubdir; + + // Link type adjustment. + LinkType StartLinkType; + LinkType CurrentLinkType; + cmStdString StaticLinkTypeFlag; + cmStdString SharedLinkTypeFlag; + bool LinkTypeEnabled; + void SetCurrentLinkType(LinkType lt); + // library regular expressions cmsys::RegularExpression RemoveLibraryExtension; - cmsys::RegularExpression ExtractBaseLibraryName; - cmsys::RegularExpression ExtractBaseLibraryNameNoPrefix; + cmsys::RegularExpression ExtractStaticLibraryName; + cmsys::RegularExpression ExtractSharedLibraryName; + cmsys::RegularExpression ExtractAnyLibraryName; cmsys::RegularExpression SplitFramework; bool Debug; }; |