cmake: Modernize build system
[quassel.git] / cmake / QuasselInstallDirs.cmake
1 # This file sets up install locations for Quassel
2 #
3 # (C) 2015 by the Quassel Project <devel@quassel-irc.org>
4 #
5 # Redistribution and use is allowed according to the terms of the BSD license.
6 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
7
8
9 # Setup install locations
10 #####################################################################
11
12 # We support the CMake standard variables (CMAKE_INSTALL_<TYPE>_DIR),
13 # which can be overridden on the command line. If KDE integration is enabled,
14 # we make use of its settings.
15
16 if (NOT WITH_KDE)
17     if (WIN32)
18         # On Windows, we have to guess good paths
19         # We must check if the variables are already defined on the command line
20         if (NOT DEFINED CMAKE_INSTALL_BINDIR)
21             set(CMAKE_INSTALL_BINDIR "${CMAKE_INSTALL_PREFIX}" CACHE PATH "Install path for binaries")
22         endif()
23         if (NOT DEFINED CMAKE_INSTALL_LIBDIR)
24             set(CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}" CACHE PATH "Install path for libraries")
25         endif()
26         if (NOT DEFINED CMAKE_INSTALL_DATADIR)
27             set(CMAKE_INSTALL_DATADIR "$ENV{APPDATA}/quassel-irc.org/share/apps" CACHE PATH "Install path for data files")
28         endif()
29         if (NOT DEFINED CMAKE_INSTALL_ICONDIR)
30             set(CMAKE_INSTALL_ICONDIR "$ENV{APPDATA}/quassel-irc.org/share/icons" CACHE PATH "Install path for icons")
31         endif()
32         if (NOT DEFINED CMAKE_INSTALL_APPDIR)
33             set(CMAKE_INSTALL_APPDIR "$ENV{APPDATA}/quassel-irc.org/share/applications" CACHE PATH "Install path for .desktop files")
34         endif()
35     else()
36         # This sets the standard variables; however it doesn't know about icons and apps
37         include(GNUInstallDirs)
38
39         # Special treatment for paths relative to DATAROOTDIR, as found in GNUInstallDirs
40         if (NOT CMAKE_INSTALL_ICONDIR)
41             set(CMAKE_INSTALL_ICONDIR "" CACHE PATH "Install path for icons")
42             set(CMAKE_INSTALL_ICONDIR "${CMAKE_INSTALL_DATAROOTDIR}/icons")
43         endif()
44         if (NOT CMAKE_INSTALL_APPDIR)
45             set(CMAKE_INSTALL_APPDIR "" CACHE PATH "Install path for .desktop files")
46             set(CMAKE_INSTALL_APPDIR "${CMAKE_INSTALL_DATAROOTDIR}/applications")
47         endif()
48     endif()
49 endif()