From c60f2fabc413ba79271d55301a7633435e21a865 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Mon, 16 Feb 2004 10:48:54 -0500 Subject: ENH: use cmake variables for cmDynamicLoader to figure out library prefix and extensions --- Source/cmConfigure.cmake.h.in | 5 ++++ Source/cmDynamicLoader.cxx | 59 ++++++++++--------------------------------- 2 files changed, 18 insertions(+), 46 deletions(-) diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in index adf8733..d8dab93 100644 --- a/Source/cmConfigure.cmake.h.in +++ b/Source/cmConfigure.cmake.h.in @@ -11,3 +11,8 @@ #define CMake_VERSION_PATCH @CMake_VERSION_PATCH@ #define CMAKE_DATA_DIR "@CMAKE_DATA_DIR@" + +#define CMAKE_SHARED_LIBRARY_PREFIX "@CMAKE_SHARED_LIBRARY_PREFIX@" +#define CMAKE_SHARED_MODULE_PREFIX "@CMAKE_SHARED_MODULE_PREFIX@" +#define CMAKE_SHARED_LIBRARY_SUFFIX "@CMAKE_SHARED_LIBRARY_SUFFIX@" +#define CMAKE_SHARED_MODULE_SUFFIX "@CMAKE_SHARED_MODULE_SUFFIX@" diff --git a/Source/cmDynamicLoader.cxx b/Source/cmDynamicLoader.cxx index 9f91dd8..14568bf 100644 --- a/Source/cmDynamicLoader.cxx +++ b/Source/cmDynamicLoader.cxx @@ -137,15 +137,6 @@ cmDynamicLoader::GetSymbolAddress(cmLibHandle lib, const char* sym) return *reinterpret_cast(&result); } -const char* cmDynamicLoader::LibPrefix() -{ - return "lib"; -} - -const char* cmDynamicLoader::LibExtension() -{ - return ".sl"; -} const char* cmDynamicLoader::LastError() { @@ -204,16 +195,6 @@ cmDynamicLoader::GetSymbolAddress(cmLibHandle /* lib */, const char* sym) return *reinterpret_cast(&result); } -const char* cmDynamicLoader::LibPrefix() -{ - return "lib"; -} - -const char* cmDynamicLoader::LibExtension() -{ - return ".so"; -} - const char* cmDynamicLoader::LastError() { return 0; @@ -272,19 +253,6 @@ cmDynamicLoader::GetSymbolAddress(cmLibHandle lib, const char* sym) return *reinterpret_cast(&result); } -const char* cmDynamicLoader::LibPrefix() -{ -#if defined( __MINGW32__ ) - return "lib"; -#else - return ""; -#endif -} - -const char* cmDynamicLoader::LibExtension() -{ - return ".dll"; -} const char* cmDynamicLoader::LastError() { @@ -346,20 +314,6 @@ cmDynamicLoader::GetSymbolAddress(cmLibHandle lib, const char* sym) return *reinterpret_cast(&result); } -const char* cmDynamicLoader::LibPrefix() -{ - return "lib"; -} - -const char* cmDynamicLoader::LibExtension() -{ -#ifdef __CYGWIN__ - return ".dll"; -#else - return ".so"; -#endif -} - const char* cmDynamicLoader::LastError() { return dlerror(); @@ -370,3 +324,16 @@ void cmDynamicLoader::FlushCache() { cmDynamicLoaderCache::GetInstance()->FlushCache(); } + +// Stay consistent with the Modules/Platform directory as +// to what the correct prefix and lib extension +const char* cmDynamicLoader::LibPrefix() +{ + return CMAKE_SHARED_MODULE_PREFIX; +} + +const char* cmDynamicLoader::LibExtension() +{ + return CMAKE_SHARED_LIBRARY_SUFFIX; +} + -- cgit v0.12