aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2008-02-20 20:26:39 +0000
committerAlexander Neundorf <neundorf@kde.org>2008-02-20 20:26:39 +0000
commit0decb04cc5316c3d081d00fc13a3d85755e918fb (patch)
tree6bb31667b29994a193c6872ebda2a73ffaa33de6 /modules
parent4c1a6b4bc17df1c31a7aa6b5d37ff336342ba9e0 (diff)
downloadextra-cmake-modules-0decb04cc5316c3d081d00fc13a3d85755e918fb.tar.gz
extra-cmake-modules-0decb04cc5316c3d081d00fc13a3d85755e918fb.tar.bz2
-add INSTALL_TARGETS_DEFAULT_ARGS so e.g. kdepim trunk can work with kdelibs from the 4.0 branch
while still being able to install correctly also on windows -allow duplicated targets, used e.g. for buildtests (for cmake 2.6 compatibility) -set CMAKE_LINK_OLD_PATHS to TRUE, so make sure linking works even if libs without full path are used (also cmake 2.6 compatiblity) Alex svn path=/branches/KDE/4.0/kdelibs/; revision=777511
Diffstat (limited to 'modules')
-rw-r--r--modules/FindKDE4Internal.cmake51
1 files changed, 43 insertions, 8 deletions
diff --git a/modules/FindKDE4Internal.cmake b/modules/FindKDE4Internal.cmake
index 03b0e307..e0b7bc15 100644
--- a/modules/FindKDE4Internal.cmake
+++ b/modules/FindKDE4Internal.cmake
@@ -487,14 +487,7 @@ set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
if (WIN32)
# use relative install prefix to avoid hardcoded install paths in cmake_install.cmake files
-# ok, this is more like a hack to get dll's installed into the same directory as the executables
-# without having to use the full syntax of INSTALL(TARGETS ...) everywhere.
-# LIB_INSTALL_DIR is set to a list of arguments, the first being the "default" destination
-# which is then overridden by the following three specialized destinations
- set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}"
- RUNTIME DESTINATION "bin"
- LIBRARY DESTINATION "lib${LIB_SUFFIX}"
- ARCHIVE DESTINATION "lib${LIB_SUFFIX}" ) # The subdirectory relative to the install prefix where libraries will be installed (default is ${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX})
+ set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" ) # The subdirectory relative to the install prefix where libraries will be installed (default is ${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX})
set(EXEC_INSTALL_PREFIX "" ) # Base directory for executables and libraries
set(SHARE_INSTALL_PREFIX "share" ) # Base directory for files which go to share/
@@ -600,6 +593,31 @@ else (WIN32)
endif (WIN32)
+# 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 )
+
+
############## add some more default search paths ###############
# always search in the directory where cmake is installed
# and in the current installation prefix
@@ -634,6 +652,23 @@ if(WIN32)
"${CMAKE_INSTALL_PREFIX}/bin" )
endif(WIN32)
+# Differences between CMake 2.4 and 2.6
+if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.4)
+ # CMake 2.6 gives errors if there are multiple targets with the same name
+ # we use this for the target "buildtests", which is created for the unit tests
+ # and which depends on the tests, so building "buildtests" builds all the tests
+ # enabling this property disables this check in CMake
+ set_property(GLOBAL PROPERTY ALLOW_DUPLICATE_CUSTOM_TARGETS 1)
+
+ # CMake 2.6 uses the full file names of the libraries when linking and so
+ # doesn't use -L anymore to list the link dirs. Now the dependencies created
+ # export_library_dependencies() lists the in-project libraries without
+ # path, i.e. with only the logical name ("kdecore"), so they don't link
+ # Setting this variable to true has the effect that the link dirs are
+ # listed nevertheless also with CMake 2.6.
+ set(CMAKE_LINK_OLD_PATHS TRUE)
+
+endif("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.4)
##################### and now the platform specific stuff ############################