summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/testDynamicLoader.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-06-28 17:32:23 (GMT)
committerBrad King <brad.king@kitware.com>2021-06-28 17:32:23 (GMT)
commit7e9a32947bab0ee84a1a869c49bbe0d2459a8c3c (patch)
tree5fb3349c2204e9458a465460b71fa5143cfcd94f /Source/kwsys/testDynamicLoader.cxx
parent20bed8d2acd8548a13df33cbdef05c95f2783b2c (diff)
parentbf4ae1c2b242e6a37034fac7efd86b0786130bfb (diff)
downloadCMake-7e9a32947bab0ee84a1a869c49bbe0d2459a8c3c.zip
CMake-7e9a32947bab0ee84a1a869c49bbe0d2459a8c3c.tar.gz
CMake-7e9a32947bab0ee84a1a869c49bbe0d2459a8c3c.tar.bz2
Merge branch 'upstream-KWSys' into update-kwsys
# By KWSys Upstream * upstream-KWSys: KWSys 2021-06-28 (0648cb1a)
Diffstat (limited to 'Source/kwsys/testDynamicLoader.cxx')
-rw-r--r--Source/kwsys/testDynamicLoader.cxx23
1 files changed, 21 insertions, 2 deletions
diff --git a/Source/kwsys/testDynamicLoader.cxx b/Source/kwsys/testDynamicLoader.cxx
index 703ad4d..9ba204e 100644
--- a/Source/kwsys/testDynamicLoader.cxx
+++ b/Source/kwsys/testDynamicLoader.cxx
@@ -8,6 +8,25 @@
# include <be/kernel/OS.h> /* disable_debugger() API. */
#endif
+// Needed for __GLIBC__ test macro.
+#ifdef __linux__
+# include <features.h>
+#endif
+
+// Will define LIBDL_SO macro on systems with glibc.
+#ifdef __GLIBC__
+# include <gnu/lib-names.h>
+// Define to LIBC_SO, if not defined by above header.
+# ifndef LIBDL_SO
+# define LIBDL_SO LIBC_SO
+# endif
+#endif
+
+// Define the LIBDL_SO macro, if not defined above.
+#ifndef LIBDL_SO
+# define LIBDL_SO "libdl.so"
+#endif
+
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
#if 0
@@ -107,8 +126,8 @@ int testDynamicLoader(int argc, char* argv[])
// This one is actually fun to test, since dlopen is by default
// loaded...wonder why :)
res += TestDynamicLoader("foobar.lib", "dlopen", 0, 1, 0);
- res += TestDynamicLoader("libdl.so", "dlopen", 1, 1, 1);
- res += TestDynamicLoader("libdl.so", "TestDynamicLoader", 1, 0, 1);
+ res += TestDynamicLoader(LIBDL_SO, "dlopen", 1, 1, 1);
+ res += TestDynamicLoader(LIBDL_SO, "TestDynamicLoader", 1, 0, 1);
#endif
// Now try on the generated library
std::string libname = GetLibName(KWSYS_NAMESPACE_STRING "TestDynload");