]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
cmake: use default GNU installation layout.
authorRalf Habacker <ralf.habacker@freenet.de>
Mon, 13 Feb 2017 19:21:09 +0000 (20:21 +0100)
committerRalf Habacker <ralf.habacker@freenet.de>
Mon, 13 Feb 2017 19:22:47 +0000 (20:22 +0100)
cmake provides a macro named GnuInstallDirs to let install locations
be compatible with GNU's install location layout on several plattforms.
Using that layout makes cmake installs be more compatible to what
autotools use and also supports 32 and 64 bit installations out of the box.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=99721
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
cmake/CMakeLists.txt
cmake/dbus/CMakeLists.txt

index ae388bc3fed56b8a50303a95d0abc110330042ae..aafaf5eea65d9ec53bffa630b21aee077591e92b 100644 (file)
@@ -47,6 +47,7 @@ TIMESTAMP(DBUS_BUILD_TIMESTAMP)
 
 ########### basic vars ###############
 
+include(GNUInstallDirs)
 
 if (DBUSDIR)
        set(DBUS_INSTALL_DIR "${DBUSDIR}")
@@ -65,38 +66,32 @@ set(DBUS_PREFIX ${DBUS_INSTALL_DIR})
 
 set(prefix                   ${DBUS_INSTALL_DIR})
 set(exec_prefix              ${prefix})
-set(EXPANDED_LIBDIR          ${DBUS_INSTALL_DIR}/lib)
-set(EXPANDED_INCLUDEDIR      ${DBUS_INSTALL_DIR}/include)
-set(EXPANDED_BINDIR          ${DBUS_INSTALL_DIR}/bin)
-set(EXPANDED_SYSCONFDIR      ${DBUS_INSTALL_DIR}/etc)
-set(EXPANDED_LOCALSTATEDIR   ${DBUS_INSTALL_DIR}/var)
-set(EXPANDED_DATADIR         ${DBUS_INSTALL_DIR}/share)
-set(DBUS_MACHINE_UUID_FILE   ${DBUS_INSTALL_DIR}/lib/dbus/machine-id)
-set(DBUS_BINDIR              ${EXPANDED_BINDIR})
-set(DBUS_DAEMONDIR           ${EXPANDED_BINDIR})
-set(DBUS_LOCALSTATEDIR       ${EXPANDED_LOCALSTATEDIR})
+set(DBUS_MACHINE_UUID_FILE   ${DBUS_INSTALL_FULL_LIBDIR}/dbus/machine-id)
+set(DBUS_BINDIR              ${CMAKE_INSTALL_FULL_BINDIR})
+set(DBUS_DAEMONDIR           ${CMAKE_INSTALL_FULL_BINDIR})
+set(DBUS_LOCALSTATEDIR       ${CMAKE_INSTALL_FULL_LOCALSTATEDIR})
 
 # On Windows this is relative to where we put the bus setup, in
 # ${datadir}/dbus-1. For simplicity, we only do this if
 # ${sysconfdir} = ${prefix}/etc and ${datadir} = ${prefix}/share.
 #
 # On Unix, or on Windows with weird install layouts, it's the absolute path.
-if(WIN32 AND ${EXPANDED_SYSCONFDIR} STREQUAL ${prefix}/etc AND ${EXPANDED_DATADIR} STREQUAL ${prefix}/share)
+if(WIN32 AND ${CMAKE_INSTALL_FULL_SYSCONFDIR} STREQUAL ${prefix}/etc AND ${CMAKE_INSTALL_FULL_DATADIR} STREQUAL ${prefix}/share)
 set(SYSCONFDIR_FROM_PKGDATADIR ../../etc)
 set(DATADIR_FROM_PKGSYSCONFDIR ../../share)
 else()
