[ANNOUNCE] new way to install libraries in trunk (please everybody read !)

Alexander Neundorf neundorf at kde.org
Mon Feb 18 23:25:30 CET 2008


Hi,

maybe you already noticed that some changes to the CMakeLists.txt.

**************************************************************************
If you just want a quick workaround to avoid updating kdelibs and make your 
module build again skip to the end of this email.
**************************************************************************

KDE 4.1 is supposed to be released also on Windows, and there the dll part of 
a shared lib has to go in the same directory as the executable, and the lib 
part has to go in the library directory.

In order to do this, actually the full syntax of the cmake install() command 
has to be used:
install(TARGETS kdecore kdeui kwrite RUNTIME DESTINATION ${BIN_INSTALL_DIR}
                                    LIBRARY DESTINATION ${LIB_INSTALL_DIR}
                                    ARCHIVE DESTINATION ${LIB_INSTALL_DIR} )

Since this is a bit lot of typing for everybody, we introduced a new 
variable "INSTALL_TARGETS_DEFAULT_ARGS", which contains just these arguments.
So if you install a library in KDE trunk, please do it from now on using this 
new variables:

install(TARGETS kdecore kdeui ${INSTALL_TARGETS_DEFAULT_ARGS} )

This will make it work on all platforms, including windows.
Use this only if you install a library to the generic destination.
If you install a plugin or any other target to a non-default location, you 
have still to do it as you had to until now.

********************************************************************
Workaround to make your module build again without updating kdelibs
********************************************************************

Since quite a few KDE modules have already been ported to this new style, this 
also means that they more or less require current kdelibs, because otherwise 
that variable does not exist.
So you have to update kdelibs (and qt-copy if you haven't done so yet), build 
and install it.

If you don't want to do that now but later on, there is a workaround.
The attached file contains the code for the new variable.

Append that at the end of your *installed* FindKDE4Internal.cmake and you will 
instantly have that variable available. 
The next time you update, build and install kdelibs this will be overwritten 
with the real version which comes with INSTALL_TARGETS_DEFAULT_ARGS out of th 
box.

Alex
-------------- next part --------------
# The INSTALL_TARGETS_DEFAULT_ARGS variable should be used when libraries are installed.
# The arguments are also ok for regular executables, i.e. executables which don't go
# into sbin/ or libexec/, but for installing executables the basic syntax 
# INSTALL(TARGETS kate DESTINATION "${BIN_INSTALL_DIR}")
# is enough, so using this variable there doesn't help a lot.
# The variable must not be used for installing plugins.
# Usage is like this:
#    install(TARGETS kdecore kdeui ${INSTALL_TARGETS_DEFAULT_ARGS} )
#
# This will install libraries correctly under UNIX, OSX and Windows (i.e. dll's go
# into bin/.
# Later on it will be possible to extend this for installing OSX frameworks
# The COMPONENT Devel argument has the effect that static libraries belong to the 
# "Devel" install component. If we use this also for all install() commands
# for header files, it will be possible to install
#   -everything: make install OR cmake -P cmake_install.cmake
#   -only the development files: cmake -DCOMPONENT=Devel -P cmake_install.cmake
#   -everything except the development files: cmake -DCOMPONENT=Unspecified -P cmake_install.cmake
# This can then also be used for packaging with cpack.

set(INSTALL_TARGETS_DEFAULT_ARGS  RUNTIME DESTINATION "${BIN_INSTALL_DIR}"
                                  LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
                                  ARCHIVE DESTINATION "${LIB_INSTALL_DIR}" COMPONENT Devel )


More information about the Kde-buildsystem mailing list