CMakeMacroLibtoolFile

From KitwarePublic
Revision as of 21:15, 12 December 2005 by Alex (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Back

This macro creates a libtool .la file for shared libraries or plugins. The first parameter is the target name of the library, the second parameter is the directory where it will be installed to. E.g. for a KDE 3.x module named "kfoo" the usage would be as follows:


ADD_LIBRARY(kfoo SHARED kfoo1.cpp kfoo2.cpp)
CREATE_LIBTOOL_FILE(foo /lib/kde3)


  MACRO(CREATE_LIBTOOL_FILE _target _install_DIR)
     GET_TARGET_PROPERTY(_target_location ${_target} LOCATION)
     GET_FILENAME_COMPONENT(_laname ${_target_location} NAME_WE)
     GET_FILENAME_COMPONENT(_soname ${_target_location} NAME)
     SET(_laname ${_laname}.la)
     FILE(WRITE ${_laname} "# ${_laname} - a libtool library file, generated by cmake \n")
     FILE(APPEND ${_laname} "# The name that we can dlopen(3).\n")
     FILE(APPEND ${_laname} "dlname='${_soname}'\n")
     FILE(APPEND ${_laname} "# Names of this library\n")
     FILE(APPEND ${_laname} "library_names='${_soname} ${_soname} ${_soname}'\n")
     FILE(APPEND ${_laname} "# The name of the static archive\n")
     FILE(APPEND ${_laname} "old_library=\n")
     FILE(APPEND ${_laname} "# Libraries that this one depends upon.\n")
     FILE(APPEND ${_laname} "dependency_libs=\n")
     FILE(APPEND ${_laname} "# Version information.\ncurrent=0\nage=0\nrevision=0\n")
     FILE(APPEND ${_laname} "# Is this an already installed library?\ninstalled=yes\n")
     FILE(APPEND ${_laname} "# Should we warn about portability when linking against -modules?\nshouldnotlink=yes\n")
     FILE(APPEND ${_laname} "# Files to dlopen/dlpreopen\ndlopen=\ndlpreopen=\n")
     FILE(APPEND ${_laname} "# Directory that this library needs to be installed in:\n")
     FILE(APPEND ${_laname} "libdir='${CMAKE_INSTALL_PREFIX}${_install_DIR}'\n")
     INSTALL_FILES(${_install_DIR} FILES ${_laname})
  ENDMACRO(CREATE_LIBTOOL_FILE)

Back



CMake: [Welcome | Site Map]