-set(SYSCONFDIR_FROM_PKGDATADIR ${EXPANDED_SYSCONFDIR})
-set(DATADIR_FROM_PKGSYSCONFDIR ${EXPANDED_DATADIR})
+set(SYSCONFDIR_FROM_PKGDATADIR ${CMAKE_INSTALL_FULL_SYSCONFDIR})
+set(DATADIR_FROM_PKGSYSCONFDIR ${CMAKE_INSTALL_FULL_DATADIR})
 endif()
 
 # used in the C code
-set(DBUS_LIBEXECDIR          ${EXPANDED_LIBDIR})
-set(DBUS_DATADIR             ${EXPANDED_DATADIR})
+set(DBUS_LIBEXECDIR          ${CMAKE_INSTALL_FULL_LIBEXECDIR})
+set(DBUS_DATADIR             ${CMAKE_INSTALL_FULL_DATADIR})
 
 #enable building of shared library
 SET(BUILD_SHARED_LIBS ON)
 
-set(INSTALL_TARGETS_DEFAULT_ARGS  RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
+set(INSTALL_TARGETS_DEFAULT_ARGS  RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
 
 if (CYGWIN)
    set (WIN32)
@@ -543,10 +538,10 @@ message("                  =============                                       "
 message("                                                                      ")
 message("        install prefix:           ${prefix}                           ")
 message("        install exec_prefix:      ${exec_prefix}                      ")
-message("        install libdir:           ${EXPANDED_LIBDIR}                  ")
-message("        install bindir:           ${EXPANDED_BINDIR}                  ")
-message("        install sysconfdir:       ${EXPANDED_SYSCONFDIR}              ")
-message("        install datadir:          ${EXPANDED_DATADIR}                 ")
+message("        install libdir:           ${CMAKE_INSTALL_FULL_LIBDIR}        ")
+message("        install bindir:           ${CMAKE_INSTALL_FULL_BINDIR}        ")
+message("        install sysconfdir:       ${CMAKE_INSTALL_FULL_SYSCONFDIR}    ")
+message("        install datadir:          ${CMAKE_INSTALL_FULL_DATADIR}       ")
 message("        source code location:     ${DBUS_SOURCE_DIR}                  ")
 message("        build dir:                ${CMAKE_BINARY_DIR}                 ")
 message("        c compiler:               ${C_COMPILER}                       ")
@@ -651,6 +646,6 @@ if(UNIX)
         set(datarootdir ${EXPANDED_DATADIR})
         set(dbus_daemondir ${DBUS_DAEMONDIR})
         configure_file(../dbus-1.pc.in ${CMAKE_BINARY_DIR}/dbus-1.pc @ONLY)
-        install(FILES ${CMAKE_BINARY_DIR}/dbus-1.pc DESTINATION lib/pkgconfig)
+        install(FILES ${CMAKE_BINARY_DIR}/dbus-1.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
     endif()
 endif()
index 09fa1a729685bb782495b2bae97f029c0a45a694..9f8d9b69b26918acbc9ad43df84d206f5ea229e3 100644 (file)
@@ -307,10 +307,10 @@ endif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
 
 install(TARGETS dbus-1 ${INSTALL_TARGETS_DEFAULT_ARGS})
 if(UNIX)
-    install(FILES ${dbusinclude_HEADERS} DESTINATION include/dbus-1.0/dbus)
-    install(FILES ${dbusinclude_ARCH_HEADERS} DESTINATION lib/dbus-1.0/include/dbus)
+    install(FILES ${dbusinclude_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dbus-1.0/dbus)
+    install(FILES ${dbusinclude_ARCH_HEADERS} DESTINATION ${CMAKE_INSTALL_LIBDIR}/dbus-1.0/include/dbus)
 else()
-    install(FILES ${dbusinclude_HEADERS} ${dbusinclude_ARCH_HEADERS} DESTINATION include/dbus)
+    install(FILES ${dbusinclude_HEADERS} ${dbusinclude_ARCH_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dbus)
 endif()
 
 ### Internal library, used for the daemon, tools and tests, compiled statically.