--- cmake/MacroCreateLibtoolFile.cmake.orig	2009-10-31 18:22:43 UTC
+++ cmake/MacroCreateLibtoolFile.cmake
@@ -16,17 +16,18 @@ MACRO(CREATE_LIBTOOL_FILE _target _insta
   GET_TARGET_PROPERTY_WITH_DEFAULT(_target_age ${_target} LT_VERSION_AGE 0)
   GET_TARGET_PROPERTY_WITH_DEFAULT(_target_revision ${_target} LT_VERSION_REVISION 0)
   GET_TARGET_PROPERTY_WITH_DEFAULT(_target_installed ${_target} LT_INSTALLED yes)
-  GET_TARGET_PROPERTY_WITH_DEFAULT(_target_shouldnotlink ${_target} LT_SHOULDNOTLINK yes)
+  GET_TARGET_PROPERTY_WITH_DEFAULT(_target_shouldnotlink ${_target} LT_SHOULDNOTLINK no)
   GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dlopen ${_target} LT_DLOPEN "")
   GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dlpreopen ${_target} LT_DLPREOPEN "")
   GET_FILENAME_COMPONENT(_laname ${_target_location} NAME_WE)
   GET_FILENAME_COMPONENT(_soname ${_target_location} NAME)
+  SET(__laname ${_laname}.la)
   SET(_laname ${PROJECT_BINARY_DIR}/${_laname}.la)
-  FILE(WRITE ${_laname} "# ${_laname} - a libtool library file\n")
-  FILE(WRITE ${_laname} "# Generated by CMake ${CMAKE_VERSION} (like GNU libtool)\n")
-  FILE(WRITE ${_laname} "\n# Please DO NOT delete this file!\n# It is necessary for linking the library with libtool.\n\n" )
+  FILE(WRITE ${_laname} "# ${__laname} - a libtool library file\n")
+  FILE(APPEND ${_laname} "# Generated by CMake ${CMAKE_VERSION} (like GNU libtool)\n")
+  FILE(APPEND ${_laname} "\n# Please DO NOT delete this file!\n# It is necessary for linking the library with libtool.\n\n" )
   FILE(APPEND ${_laname} "# The name that we can dlopen(3).\n")
-  FILE(APPEND ${_laname} "dlname='${_soname}'\n\n")
+  FILE(APPEND ${_laname} "dlname='${_soname}.${_target_current}'\n\n")
   FILE(APPEND ${_laname} "# Names of this library.\n")
   FILE(APPEND ${_laname} "library_names='${_soname}.${_target_current}.${_target_age}.${_target_revision} ${_soname}.${_target_current} ${_soname}'\n\n")
   FILE(APPEND ${_laname} "# The name of the static archive.\n")
@@ -35,7 +36,7 @@ MACRO(CREATE_LIBTOOL_FILE _target _insta
   FILE(APPEND ${_laname} "dependency_libs='${_target_dependency_libs}'\n\n")
   FILE(APPEND ${_laname} "# Names of additional weak libraries provided by this library\n")
   FILE(APPEND ${_laname} "weak_library_names=''\n\n")
-  FILE(APPEND ${_laname} "# Version information for ${_laname}.\n")
+  FILE(APPEND ${_laname} "# Version information for ${__laname}.\n")
   FILE(APPEND ${_laname} "current=${_target_current}\n")
   FILE(APPEND ${_laname} "age=${_target_age}\n")
   FILE(APPEND ${_laname} "revision=${_target_revision}\n\n")
