From d97fc7e1107ca29a3c4711321257820d9f4cefaa Mon Sep 17 00:00:00 2001 From: gitlost Date: Fri, 21 Jun 2024 15:18:00 +0100 Subject: [PATCH] =?UTF-8?q?CMake:=20use=20"GNUInstallDirs"=20instead=20of?= =?UTF-8?q?=20old=20(2008)=20KDE=20=20=20"SetPaths.cmake"=20(removed)=20-?= =?UTF-8?q?=20resolves=20absolute=20paths=20in=20=20=20"zint-targets.cmake?= =?UTF-8?q?",=20ticket=20#318,=20props=20John=20Alexander;=20=20=20also=20?= =?UTF-8?q?remove=20"FindZint.cmake"=20install=20as=20not=20best=20practic?= =?UTF-8?q?e=20=20=20(Daniel=20Pfeifer=20=E2=80=9CEffective=20CMake"),=20b?= =?UTF-8?q?ut=20retain=20in=20tree=20for=20now;=20=20=20also=20remove=20AP?= =?UTF-8?q?PLE=20stuff=20re=20UNIVERSAL=20build,=20obsolete,=20and=20=20?= =?UTF-8?q?=20setting=20of=20CMAKE=5FOSX=5FSYSROOT,=20seems=20unnecessary?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 45 +----- SetPaths.cmake | 273 ------------------------------------- backend/CMakeLists.txt | 13 +- backend_qt/CMakeLists.txt | 4 +- frontend/CMakeLists.txt | 8 +- frontend_qt/CMakeLists.txt | 4 +- 6 files changed, 23 insertions(+), 324 deletions(-) delete mode 100644 SetPaths.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index afa5673d..0f41e107 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,8 +15,6 @@ set(ZINT_VERSION "${ZINT_VERSION_MAJOR}.${ZINT_VERSION_MINOR}.${ZINT_VERSION_REL add_definitions(-DZINT_VERSION=\"${ZINT_VERSION}\") -set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") - option(ZINT_DEBUG "Set debug compile flags" OFF) option(ZINT_NOOPT "Set no optimize compile flags" OFF) option(ZINT_SANITIZE "Set sanitize compile/link flags" OFF) @@ -34,7 +32,12 @@ if(NOT ZINT_SHARED AND NOT ZINT_STATIC) message(SEND_ERROR "Either ZINT_SHARED or ZINT_STATIC or both must be set") endif() -include(SetPaths.cmake) +include(GNUInstallDirs) +# Taken from old (2008) KDE "SetPaths.cmake" +# Set a default build type for single-configuration CMake generators if no build type is set +if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE RelWithDebInfo) +endif() include(CheckCCompilerFlag) include(CheckFunctionExists) @@ -120,25 +123,6 @@ if(ZINT_COVERAGE) endif() endif() -if(APPLE) - if(UNIVERSAL) # TODO: make universal binary - if(NOT ZINT_HAS_BEEN_RUN_BEFORE) - if(EXISTS /Developer/SDKs/MacOSX10.5.sdk OR EXISTS /SDKs/MacOSX10.5.sdk) - set(CMAKE_OSX_ARCHITECTURES "ppc;i386;ppc64;x86_64" CACHE STRING "Build architectures for OSX" FORCE) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden -Wl -single_module " CACHE STRING - "Flags used by the compiler during all build types." FORCE) - elseif(EXISTS /Developer/SDKs/MacOSX10.4u.sdk OR EXISTS /SDKs/MacOSX10.4u.sdk) - set(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden -Wl -single_module " CACHE STRING - "Flags used by the compiler during all build types." FORCE) - endif() - message("Build architectures for OSX:${CMAKE_OSX_ARCHITECTURES}") - endif() - else() - set(CMAKE_OSX_SYSROOT "/") - endif() -endif() - check_function_exists(getopt_long_only HAVE_GETOPT_LONG_ONLY) if(NOT HAVE_GETOPT_LONG_ONLY) add_subdirectory(getopt) @@ -198,20 +182,5 @@ if(ZINT_UNINSTALL) "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") endif() -# staniek: don't install -if(DATA_INSTALL_DIR) - set(CMAKE_MODULES_INSTALL_PATH ${DATA_INSTALL_DIR}/cmake/modules) -else() - set(CMAKE_MODULES_INSTALL_PATH ${CMAKE_ROOT}/Modules) -endif() - -install(FILES cmake/modules/FindZint.cmake DESTINATION ${CMAKE_MODULES_INSTALL_PATH} COMPONENT Devel) configure_file("zint-config.cmake.in" "zint-config.cmake" @ONLY) -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zint-config.cmake" DESTINATION "${SHARE_INSTALL_PREFIX}/zint") - -# This needs to be run very last so other parts of the scripts can take -# advantage of this. -if(NOT ZINT_HAS_BEEN_RUN_BEFORE) - set(ZINT_HAS_BEEN_RUN_BEFORE 1 CACHE INTERNAL - "Flag to track whether this is the first time running CMake or if CMake has been configured before") -endif() +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zint-config.cmake" DESTINATION "${CMAKE_INSTALL_DATADIR}/zint") diff --git a/SetPaths.cmake b/SetPaths.cmake deleted file mode 100644 index 310a4a6f..00000000 --- a/SetPaths.cmake +++ /dev/null @@ -1,273 +0,0 @@ -# - Find include and library dirs, and define a some macros -# -# This module defines a bunch of variables used as locations for install directories. -# They can be relative (to CMAKE_INSTALL_PREFIX) or absolute. -# Under Windows they are always relative. -# -# BIN_INSTALL_DIR - the directory where executables will be installed (default is prefix/bin) -# BUNDLE_INSTALL_DIR - Mac only: the directory where application bundles will be installed (default is /Applications/KDE4 ) -# SBIN_INSTALL_DIR - the directory where system executables will be installed (default is prefix/sbin) -# LIB_INSTALL_DIR - the directory where libraries will be installed (default is prefix/lib) -# CONFIG_INSTALL_DIR - the config file install dir -# DATA_INSTALL_DIR - the parent directory where applications can install their data -# HTML_INSTALL_DIR - the HTML install dir for documentation -# ICON_INSTALL_DIR - the icon install dir (default prefix/share/icons/) -# INFO_INSTALL_DIR - the kde info install dir (default prefix/info) -# KCFG_INSTALL_DIR - the install dir for kconfig files -# LOCALE_INSTALL_DIR - the install dir for translations -# MAN_INSTALL_DIR - the kde man page install dir (default prefix/man/) -# MIME_INSTALL_DIR - the install dir for the mimetype desktop files -# PLUGIN_INSTALL_DIR - the subdirectory relative to the install prefix where plugins will be installed (default is ${KDE4_LIB_INSTALL_DIR}/kde4) -# SERVICES_INSTALL_DIR - the install dir for service (desktop, protocol, ...) files -# SERVICETYPES_INSTALL_DIR - the install dir for servicestypes desktop files -# SOUND_INSTALL_DIR - the install dir for sound files -# TEMPLATES_INSTALL_DIR - the install dir for templates (Create new file...) -# WALLPAPER_INSTALL_DIR - the install dir for wallpapers -# DEMO_INSTALL_DIR - the install dir for demos -# KCONF_UPDATE_INSTALL_DIR - the kconf_update install dir -# XDG_APPS_INSTALL_DIR - the XDG apps dir -# XDG_DIRECTORY_INSTALL_DIR- the XDG directory -# XDG_MIME_INSTALL_DIR - the XDG mimetypes install dir -# DBUS_INTERFACES_INSTALL_DIR - the directory where dbus interfaces be installed (default is prefix/share/dbus-1/interfaces) -# DBUS_SERVICES_INSTALL_DIR - the directory where dbus services be installed (default is prefix/share/dbus-1/services ) -# -# A note on the possible values for CMAKE_BUILD_TYPE and how KDE handles -# the flags for those buildtypes. FindKDE4Internal supports the values -# Debug, Release, Relwithdebinfo, Profile and Debugfull -# -# Release -# optimised for speed, qDebug/kDebug turned off, no debug symbols -# Release with debug info -# optimised for speed, debugging symbols on (-g) -# Debug -# optimised but debuggable, debugging on (-g) -# (-fno-reorder-blocks -fno-schedule-insns -fno-inline) -# DebugFull -# no optimisation, full debugging on (-g3) -# Profile -# DebugFull + -ftest-coverage -fprofile-arcs -# -# It is expected that the "Debug" build type be still debuggable with gdb -# without going all over the place, but still produce better performance. -# It's also important to note that gcc cannot detect all warning conditions -# unless the optimiser is active. -# - -# Copyright (c) 2006-2008, Alexander Neundorf -# Copyright (c) 2006, Laurent Montel, -# Copyright (c) 2008, BogDan Vatra, -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. The name of the author may not be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -########## the following are directories where stuff will be installed to ########### -# -# this has to be after find_xxx() block above - -if (WIN32) -# use relative install prefix to avoid hardcoded install paths in cmake_install.cmake files - - 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/ - set(BIN_INSTALL_DIR "bin" ) # The install dir for executables (default ${EXEC_INSTALL_PREFIX}/bin) - set(SBIN_INSTALL_DIR "sbin" ) # The install dir for system executables (default ${EXEC_INSTALL_PREFIX}/sbin) - - set(LIBEXEC_INSTALL_DIR "${BIN_INSTALL_DIR}" ) # The subdirectory relative to the install prefix where libraries will be installed (default is ${BIN_INSTALL_DIR}) - set(INCLUDE_INSTALL_DIR "include" ) # The subdirectory to the header prefix - - set(PLUGIN_INSTALL_DIR "lib${LIB_SUFFIX}/kde4" ) # "The subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/kde4) - set(CONFIG_INSTALL_DIR "share/config" ) # The config file install dir - set(DATA_INSTALL_DIR "share/apps" ) # The parent directory where applications can install their data - set(HTML_INSTALL_DIR "share/doc/HTML" ) # The HTML install dir for documentation - set(ICON_INSTALL_DIR "share/icons" ) # The icon install dir (default ${SHARE_INSTALL_PREFIX}/share/icons/) - set(KCFG_INSTALL_DIR "share/config.kcfg" ) # The install dir for kconfig files - set(LOCALE_INSTALL_DIR "share/locale" ) # The install dir for translations - set(MIME_INSTALL_DIR "share/mimelnk" ) # The install dir for the mimetype desktop files - set(SERVICES_INSTALL_DIR "share/kde4/services" ) # The install dir for service (desktop, protocol, ...) files - set(SERVICETYPES_INSTALL_DIR "share/kde4/servicetypes" ) # The install dir for servicestypes desktop files - set(SOUND_INSTALL_DIR "share/sounds" ) # The install dir for sound files - set(TEMPLATES_INSTALL_DIR "share/templates" ) # The install dir for templates (Create new file...) - set(WALLPAPER_INSTALL_DIR "share/wallpapers" ) # The install dir for wallpapers - set(DEMO_INSTALL_DIR "share/demos" ) # The install dir for demos - set(KCONF_UPDATE_INSTALL_DIR "share/apps/kconf_update" ) # The kconf_update install dir - set(AUTOSTART_INSTALL_DIR "share/autostart" ) # The install dir for autostart files - - set(XDG_APPS_INSTALL_DIR "share/applications/kde4" ) # The XDG apps dir - set(XDG_DIRECTORY_INSTALL_DIR "share/desktop-directories" ) # The XDG directory - set(XDG_MIME_INSTALL_DIR "share/mime/packages" ) # The install dir for the xdg mimetypes - - set(SYSCONF_INSTALL_DIR "etc" ) # The kde sysconfig install dir (default /etc) - set(MAN_INSTALL_DIR "share/man" ) # The kde man install dir (default ${SHARE_INSTALL_PREFIX}/man/) - set(INFO_INSTALL_DIR "share/info" ) # The kde info install dir (default ${SHARE_INSTALL_PREFIX}/info)") - set(DBUS_INTERFACES_INSTALL_DIR "share/dbus-1/interfaces" ) # The kde dbus interfaces install dir (default ${SHARE_INSTALL_PREFIX}/dbus-1/interfaces)") - set(DBUS_SERVICES_INSTALL_DIR "share/dbus-1/services" ) # The kde dbus services install dir (default ${SHARE_INSTALL_PREFIX}/dbus-1/services)") - -else (WIN32) - - # This macro implements some very special logic how to deal with the cache. - # By default the various install locations inherit their value from their "parent" variable - # so if you set CMAKE_INSTALL_PREFIX, then EXEC_INSTALL_PREFIX, PLUGIN_INSTALL_DIR will - # calculate their value by appending subdirs to CMAKE_INSTALL_PREFIX . - # This would work completely without using the cache. - # But if somebody wants e.g. a different EXEC_INSTALL_PREFIX this value has to go into - # the cache, otherwise it will be forgotten on the next cmake run. - # Once a variable is in the cache, it doesn't depend on its "parent" variables - # anymore and you can only change it by editing it directly. - # this macro helps in this regard, because as long as you don't set one of the - # variables explicitely to some location, it will always calculate its value from its - # parents. So modifying CMAKE_INSTALL_PREFIX later on will have the desired effect. - # But once you decide to set e.g. EXEC_INSTALL_PREFIX to some special location - # this will go into the cache and it will no longer depend on CMAKE_INSTALL_PREFIX. - # - # additionally if installing to the same location as kdelibs, the other install - # directories are reused from the installed kdelibs - macro(_SET_FANCY _var _value _comment) - set(predefinedvalue "${_value}") - - if (NOT DEFINED ${_var}) - set(${_var} ${predefinedvalue}) - else (NOT DEFINED ${_var}) - set(${_var} "${${_var}}" CACHE PATH "${_comment}") - endif (NOT DEFINED ${_var}) - endmacro(_SET_FANCY) - - if(APPLE) - set(BUNDLE_INSTALL_DIR "/Applications/KDE4" CACHE PATH "Directory where application bundles will be installed to on OSX" ) - endif(APPLE) - - _set_fancy(EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" "Base directory for executables and libraries") - _set_fancy(SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share" "Base directory for files which go to share/") - _set_fancy(BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" "The install dir for executables (default ${EXEC_INSTALL_PREFIX}/bin)") - _set_fancy(SBIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/sbin" "The install dir for system executables (default ${EXEC_INSTALL_PREFIX}/sbin)") - _set_fancy(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" "The subdirectory relative to the install prefix where libraries will be installed (default is ${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX})") - _set_fancy(LIBEXEC_INSTALL_DIR "${LIB_INSTALL_DIR}/kde4/libexec" "The subdirectory relative to the install prefix where libraries will be installed (default is ${LIB_INSTALL_DIR}/kde4/libexec)") - _set_fancy(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" "The subdirectory to the header prefix") - - _set_fancy(PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/kde4" "The subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/kde4)") - _set_fancy(CONFIG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config" "The config file install dir") - _set_fancy(DATA_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/apps" "The parent directory where applications can install their data") - _set_fancy(HTML_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/doc/HTML" "The HTML install dir for documentation") - _set_fancy(ICON_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/icons" "The icon install dir (default ${SHARE_INSTALL_PREFIX}/share/icons/)") - _set_fancy(KCFG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config.kcfg" "The install dir for kconfig files") - _set_fancy(LOCALE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/locale" "The install dir for translations") - _set_fancy(MIME_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/mimelnk" "The install dir for the mimetype desktop files") - _set_fancy(SERVICES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/kde4/services" "The install dir for service (desktop, protocol, ...) files") - _set_fancy(SERVICETYPES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/kde4/servicetypes" "The install dir for servicestypes desktop files") - _set_fancy(SOUND_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/sounds" "The install dir for sound files") - _set_fancy(TEMPLATES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/templates" "The install dir for templates (Create new file...)") - _set_fancy(WALLPAPER_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/wallpapers" "The install dir for wallpapers") - _set_fancy(DEMO_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/demos" "The install dir for demos") - _set_fancy(KCONF_UPDATE_INSTALL_DIR "${DATA_INSTALL_DIR}/kconf_update" "The kconf_update install dir") - _set_fancy(AUTOSTART_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/autostart" "The install dir for autostart files") - - _set_fancy(XDG_APPS_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applications/kde4" "The XDG apps dir") - _set_fancy(XDG_DIRECTORY_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/desktop-directories" "The XDG directory") - _set_fancy(XDG_MIME_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/mime/packages" "The install dir for the xdg mimetypes") - - _set_fancy(SYSCONF_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/etc" "The kde sysconfig install dir (default ${CMAKE_INSTALL_PREFIX}/etc)") - _set_fancy(MAN_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/man" "The kde man install dir (default ${SHARE_INSTALL_PREFIX}/man/)") - _set_fancy(INFO_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/info" "The kde info install dir (default ${SHARE_INSTALL_PREFIX}/info)") - _set_fancy(DBUS_INTERFACES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/dbus-1/interfaces" "The kde dbus interfaces install dir (default ${SHARE_INSTALL_PREFIX}/dbus-1/interfaces)") - _set_fancy(DBUS_SERVICES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/dbus-1/services" "The kde dbus services install dir (default ${SHARE_INSTALL_PREFIX}/dbus-1/services)") - -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 ) - - - -# on the Mac support an extra install directory for application bundles starting with cmake 2.6 -if(APPLE) - set(INSTALL_TARGETS_DEFAULT_ARGS ${INSTALL_TARGETS_DEFAULT_ARGS} - BUNDLE DESTINATION "${BUNDLE_INSTALL_DIR}" ) -endif(APPLE) - - -set(CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_SYSTEM_INCLUDE_PATH} - "${INCLUDE_INSTALL_DIR}") - -set(CMAKE_SYSTEM_PROGRAM_PATH ${CMAKE_SYSTEM_PROGRAM_PATH} - "${BIN_INSTALL_DIR}" ) - -set(CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_SYSTEM_LIBRARY_PATH} - "${LIB_INSTALL_DIR}" ) - -# under Windows dlls may be also installed in bin/ -if(WIN32) - set(CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_SYSTEM_LIBRARY_PATH} - "${_CMAKE_INSTALL_DIR}/bin" - "${CMAKE_INSTALL_PREFIX}/bin" ) -endif(WIN32) - - -###################################################### -# and now the platform specific stuff -###################################################### - -# Set a default build type for single-configuration -# CMake generators if no build type is set. -if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE RelWithDebInfo) -endif (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) - - - -# setup default RPATH/install_name handling, may be overridden by KDE4_HANDLE_RPATH_FOR_[LIBRARY|EXECUTABLE] -# default is to build with RPATH for the install dir, so it doesn't need to relink -if (UNIX) - if (APPLE) - set(CMAKE_INSTALL_NAME_DIR ${LIB_INSTALL_DIR}) - else (APPLE) - # add our LIB_INSTALL_DIR to the RPATH and use the RPATH figured out by cmake when compiling - set(CMAKE_INSTALL_RPATH ${LIB_INSTALL_DIR} ) - set(CMAKE_SKIP_BUILD_RPATH TRUE) - set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) - set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) - endif (APPLE) -endif (UNIX) - diff --git a/backend/CMakeLists.txt b/backend/CMakeLists.txt index edf83d54..97448ecd 100644 --- a/backend/CMakeLists.txt +++ b/backend/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2008 by BogDan Vatra < bogdan@licentia.eu > -# Copyright (C) 2009-2022 Robin Stuart +# Copyright (C) 2009-2024 Robin Stuart # vim: set ts=4 sw=4 et : project(zint) @@ -93,17 +93,22 @@ endif() zint_target_include_directories(PUBLIC $ - $ + $ ) +# Adapted from old (2008) KDE "SetPaths.cmake" to use GNUInstallDirs +set(INSTALL_TARGETS_DEFAULT_ARGS RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT Devel) + if(ZINT_SHARED) install(TARGETS zint EXPORT zint-targets ${INSTALL_TARGETS_DEFAULT_ARGS}) endif() if(ZINT_STATIC) install(TARGETS zint-static EXPORT zint-targets ${INSTALL_TARGETS_DEFAULT_ARGS}) endif() -install(EXPORT zint-targets NAMESPACE zint:: DESTINATION "${SHARE_INSTALL_PREFIX}/zint") -install(FILES zint.h DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel) +install(EXPORT zint-targets NAMESPACE zint:: DESTINATION "${CMAKE_INSTALL_DATADIR}/zint") +install(FILES zint.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT Devel) if(ZINT_TEST) add_subdirectory(tests) diff --git a/backend_qt/CMakeLists.txt b/backend_qt/CMakeLists.txt index bf4cd1dc..8f12ef2c 100644 --- a/backend_qt/CMakeLists.txt +++ b/backend_qt/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2008 by BogDan Vatra < bogdan@licentia.eu > -# Copyright (C) 2009-2021 Robin Stuart +# Copyright (C) 2009-2024 Robin Stuart # vim: set ts=4 sw=4 et : project(QZint) @@ -31,4 +31,4 @@ if(ZINT_TEST) endif() install(TARGETS ${PROJECT_NAME} ${INSTALL_TARGETS_DEFAULT_ARGS}) -install(FILES qzint.h DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel) +install(FILES qzint.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT Devel) diff --git a/frontend/CMakeLists.txt b/frontend/CMakeLists.txt index 143e2d95..b4beedaf 100644 --- a/frontend/CMakeLists.txt +++ b/frontend/CMakeLists.txt @@ -4,9 +4,7 @@ project(zint_frontend) -set(${PROJECT_NAME}_SRCS main.c) - -add_executable(${PROJECT_NAME} ${zint_frontend_SRCS}) +add_executable(${PROJECT_NAME} main.c) if(WIN32) target_sources(${PROJECT_NAME} PRIVATE zint.rc) @@ -25,9 +23,9 @@ if(NOT HAVE_GETOPT_LONG_ONLY) target_link_libraries(${PROJECT_NAME} zint_bundled_getopt) endif() -install(TARGETS ${PROJECT_NAME} DESTINATION "${BIN_INSTALL_DIR}" RUNTIME) +install(TARGETS ${PROJECT_NAME} DESTINATION "${CMAKE_INSTALL_BINDIR}" RUNTIME) if(UNIX) - install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../docs/zint.1" DESTINATION "${MAN_INSTALL_DIR}/man1" COMPONENT doc) + install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../docs/zint.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1" COMPONENT doc) endif() if(ZINT_TEST) diff --git a/frontend_qt/CMakeLists.txt b/frontend_qt/CMakeLists.txt index a3e0f901..209ccf13 100644 --- a/frontend_qt/CMakeLists.txt +++ b/frontend_qt/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2008 by BogDan Vatra < bogdan@licentia.eu > -# Copyright (C) 2009-2022 Robin Stuart +# Copyright (C) 2009-2024 Robin Stuart # SPDX-License-Identifier: GPL-3.0-or-later # vim: set ts=4 sw=4 et : @@ -58,4 +58,4 @@ target_link_libraries(${PROJECT_NAME} QZint Qt${QT_VERSION_MAJOR}::Core) -install(TARGETS ${PROJECT_NAME} DESTINATION "${BIN_INSTALL_DIR}" RUNTIME) +install(TARGETS ${PROJECT_NAME} DESTINATION "${CMAKE_INSTALL_BINDIR}" RUNTIME)