summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-02-27 21:26:35 (GMT)
committerBrad King <brad.king@kitware.com>2008-02-27 21:26:35 (GMT)
commit4c137bad6b663ff342064c293a49fecf03498207 (patch)
treee12f64e2c7056c860cf62508c482bfc86f9222e3 /Source/cmSystemTools.cxx
parent69ad23a6e73e7eda68b79b4711723190e7bdcdcd (diff)
downloadCMake-4c137bad6b663ff342064c293a49fecf03498207.zip
CMake-4c137bad6b663ff342064c293a49fecf03498207.tar.gz
CMake-4c137bad6b663ff342064c293a49fecf03498207.tar.bz2
ENH: Add ELF file parsing
- Enabled when system provides elf.h - Introduce cmELF class to parse ELF files - Use in cmSystemTools::GuessLibrarySOName to really get soname
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r--Source/cmSystemTools.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 8d13e11..aa4d1c2 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -52,6 +52,10 @@
# include <cmsys/MD5.h>
#endif
+#if defined(CMAKE_USE_ELF_PARSER)
+# include "cmELF.h"
+#endif
+
#if defined(__sgi) && !defined(__GNUC__)
# pragma set woff 1375 /* base class destructor not virtual */
#endif
@@ -2155,6 +2159,16 @@ void cmSystemTools::MakefileColorEcho(int color, const char* message,
bool cmSystemTools::GuessLibrarySOName(std::string const& fullPath,
std::string& soname)
{
+ // For ELF shared libraries use a real parser to get the correct
+ // soname.
+#if defined(CMAKE_USE_ELF_PARSER)
+ cmELF elf(fullPath.c_str());
+ if(elf)
+ {
+ return elf.GetSOName(soname);
+ }
+#endif
+
// If the file is not a symlink we have no guess for its soname.
if(!cmSystemTools::FileIsSymlink(fullPath.c_str()))
{