diff --git a/CMakeLists.txt b/CMakeLists.txt index 3149c80..73d0691 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,184 +1,163 @@ #============================================================================= -# Copyright 2006-2013 Alex Neundorf -# Copyright 2014-2015 Alex Merry -# -# 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. +# SPDX-FileCopyrightText: 2006-2013 Alex Neundorf +# SPDX-FileCopyrightText: 2014-2015 Alex Merry +# +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= cmake_minimum_required(VERSION 3.5 FATAL_ERROR) # # Preliminary setup # set(VERSION "5.71.0") # handled by release scripts if (POLICY CMP0048) cmake_policy(SET CMP0048 NEW) project(ECM VERSION "${VERSION}" LANGUAGES NONE ) else() project(ECM NONE) include("${CMAKE_SOURCE_DIR}/modules/ECMSetupVersion.cmake") ecm_setup_version( "${VERSION}" VARIABLE_PREFIX ECM ) endif() # # Includes # set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") include(FeatureSummary) # # Installation paths # set(SHARE_INSTALL_DIR share CACHE PATH "read-only architecture-independent data" ) set(CMAKECONFIG_INSTALL_DIR ${SHARE_INSTALL_DIR}/ECM/cmake/) set(FIND_MODULES_INSTALL_DIR ${SHARE_INSTALL_DIR}/ECM/find-modules/) set(KDE_MODULES_INSTALL_DIR ${SHARE_INSTALL_DIR}/ECM/kde-modules/) set(MODULES_INSTALL_DIR ${SHARE_INSTALL_DIR}/ECM/modules/) set(TOOLCHAIN_MODULES_INSTALL_DIR ${SHARE_INSTALL_DIR}/ECM/toolchain/) set(DOC_INSTALL_DIR ${SHARE_INSTALL_DIR}/doc/ECM CACHE PATH "HTML and QtHelp documentation" ) set(MAN_INSTALL_DIR ${SHARE_INSTALL_DIR}/man CACHE PATH "man pages" ) # # Documentation # add_subdirectory(docs) # # Tests # option(BUILD_TESTING "Build automated tests." ON) add_feature_info(BUILD_TESTING BUILD_TESTING "Build automated tests.") if(BUILD_TESTING) enable_testing() add_subdirectory(tests) endif() # # Install modules # file(GLOB installModuleFiles ${CMAKE_SOURCE_DIR}/modules/*[^~]) install(FILES ${installModuleFiles} DESTINATION ${MODULES_INSTALL_DIR}) file(GLOB installTestModuleFiles ${CMAKE_SOURCE_DIR}/test-modules/*[^~]) install(FILES ${installTestModuleFiles} DESTINATION ${SHARE_INSTALL_DIR}/ECM/test-modules) file(GLOB installKdeModuleFiles ${CMAKE_SOURCE_DIR}/kde-modules/*[^~]) install(FILES ${installKdeModuleFiles} DESTINATION ${KDE_MODULES_INSTALL_DIR}) file(GLOB installFindModuleFiles ${CMAKE_SOURCE_DIR}/find-modules/*.cmake ${CMAKE_SOURCE_DIR}/find-modules/*.py) install(FILES ${installFindModuleFiles} DESTINATION ${FIND_MODULES_INSTALL_DIR}) file(GLOB installToolchainModuleFiles ${CMAKE_SOURCE_DIR}/toolchain/*[^~]) install(FILES ${installToolchainModuleFiles} DESTINATION ${TOOLCHAIN_MODULES_INSTALL_DIR}) # # Config.cmake file # include(CMakePackageConfigHelpers) configure_package_config_file( ECMConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/ECMConfig.cmake INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} PATH_VARS FIND_MODULES_INSTALL_DIR KDE_MODULES_INSTALL_DIR MODULES_INSTALL_DIR ) write_basic_package_version_file( ${CMAKE_CURRENT_BINARY_DIR}/ECMConfigVersion.cmake VERSION "${PROJECT_VERSION}" COMPATIBILITY AnyNewerVersion ) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/ECMConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/ECMConfigVersion.cmake DESTINATION ${CMAKECONFIG_INSTALL_DIR} ) # # Packaging # set(CPACK_PACKAGE_NAME extra-cmake-modules) set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) set(CPACK_SYSTEM_NAME "generic") set(CPACK_GENERATOR "TGZ") set(CPACK_SET_DESTDIR FALSE) include(CPack) # # Feature summary # feature_summary( FATAL_ON_MISSING_REQUIRED_PACKAGES WHAT ALL ) diff --git a/attic/modules/COPYING-CMAKE-SCRIPTS b/attic/modules/COPYING-CMAKE-SCRIPTS deleted file mode 100644 index 4b41776..0000000 --- a/attic/modules/COPYING-CMAKE-SCRIPTS +++ /dev/null @@ -1,22 +0,0 @@ -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. diff --git a/attic/modules/CheckPointerMember.cmake b/attic/modules/CheckPointerMember.cmake index b6ea544..7f32a90 100644 --- a/attic/modules/CheckPointerMember.cmake +++ b/attic/modules/CheckPointerMember.cmake @@ -1,42 +1,40 @@ # - Check if the given struct or class has the specified member variable # CHECK_POINTER_MEMBER (POINTER MEMBER HEADER VARIABLE) # # POINTER - the name of the struct or class you are interested in # MEMBER - the member which existence you want to check # HEADER - the header(s) where the prototype should be declared # VARIABLE - variable to store the result # # The following variables may be set before calling this macro to # modify the way the check is run: # # CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories -# Copyright (c) 2006, Alexander Neundorf, +# SPDX-FileCopyrightText: 2006 Alexander Neundorf # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - +# SPDX-License-Identifier: BSD-3-Clause INCLUDE(CheckCXXSourceCompiles) MACRO (CHECK_POINTER_MEMBER _STRUCT _MEMBER _HEADER _RESULT) SET(_INCLUDE_FILES) FOREACH (it ${_HEADER}) SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n") ENDFOREACH (it) SET(_CHECK_POINTER_MEMBER_SOURCE_CODE " ${_INCLUDE_FILES} int main() { ${_STRUCT} tmp; tmp->${_MEMBER}; return 0; } ") CHECK_CXX_SOURCE_COMPILES("${_CHECK_POINTER_MEMBER_SOURCE_CODE}" ${_RESULT}) ENDMACRO (CHECK_POINTER_MEMBER) diff --git a/attic/modules/CheckPrototypeExists.cmake b/attic/modules/CheckPrototypeExists.cmake index 811d648..13fd7fc 100644 --- a/attic/modules/CheckPrototypeExists.cmake +++ b/attic/modules/CheckPrototypeExists.cmake @@ -1,41 +1,40 @@ # - Check if the prototype for a function exists. # CHECK_PROTOTYPE_EXISTS (FUNCTION HEADER VARIABLE) # # FUNCTION - the name of the function you are looking for # HEADER - the header(s) where the prototype should be declared # VARIABLE - variable to store the result # # The following variables may be set before calling this macro to # modify the way the check is run: # # CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories -# Copyright (c) 2006, Alexander Neundorf, +# SPDX-FileCopyrightText: 2006 Alexander Neundorf # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-License-Identifier: BSD-3-Clause INCLUDE(CheckCXXSourceCompiles) MACRO (CHECK_PROTOTYPE_EXISTS _SYMBOL _HEADER _RESULT) SET(_INCLUDE_FILES) FOREACH (it ${_HEADER}) SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n") ENDFOREACH (it) SET(_CHECK_PROTO_EXISTS_SOURCE_CODE " ${_INCLUDE_FILES} int main() { #ifndef ${_SYMBOL} int i = sizeof(&${_SYMBOL}); #endif return 0; } ") CHECK_CXX_SOURCE_COMPILES("${_CHECK_PROTO_EXISTS_SOURCE_CODE}" ${_RESULT}) ENDMACRO (CHECK_PROTOTYPE_EXISTS _SYMBOL _HEADER _RESULT) diff --git a/attic/modules/CheckStructMember.cmake b/attic/modules/CheckStructMember.cmake index eeb1b65..813eeaa 100644 --- a/attic/modules/CheckStructMember.cmake +++ b/attic/modules/CheckStructMember.cmake @@ -1,42 +1,41 @@ # - Check if the given struct or class has the specified member variable # CHECK_STRUCT_MEMBER (STRUCT MEMBER HEADER VARIABLE) # # STRUCT - the name of the struct or class you are interested in # MEMBER - the member which existence you want to check # HEADER - the header(s) where the prototype should be declared # VARIABLE - variable to store the result # # The following variables may be set before calling this macro to # modify the way the check is run: # # CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories -# Copyright (c) 2006, Alexander Neundorf, +# SPDX-FileCopyrightText: 2006 Alexander Neundorf # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-License-Identifier: BSD-3-Clause INCLUDE(CheckCXXSourceCompiles) MACRO (CHECK_STRUCT_MEMBER _STRUCT _MEMBER _HEADER _RESULT) SET(_INCLUDE_FILES) FOREACH (it ${_HEADER}) SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n") ENDFOREACH (it) SET(_CHECK_STRUCT_MEMBER_SOURCE_CODE " ${_INCLUDE_FILES} int main() { ${_STRUCT}* tmp; tmp->${_MEMBER}; return 0; } ") CHECK_CXX_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT}) ENDMACRO (CHECK_STRUCT_MEMBER) diff --git a/attic/modules/FindACL.cmake b/attic/modules/FindACL.cmake index 7d3fa14..9263b9f 100644 --- a/attic/modules/FindACL.cmake +++ b/attic/modules/FindACL.cmake @@ -1,36 +1,35 @@ # - Try to find the ACL library # Once done this will define # # ACL_FOUND - system has the ACL library # ACL_LIBS - The libraries needed to use ACL -# Copyright (c) 2006, Pino Toscano, +# SPDX-FileCopyrightText: 2006 Pino Toscano # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-License-Identifier: BSD-3-Clause include(CheckIncludeFiles) check_include_files(attr/libattr.h HAVE_ATTR_LIBATTR_H) check_include_files(sys/xattr.h HAVE_SYS_XATTR_H) check_include_files(sys/acl.h HAVE_SYS_ACL_H) check_include_files(acl/libacl.h HAVE_ACL_LIBACL_H) if (HAVE_ATTR_LIBATTR_H AND HAVE_SYS_XATTR_H AND HAVE_SYS_ACL_H AND HAVE_ACL_LIBACL_H) set(ACL_HEADERS_FOUND TRUE) endif (HAVE_ATTR_LIBATTR_H AND HAVE_SYS_XATTR_H AND HAVE_SYS_ACL_H AND HAVE_ACL_LIBACL_H) if (ACL_HEADERS_FOUND) find_library(ACL_LIBS NAMES acl ) find_library(ATTR_LIBS NAMES attr ) endif (ACL_HEADERS_FOUND) if (ACL_HEADERS_FOUND AND ACL_LIBS AND ATTR_LIBS) set(ACL_FOUND TRUE) set(ACL_LIBS ${ACL_LIBS} ${ATTR_LIBS}) message(STATUS "Found ACL support: ${ACL_LIBS}") endif (ACL_HEADERS_FOUND AND ACL_LIBS AND ATTR_LIBS) mark_as_advanced(ACL_LIBS ATTR_LIBS) diff --git a/attic/modules/FindAGG.cmake b/attic/modules/FindAGG.cmake index 86d5618..b306291 100644 --- a/attic/modules/FindAGG.cmake +++ b/attic/modules/FindAGG.cmake @@ -1,53 +1,52 @@ # - Try to find the AGG graphics library # Once done this will define # # AGG_FOUND - system has AGG # AGG_INCLUDE_DIR - the AGG include directory # AGG_LIBRARIES - Link these to use AGG # AGG_DEFINITIONS - Compiler switches required for using AGG -# Copyright (c) 2006, Alexander Neundorf, +# SPDX-FileCopyrightText: 2006 Alexander Neundorf # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-License-Identifier: BSD-3-Clause if (AGG_INCLUDE_DIR AND AGG_LIBRARIES) # in cache already set(AGG_FOUND TRUE) else (AGG_INCLUDE_DIR AND AGG_LIBRARIES) if (NOT WIN32) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) - pkg_check_modules(PC_AGG QUIET libagg) + pkg_check_modules(PC_AGG QUIET libagg) set(AGG_DEFINITIONS ${PC_AGG_CFLAGS_OTHER}) endif (NOT WIN32) find_path(AGG_INCLUDE_DIR agg2/agg_pixfmt_gray.h PATHS ${PC_AGG_INCLUDEDIR} ${PC_AGG_INCLUDE_DIRS} ) - + find_library(AGG_LIBRARIES NAMES agg PATHS ${PC_AGG_LIBDIR} ${PC_AGG_LIBRARY_DIRS} ) - + if (AGG_INCLUDE_DIR AND AGG_LIBRARIES) set(AGG_FOUND TRUE) endif (AGG_INCLUDE_DIR AND AGG_LIBRARIES) - + if (AGG_FOUND) if (NOT AGG_FIND_QUIETLY) message(STATUS "Found AGG: ${AGG_LIBRARIES}") endif (NOT AGG_FIND_QUIETLY) else (AGG_FOUND) if (AGG_FIND_REQUIRED) message(FATAL_ERROR "Could NOT find AGG") endif (AGG_FIND_REQUIRED) endif (AGG_FOUND) - + mark_as_advanced(AGG_INCLUDE_DIR AGG_LIBRARIES) - + endif (AGG_INCLUDE_DIR AND AGG_LIBRARIES) diff --git a/attic/modules/FindAvahi.cmake b/attic/modules/FindAvahi.cmake index c6e055f..bae2c59 100644 --- a/attic/modules/FindAvahi.cmake +++ b/attic/modules/FindAvahi.cmake @@ -1,15 +1,13 @@ # Find Avahi. Only avahi-common/defs.h is really needed -# Copyright (c) 2007, Jakub Stachowski, +# SPDX-FileCopyrightText: 2007 Jakub Stachowski # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - +# SPDX-License-Identifier: BSD-3-Clause find_path(AVAHI_INCLUDE_DIR avahi-common/defs.h) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Avahi DEFAULT_MSG AVAHI_INCLUDE_DIR) mark_as_advanced(AVAHI_INCLUDE_DIR) diff --git a/attic/modules/FindBerkeleyDB.cmake b/attic/modules/FindBerkeleyDB.cmake index 021d942..d865545 100644 --- a/attic/modules/FindBerkeleyDB.cmake +++ b/attic/modules/FindBerkeleyDB.cmake @@ -1,25 +1,24 @@ # - Try to find Berkeley DB # Once done this will define # # BERKELEY_DB_FOUND - system has Berkeley DB # BERKELEY_DB_INCLUDE_DIR - the Berkeley DB include directory # BERKELEY_DB_LIBRARIES - Link these to use Berkeley DB # BERKELEY_DB_DEFINITIONS - Compiler switches required for using Berkeley DB -# Copyright (c) 2006, Alexander Dymo, +# SPDX-FileCopyrightText: 2006 Alexander Dymo # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-License-Identifier: BSD-3-Clause find_path(BERKELEY_DB_INCLUDE_DIR db.h /usr/include/db4 /usr/local/include/db4 ) find_library(BERKELEY_DB_LIBRARIES NAMES db ) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Berkeley "Could not find Berkeley DB >= 4.1" BERKELEY_DB_INCLUDE_DIR BERKELEY_DB_LIBRARIES) # show the BERKELEY_DB_INCLUDE_DIR and BERKELEY_DB_LIBRARIES variables only in the advanced view mark_as_advanced(BERKELEY_DB_INCLUDE_DIR BERKELEY_DB_LIBRARIES ) diff --git a/attic/modules/FindBlueZ.cmake b/attic/modules/FindBlueZ.cmake index 3cfdc08..34a3e83 100644 --- a/attic/modules/FindBlueZ.cmake +++ b/attic/modules/FindBlueZ.cmake @@ -1,48 +1,46 @@ # - Try to find BlueZ bluetooth library. # Once done this will define # # BLUEZ_FOUND - system has BlueZ # BLUEZ_INCLUDE_DIR - the BlueZ include directory # BLUEZ_LIBRARIES - Link these to use BlueZ # BLUEZ_DEFINITIONS - Compiler switches required for using BlueZ # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. # -# Copyright (c) 2008, Daniel Gollub, +# SPDX-FileCopyrightText: 2008 Daniel Gollub # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - +# SPDX-License-Identifier: BSD-3-Clause # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) pkg_check_modules(PC_BLUEZ QUIET bluez) set(BLUEZ_DEFINITIONS ${PC_BLUEZ_CFLAGS_OTHER}) find_path(BLUEZ_INCLUDE_DIR NAMES bluetooth/bluetooth.h PATHS ${PC_BLUEZ_INCLUDEDIR} ${PC_BLUEZ_INCLUDE_DIRS} /usr/X11/include ) find_library(BLUEZ_LIBRARY NAMES bluetooth PATHS ${PC_BLUEZ_LIBDIR} ${PC_BLUEZ_LIBRARY_DIRS} ) set(BLUEZ_LIBRARIES ${BLUEZ_LIBRARY}) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(BlueZ DEFAULT_MSG BLUEZ_LIBRARY BLUEZ_INCLUDE_DIR) include(FeatureSummary) set_package_properties(BlueZ PROPERTIES URL http://www.bluez.org/ DESCRIPTION "Official Linux Bluetooth protocol stack") # show the BLUEZ_INCLUDE_DIR and BLUEZ_LIBRARY variables only in the advanced view mark_as_advanced(BLUEZ_INCLUDE_DIR BLUEZ_LIBRARY) diff --git a/attic/modules/FindCarbon.cmake b/attic/modules/FindCarbon.cmake index 2b0d979..ea2fe23 100644 --- a/attic/modules/FindCarbon.cmake +++ b/attic/modules/FindCarbon.cmake @@ -1,22 +1,21 @@ # - Find Carbon on Mac # # CARBON_LIBRARY - the library to use Carbon # CARBON_FOUND - true if Carbon has been found -# Copyright (c) 2006, Benjamin Reed, +# SPDX-FileCopyrightText: 2006 Benjamin Reed # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-License-Identifier: BSD-3-Clause include(CMakeFindFrameworks) cmake_find_frameworks(Carbon) if (Carbon_FRAMEWORKS) set(CARBON_LIBRARY "-framework Carbon" CACHE FILEPATH "Carbon framework" FORCE) set(CARBON_FOUND 1) endif (Carbon_FRAMEWORKS) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Carbon DEFAULT_MSG CARBON_LIBRARY) diff --git a/attic/modules/FindDBusMenuQt.cmake b/attic/modules/FindDBusMenuQt.cmake index 10e14dc..109eadd 100644 --- a/attic/modules/FindDBusMenuQt.cmake +++ b/attic/modules/FindDBusMenuQt.cmake @@ -1,94 +1,93 @@ # - Try to find dbusmenu-qt # This module helps finding an installation of the DBusMenuQt library (see https://launchpad.net/libdbusmenu-qt/) # Once done this will define # # DBUSMENUQT_FOUND - system has dbusmenu-qt # DBUSMENUQT_INCLUDE_DIR - the dbusmenu-qt include directory # DBUSMENUQT_LIBRARIES - the libraries needed to use dbusmenu-qt # DBUSMENUQT_DEFINITIONS - Compiler switches required for using dbusmenu-qt # # The minimum required version of DBusMenuQt can be specified using the # standard syntax, e.g. find_package(DBusMenuQt 0.6) # # WARNING: versions below 0.4.0 cannot be checked for. # So if you want to have a version check, require at least 0.4.0 of dbusmenuqt. -# Copyright (c) 2009, Canonical Ltd. -# - Author: Aurélien Gâteau -# # Based on FindQCA2.cmake -# Copyright (c) 2006, Michael Larouche, # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-FileCopyrightText: 2006 Michael Larouche +# SPDX-FileCopyrightText: 2009 Canonical Ltd. +# SPDX-FileContributor: Aurélien Gâteau +# +# SPDX-License-Identifier: BSD-3-Clause include(FindPackageHandleStandardArgs) find_package(PkgConfig) pkg_check_modules(PC_DBUSMENUQT QUIET dbusmenu-qt) set(DBUSMENUQT_DEFINITIONS ${PC_DBUSMENUQT_CFLAGS_OTHER}) find_library(DBUSMENUQT_LIBRARIES NAMES dbusmenu-qt dbusmenu-qtd HINTS ${PC_DBUSMENUQT_LIBDIR} ${PC_DBUSMENUQT_LIBRARY_DIRS} ) find_path(DBUSMENUQT_INCLUDE_DIR dbusmenuexporter.h HINTS ${PC_DBUSMENUQT_INCLUDEDIR} ${PC_DBUSMENUQT_INCLUDE_DIRS} PATH_SUFFIXES dbusmenu-qt ) # dbusmenu_version.h is installed since 0.4.0, fail if a version below this is required: if ((DBusMenuQt_FIND_VERSION) AND ("${DBusMenuQt_FIND_VERSION}" VERSION_LESS "0.4.0")) message(FATAL_ERROR "Cannot check reliably for a DBusMenuQt version below 0.4.0 (${DBusMenuQt_FIND_VERSION} was requested)") endif ((DBusMenuQt_FIND_VERSION) AND ("${DBusMenuQt_FIND_VERSION}" VERSION_LESS "0.4.0")) # find the version number from dbusmenu_version.h and store it in the cache if(DBUSMENUQT_INCLUDE_DIR AND NOT DBUSMENUQT_VERSION) # parse the version number out from dbusmenu_version: if(EXISTS ${DBUSMENUQT_INCLUDE_DIR}/dbusmenu_version.h) file(READ "${DBUSMENUQT_INCLUDE_DIR}/dbusmenu_version.h" DBUSMENUQT_VERSION_CONTENT) if ("${DBUSMENUQT_VERSION_CONTENT}" MATCHES "DBUSMENUQT_VERSION_MAJOR") # introduced after 0.6.4, makes this code here more robust string(REGEX MATCH "#define +DBUSMENUQT_VERSION_MAJOR +([0-9]+)" _dummy "${DBUSMENUQT_VERSION_CONTENT}") set(DBUSMENUQT_VERSION_MAJOR "${CMAKE_MATCH_1}") string(REGEX MATCH "#define +DBUSMENUQT_VERSION_MINOR +([0-9]+)" _dummy "${DBUSMENUQT_VERSION_CONTENT}") set(DBUSMENUQT_VERSION_MINOR "${CMAKE_MATCH_1}") string(REGEX MATCH "#define +DBUSMENUQT_VERSION_PATCH +([0-9]+)" _dummy "${DBUSMENUQT_VERSION_CONTENT}") set(DBUSMENUQT_VERSION_PATCH "${CMAKE_MATCH_1}") else() # In versions up to 0.6.4, the code for setting the version number in the header looked like # shopw below. This made version checking quite un-obvious: # #define DBUSMENUQT_VERSION \ # ((0 << 16) \ # |(6 << 8) \ # |4) string(REGEX MATCH "\\(\\( *([0-9]+) *<<" _dummy "${DBUSMENUQT_VERSION_CONTENT}") set(DBUSMENUQT_VERSION_MAJOR "${CMAKE_MATCH_1}") string(REGEX MATCH "\\|\\( *([0-9]+) *<<" _dummy "${DBUSMENUQT_VERSION_CONTENT}") set(DBUSMENUQT_VERSION_MINOR "${CMAKE_MATCH_1}") string(REGEX MATCH "\\| *([0-9]+) *\\)" _dummy "${DBUSMENUQT_VERSION_CONTENT}") set(DBUSMENUQT_VERSION_PATCH "${CMAKE_MATCH_1}") endif() endif() set(DBUSMENUQT_VERSION "${DBUSMENUQT_VERSION_MAJOR}.${DBUSMENUQT_VERSION_MINOR}.${DBUSMENUQT_VERSION_PATCH}" CACHE STRING "Version number of DBusMenuQt" FORCE) endif() find_package_handle_standard_args(DBusMenuQt REQUIRED_VARS DBUSMENUQT_LIBRARIES DBUSMENUQT_INCLUDE_DIR VERSION_VAR DBUSMENUQT_VERSION) #"Could not find dbusmenu-qt; available at https://launchpad.net/libdbusmenu-qt/" DBUSMENUQT_LIBRARIES DBUSMENUQT_INCLUDE_DIR) mark_as_advanced(DBUSMENUQT_INCLUDE_DIR DBUSMENUQT_LIBRARIES DBUSMENUQT_VERSION) diff --git a/attic/modules/FindDNSSD.cmake b/attic/modules/FindDNSSD.cmake index 8604bd5..50a36ea 100644 --- a/attic/modules/FindDNSSD.cmake +++ b/attic/modules/FindDNSSD.cmake @@ -1,48 +1,47 @@ # - Try to find DNSSD # Once done this will define # # DNSSD_FOUND - system has DNSSD # DNSSD_INCLUDE_DIR - the DNSSD include directory # DNSSD_LIBRARIES - Link these to use dnssd # DNSSD_DEFINITIONS - Compiler switches required for using DNSSD # # need more test: look at into dnssd/configure.in.in -# Copyright (c) 2006, Laurent Montel, +# SPDX-FileCopyrightText: 2006 Laurent Montel # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-License-Identifier: BSD-3-Clause FIND_PATH(DNSSD_INCLUDE_DIR dns_sd.h /usr/include/avahi-compat-libdns_sd/ ) if (DNSSD_INCLUDE_DIR) if (APPLE) set(DNSSD_LIBRARIES "/usr/lib/libSystem.dylib") else (APPLE) FIND_LIBRARY(DNSSD_LIBRARIES NAMES dns_sd ) endif (APPLE) MACRO_PUSH_REQUIRED_VARS() set(CMAKE_REQUIRED_INCLUDES ${DNSSD_INCLUDE_DIR}) set(CMAKE_REQUIRED_LIBRARIES ${DNSSD_LIBRARIES}) CHECK_FUNCTION_EXISTS(DNSServiceRefDeallocate DNSSD_FUNCTION_FOUND) MACRO_POP_REQUIRED_VARS() if (DNSSD_INCLUDE_DIR AND DNSSD_LIBRARIES AND DNSSD_FUNCTION_FOUND) set(DNSSD_FOUND TRUE) endif (DNSSD_INCLUDE_DIR AND DNSSD_LIBRARIES AND DNSSD_FUNCTION_FOUND) endif (DNSSD_INCLUDE_DIR) if (DNSSD_FOUND) if (NOT DNSSD_FIND_QUIETLY) message(STATUS "Found DNSSD: ${DNSSD_LIBRARIES}") endif (NOT DNSSD_FIND_QUIETLY) else (DNSSD_FOUND) if (DNSSD_FIND_REQUIRED) message(FATAL_ERROR "Could NOT find DNSSD") endif (DNSSD_FIND_REQUIRED) endif (DNSSD_FOUND) MARK_AS_ADVANCED(DNSSD_INCLUDE_DIR DNSSD_LIBRARIES) diff --git a/attic/modules/FindENCHANT.cmake b/attic/modules/FindENCHANT.cmake index 9c13c48..161f1ce 100644 --- a/attic/modules/FindENCHANT.cmake +++ b/attic/modules/FindENCHANT.cmake @@ -1,44 +1,42 @@ # - Try to find the Enchant spell checker # Once done this will define # # ENCHANT_FOUND - system has ENCHANT # ENCHANT_INCLUDE_DIR - the ENCHANT include directory # ENCHANT_LIBRARIES - Link these to use ENCHANT # ENCHANT_DEFINITIONS - Compiler switches required for using ENCHANT -# Copyright (c) 2006, Zack Rusin, +# SPDX-FileCopyrightText: 2006 Zack Rusin # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - +# SPDX-License-Identifier: BSD-3-Clause if (ENCHANT_INCLUDE_DIR AND ENCHANT_LIBRARIES) # in cache already set(ENCHANT_FOUND TRUE) else (ENCHANT_INCLUDE_DIR AND ENCHANT_LIBRARIES) if (NOT WIN32) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) pkg_check_modules(PC_ENCHANT QUIET enchant) set(ENCHANT_DEFINITIONS ${PC_ENCHANT_CFLAGS_OTHER}) endif (NOT WIN32) - find_path(ENCHANT_INCLUDE_DIR + find_path(ENCHANT_INCLUDE_DIR NAMES enchant++.h HINTS ${PC_ENCHANT_INCLUDEDIR} ${PC_ENCHANT_INCLUDE_DIRS} PATH_SUFFIXES enchant ) find_library(ENCHANT_LIBRARIES NAMES enchant HINTS ${PC_ENCHANT_LIBDIR} ${PC_ENCHANT_LIBRARY_DIRS} ) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(ENCHANT DEFAULT_MSG ENCHANT_INCLUDE_DIR ENCHANT_LIBRARIES ) mark_as_advanced(ENCHANT_INCLUDE_DIR ENCHANT_LIBRARIES) endif (ENCHANT_INCLUDE_DIR AND ENCHANT_LIBRARIES) diff --git a/attic/modules/FindFAM.cmake b/attic/modules/FindFAM.cmake index 7a598fd..a1541ab 100644 --- a/attic/modules/FindFAM.cmake +++ b/attic/modules/FindFAM.cmake @@ -1,22 +1,20 @@ # - Try to find the FAM directory notification library # Once done this will define # # FAM_FOUND - system has FAM # FAM_INCLUDE_DIR - the FAM include directory # FAM_LIBRARIES - The libraries needed to use FAM -# Copyright (c) 2006, Alexander Neundorf, +# SPDX-FileCopyrightText: 2006 Alexander Neundorf # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - +# SPDX-License-Identifier: BSD-3-Clause FIND_PATH(FAM_INCLUDE_DIR fam.h) FIND_LIBRARY(FAM_LIBRARIES NAMES fam ) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(FAM DEFAULT_MSG FAM_INCLUDE_DIR FAM_LIBRARIES ) MARK_AS_ADVANCED(FAM_INCLUDE_DIR FAM_LIBRARIES) diff --git a/attic/modules/FindFFmpeg.cmake b/attic/modules/FindFFmpeg.cmake index d6259b0..522ad36 100644 --- a/attic/modules/FindFFmpeg.cmake +++ b/attic/modules/FindFFmpeg.cmake @@ -1,116 +1,114 @@ # - Try to find ffmpeg # Once done this will define # # FFMPEG_FOUND - system has ffmpeg # FFMPEG_INCLUDE_DIR - Include directory necessary for using the ffmpeg headers # FFMPEG_LIBRARIES - Link these to use ffmpeg # FFMPEG_DEFINITIONS - Compiler switches required for using ffmpeg -# Copyright (c) 2006, Matthias Kretz, -# Copyright (c) 2008, Alexander Neundorf, +# SPDX-FileCopyrightText: 2006 Matthias Kretz +# SPDX-FileCopyrightText: 2008 Alexander Neundorf # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - +# SPDX-License-Identifier: BSD-3-Clause if (FFMPEG_LIBRARIES) # in cache already set(FFMPEG_FOUND TRUE) else (FFMPEG_LIBRARIES) if (NOT WIN32) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) pkg_check_modules(PC_LIBAVCODEC libavcodec) set(FFMPEG_DEFINITIONS ${PC_LIBAVCODEC_CFLAGS_OTHER}) endif (NOT WIN32) # # #include is the new style for FFMPEG headers # This has been verified at least since 0.4.9 # Please do not change to the old format, since this will break for # people who are using newer versions. Instead, upgrade your ffmpeg # installation. # find_path(FFMPEG_INCLUDE_DIR libavcodec/avcodec.h HINTS ${PC_LIBAVCODEC_INCLUDEDIR} ${PC_LIBAVCODEC_INCLUDE_DIRS} ) # also search for the old style include dir, just for the purpose # of giving a useful error message if an old libavcodec is installed # and the user might wonder why it is not found find_path(FFMPEG_INCLUDE_DIR_OLD_STYLE ffmpeg/avcodec.h HINTS ${PC_LIBAVCODEC_INCLUDEDIR} ${PC_LIBAVCODEC_INCLUDE_DIRS} ) find_library(AVCODEC_LIBRARIES NAMES avcodec HINTS ${PC_LIBAVCODEC_LIBDIR} ${PC_LIBAVCODEC_LIBRARY_DIRS} ) find_library(AVFORMAT_LIBRARIES NAMES avformat HINTS ${PC_LIBAVCODEC_LIBDIR} ${PC_LIBAVCODEC_LIBRARY_DIRS} ) find_library(AVUTIL_LIBRARIES NAMES avutil HINTS ${PC_LIBAVCODEC_LIBDIR} ${PC_LIBAVCODEC_LIBRARY_DIRS} ) set(FFMPEG_LIBRARIES ) if (AVCODEC_LIBRARIES) set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${AVCODEC_LIBRARIES}) endif (AVCODEC_LIBRARIES) if (AVFORMAT_LIBRARIES) set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${AVFORMAT_LIBRARIES}) endif (AVFORMAT_LIBRARIES) if (AVUTIL_LIBRARIES) set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${AVUTIL_LIBRARIES}) endif (AVUTIL_LIBRARIES) if (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR) set(FFMPEG_FOUND TRUE) endif (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR) if (FFMPEG_FOUND) if (NOT FFmpeg_FIND_QUIETLY) message(STATUS "Found FFMPEG: ${FFMPEG_LIBRARIES} ${FFMPEG_INCLUDE_DIR}") endif (NOT FFmpeg_FIND_QUIETLY) else (FFMPEG_FOUND) # only an old libavcodec was found ? if (FFMPEG_INCLUDE_DIR_OLD_STYLE AND NOT FFMPEG_INCLUDE_DIR AND NOT FFmpeg_FIND_QUIETLY) message(STATUS "Found old version of libavcodec, but a newer version is required.") endif (FFMPEG_INCLUDE_DIR_OLD_STYLE AND NOT FFMPEG_INCLUDE_DIR AND NOT FFmpeg_FIND_QUIETLY) if (FFmpeg_FIND_REQUIRED) message(FATAL_ERROR "Could NOT find FFMPEG") else (FFmpeg_FIND_REQUIRED) if (NOT FFmpeg_FIND_QUIETLY) message(STATUS "Could NOT find FFMPEG") endif (NOT FFmpeg_FIND_QUIETLY) endif (FFmpeg_FIND_REQUIRED) endif (FFMPEG_FOUND) - mark_as_advanced(AVCODEC_LIBRARIES + mark_as_advanced(AVCODEC_LIBRARIES AVFORMAT_LIBRARIES AVUTIL_LIBRARIES FFMPEG_INCLUDE_DIR FFMPEG_INCLUDE_DIR_OLD_STYLE) endif (FFMPEG_LIBRARIES)# AND FFMPEG_DEFINITIONS) diff --git a/attic/modules/FindFlac.cmake b/attic/modules/FindFlac.cmake index 208e3fc..b043b30 100644 --- a/attic/modules/FindFlac.cmake +++ b/attic/modules/FindFlac.cmake @@ -1,34 +1,33 @@ # - Try to find Flac, the Free Lossless Audio Codec # Once done this will define # # FLAC_FOUND - system has Flac # FLAC_INCLUDE_DIR - the Flac include directory # FLAC_LIBRARIES - Link these to use Flac # FLAC_OGGFLAC_LIBRARIES - Link these to use OggFlac # # No version checking is done - use FLAC_API_VERSION_CURRENT to # conditionally compile version-dependent code -# Copyright (c) 2006, Laurent Montel, -# Copyright (c) 2006, Alexander Neundorf, +# SPDX-FileCopyrightText: 2006 Laurent Montel +# SPDX-FileCopyrightText: 2006 Alexander Neundorf # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-License-Identifier: BSD-3-Clause FIND_PATH(FLAC_INCLUDE_DIR FLAC/metadata.h) FIND_LIBRARY(FLAC_LIBRARIES NAMES FLAC ) FIND_LIBRARY(FLAC_OGG_LIBRARY NAMES OggFLAC) IF(FLAC_LIBRARIES AND FLAC_OGG_LIBRARY) SET(FLAC_OGGFLAC_LIBRARIES ${FLAC_OGG_LIBRARY} ${FLAC_LIBRARIES}) ENDIF(FLAC_LIBRARIES AND FLAC_OGG_LIBRARY) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Flac REQUIRED_VARS FLAC_LIBRARIES FLAC_INCLUDE_DIR) # show the FLAC_INCLUDE_DIR and FLAC_LIBRARIES variables only in the advanced view MARK_AS_ADVANCED(FLAC_INCLUDE_DIR FLAC_LIBRARIES FLAC_OGG_LIBRARY) diff --git a/attic/modules/FindGMP.cmake b/attic/modules/FindGMP.cmake index 17d175c..bef4c61 100644 --- a/attic/modules/FindGMP.cmake +++ b/attic/modules/FindGMP.cmake @@ -1,23 +1,21 @@ # Try to find the GMP librairies # GMP_FOUND - system has GMP lib # GMP_INCLUDE_DIR - the GMP include directory # GMP_LIBRARIES - Libraries needed to use GMP -# Copyright (c) 2006, Laurent Montel, +# SPDX-FileCopyrightText: 2006 Laurent Montel # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - +# SPDX-License-Identifier: BSD-3-Clause if (GMP_INCLUDE_DIR AND GMP_LIBRARIES) # Already in cache, be silent set(GMP_FIND_QUIETLY TRUE) endif (GMP_INCLUDE_DIR AND GMP_LIBRARIES) find_path(GMP_INCLUDE_DIR NAMES gmp.h ) find_library(GMP_LIBRARIES NAMES gmp libgmp) include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMP DEFAULT_MSG GMP_INCLUDE_DIR GMP_LIBRARIES) mark_as_advanced(GMP_INCLUDE_DIR GMP_LIBRARIES) diff --git a/attic/modules/FindGObject.cmake b/attic/modules/FindGObject.cmake index af0c9f7..0b82a34 100644 --- a/attic/modules/FindGObject.cmake +++ b/attic/modules/FindGObject.cmake @@ -1,52 +1,51 @@ # - Try to find GObject # Once done this will define # # GOBJECT_FOUND - system has GObject # GOBJECT_INCLUDE_DIR - the GObject include directory # GOBJECT_LIBRARIES - the libraries needed to use GObject # GOBJECT_DEFINITIONS - Compiler switches required for using GObject -# Copyright (c) 2011, Raphael Kubo da Costa -# Copyright (c) 2006, Tim Beaulen +# SPDX-FileCopyrightText: 2011 Raphael Kubo da Costa +# SPDX-FileCopyrightText: 2006 Tim Beaulen # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-License-Identifier: BSD-3-Clause FIND_PACKAGE(PkgConfig) PKG_CHECK_MODULES(PC_GOBJECT gobject-2.0) SET(GOBJECT_DEFINITIONS ${PC_GOBJECT_CFLAGS_OTHER}) FIND_PATH(GOBJECT_INCLUDE_DIR gobject.h HINTS ${PC_GOBJECT_INCLUDEDIR} ${PC_GOBJECT_INCLUDE_DIRS} PATH_SUFFIXES glib-2.0/gobject/ ) FIND_LIBRARY(_GObjectLibs NAMES gobject-2.0 HINTS ${PC_GOBJECT_LIBDIR} ${PC_GOBJECT_LIBRARY_DIRS} ) FIND_LIBRARY(_GModuleLibs NAMES gmodule-2.0 HINTS ${PC_GOBJECT_LIBDIR} ${PC_GOBJECT_LIBRARY_DIRS} ) FIND_LIBRARY(_GThreadLibs NAMES gthread-2.0 HINTS ${PC_GOBJECT_LIBDIR} ${PC_GOBJECT_LIBRARY_DIRS} ) FIND_LIBRARY(_GLibs NAMES glib-2.0 HINTS ${PC_GOBJECT_LIBDIR} ${PC_GOBJECT_LIBRARY_DIRS} ) SET( GOBJECT_LIBRARIES ${_GObjectLibs} ${_GModuleLibs} ${_GThreadLibs} ${_GLibs} ) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(GOBJECT DEFAULT_MSG GOBJECT_LIBRARIES GOBJECT_INCLUDE_DIR) MARK_AS_ADVANCED(GOBJECT_INCLUDE_DIR _GObjectLibs _GModuleLibs _GThreadLibs _GLibs) diff --git a/attic/modules/FindGSSAPI.cmake b/attic/modules/FindGSSAPI.cmake index 942cf55..0fc0222 100644 --- a/attic/modules/FindGSSAPI.cmake +++ b/attic/modules/FindGSSAPI.cmake @@ -1,78 +1,76 @@ # - Try to detect the GSSAPI support # Once done this will define # # GSSAPI_FOUND - system supports GSSAPI # GSSAPI_INCS - the GSSAPI include directory # GSSAPI_LIBS - the libraries needed to use GSSAPI # GSSAPI_FLAVOR - the type of API - MIT or HEIMDAL -# Copyright (c) 2006, Pino Toscano, +# SPDX-FileCopyrightText: 2006 Pino Toscano # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - +# SPDX-License-Identifier: BSD-3-Clause if(GSSAPI_LIBS AND GSSAPI_FLAVOR) # in cache already set(GSSAPI_FOUND TRUE) else() find_program(KRB5_CONFIG NAMES krb5-config PATHS /opt/local/bin ONLY_CMAKE_FIND_ROOT_PATH # this is required when cross compiling with cmake 2.6 and ignored with cmake 2.4, Alex ) mark_as_advanced(KRB5_CONFIG) - + #reset vars set(GSSAPI_INCS) set(GSSAPI_LIBS) set(GSSAPI_FLAVOR) - + if(KRB5_CONFIG) - + set(HAVE_KRB5_GSSAPI TRUE) exec_program(${KRB5_CONFIG} ARGS --libs gssapi RETURN_VALUE _return_VALUE OUTPUT_VARIABLE GSSAPI_LIBS) if(_return_VALUE) message(STATUS "GSSAPI configure check failed.") set(HAVE_KRB5_GSSAPI FALSE) endif() - + exec_program(${KRB5_CONFIG} ARGS --cflags gssapi RETURN_VALUE _return_VALUE OUTPUT_VARIABLE GSSAPI_INCS) string(REGEX REPLACE "(\r?\n)+$" "" GSSAPI_INCS "${GSSAPI_INCS}") string(REGEX REPLACE " *-I" ";" GSSAPI_INCS "${GSSAPI_INCS}") exec_program(${KRB5_CONFIG} ARGS --vendor RETURN_VALUE _return_VALUE OUTPUT_VARIABLE gssapi_flavor_tmp) set(GSSAPI_FLAVOR_MIT) if(gssapi_flavor_tmp MATCHES ".*Massachusetts.*") set(GSSAPI_FLAVOR "MIT") else() set(GSSAPI_FLAVOR "HEIMDAL") endif() - + if(NOT HAVE_KRB5_GSSAPI) if (gssapi_flavor_tmp MATCHES "Sun Microsystems.*") message(STATUS "Solaris Kerberos does not have GSSAPI; this is normal.") set(GSSAPI_LIBS) set(GSSAPI_INCS) else() message(WARNING "${KRB5_CONFIG} failed unexpectedly.") endif() endif() if(GSSAPI_LIBS) # GSSAPI_INCS can be also empty, so don't rely on that set(GSSAPI_FOUND TRUE) message(STATUS "Found GSSAPI: ${GSSAPI_LIBS}") set(GSSAPI_INCS ${GSSAPI_INCS}) set(GSSAPI_LIBS ${GSSAPI_LIBS}) set(GSSAPI_FLAVOR ${GSSAPI_FLAVOR}) mark_as_advanced(GSSAPI_INCS GSSAPI_LIBS GSSAPI_FLAVOR) endif() - + endif() endif() diff --git a/attic/modules/FindGphoto2.cmake b/attic/modules/FindGphoto2.cmake index 7143611..a0628ad 100644 --- a/attic/modules/FindGphoto2.cmake +++ b/attic/modules/FindGphoto2.cmake @@ -1,60 +1,58 @@ # cmake macro to test if we use gphoto2 # GPHOTO2_FOUND - system has the GPHOTO2 library # GPHOTO2_INCLUDE_DIR - the GPHOTO2 include directory # GPHOTO2_LIBRARIES - The libraries needed to use GPHOTO2 -# Copyright (c) 2006, 2007 Laurent Montel, +# SPDX-FileCopyrightText: 2006, 2007 Laurent Montel # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - +# SPDX-License-Identifier: BSD-3-Clause option(KDE4_GPHOTO2 "do not build kamera (gphoto2 required)" ON) if (KDE4_GPHOTO2 ) IF (GPHOTO2_LIBRARIES AND GPHOTO2_INCLUDE_DIR) # in cache already SET(GPHOTO2_FOUND TRUE) ELSE (GPHOTO2_LIBRARIES AND GPHOTO2_INCLUDE_DIR) - - FIND_PROGRAM(GHOTO2CONFIG_EXECUTABLE NAMES gphoto2-config + + FIND_PROGRAM(GHOTO2CONFIG_EXECUTABLE NAMES gphoto2-config ) FIND_PROGRAM(GHOTO2PORTCONFIG_EXECUTABLE NAMES gphoto2-port-config ) set(GPHOTO2_LIBRARIES) set(GPHOTO2_INCLUDE_DIRS) # if gphoto2-port-config and gphoto2-config have been found IF (GHOTO2PORTCONFIG_EXECUTABLE AND GHOTO2CONFIG_EXECUTABLE) EXEC_PROGRAM(${GHOTO2PORTCONFIG_EXECUTABLE} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE GPHOTO2PORT_LIBRARY) EXEC_PROGRAM(${GHOTO2CONFIG_EXECUTABLE} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE GPHOTO2_LIBRARY) - + EXEC_PROGRAM(${GHOTO2PORTCONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _GPHOTO2PORT_RESULT_INCLUDE_DIR) EXEC_PROGRAM(${GHOTO2CONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _GPHOTO2_RESULT_INCLUDE_DIR) set(GPHOTO2_LIBRARIES ${GPHOTO2PORT_LIBRARY} ${GPHOTO2_LIBRARY}) # the cflags for poppler-qt4 can contain more than one include path separate_arguments(_GPHOTO2_RESULT_INCLUDE_DIR) foreach(_includedir ${_GPHOTO2_RESULT_INCLUDE_DIR}) string(REGEX REPLACE "-I(.+)" "\\1" _includedir "${_includedir}") set(GPHOTO2_INCLUDE_DIR ${GPHOTO2_INCLUDE_DIR} ${_includedir}) endforeach(_includedir) separate_arguments(_GPHOTO2PORT_RESULT_INCLUDE_DIR) foreach(_includedir ${_GPHOTO2PORT_RESULT_INCLUDE_DIR}) string(REGEX REPLACE "-I(.+)" "\\1" _includedir "${_includedir}") set(GPHOTO2PORT_INCLUDE_DIR ${GPHOTO2PORT_INCLUDE_DIR} ${_includedir}) endforeach(_includedir) - + set(GPHOTO2_INCLUDE_DIRS ${GPHOTO2PORT_INCLUDE_DIR} ${GPHOTO2_INCLUDE_DIR} ) endif() IF (GPHOTO2_LIBRARIES AND GPHOTO2_INCLUDE_DIRS) SET(GPHOTO2_FOUND TRUE) message(STATUS "Found gphoto2: ${GPHOTO2_LIBRARIES}") ENDIF (GPHOTO2_LIBRARIES AND GPHOTO2_INCLUDE_DIRS) ENDIF (GPHOTO2_LIBRARIES AND GPHOTO2_INCLUDE_DIR) MARK_AS_ADVANCED(GPHOTO2_LIBRARIES GPHOTO2_INCLUDE_DIRS) endif() diff --git a/attic/modules/FindHUpnp.cmake b/attic/modules/FindHUpnp.cmake index 85c8030..8566828 100644 --- a/attic/modules/FindHUpnp.cmake +++ b/attic/modules/FindHUpnp.cmake @@ -1,31 +1,31 @@ # - Try to find HUPnP library # Once done this will define # # HUPNP_FOUND - system has HUPnP # HUPNP_INCLUDE_DIR - the LIBHUpnp include directory # HUPNP_LIBS - the LIBHUpnp libraries # HUPNP_VERSION_STRING - The version of HUpnp # HUPNP_VERSION_MAJOR - The major version of HUpnp # HUPNP_VERSION_MINOR - The minor version of HUpnp # HUPNP_VERSION_PATCH - The patch version of HUpnp # -# Copyright (c) 2010, Paulo Romulo Alves Barros +# SPDX-FileCopyrightText: 2010 Paulo Romulo Alves Barros find_path( HUPNP_INCLUDE_DIR HUpnpCore/HUpnp ) find_library( HUPNP_LIBS HUpnp ) if( HUPNP_INCLUDE_DIR AND EXISTS "${HUPNP_INCLUDE_DIR}/HUpnpCore/public/hupnpinfo.h" ) file( STRINGS "${HUPNP_INCLUDE_DIR}/HUpnpCore/public/hupnpinfo.h" HUPNP_INFO_H REGEX "^#define HUPNP_CORE_.*_VERSION .*$" ) string( REGEX REPLACE ".*HUPNP_CORE_MAJOR_VERSION ([0-9]+).*" "\\1" HUPNP_VERSION_MAJOR "${HUPNP_INFO_H}" ) string( REGEX REPLACE ".*HUPNP_CORE_MINOR_VERSION ([0-9]+).*" "\\1" HUPNP_VERSION_MINOR "${HUPNP_INFO_H}" ) string( REGEX REPLACE ".*HUPNP_CORE_PATCH_VERSION ([0-9]+).*" "\\1" HUPNP_VERSION_PATCH "${HUPNP_INFO_H}" ) set( HUPNP_VERSION_STRING "${HUPNP_VERSION_MAJOR}.${HUPNP_VERSION_MINOR}.${HUPNP_VERSION_PATCH}" ) endif() include( FindPackageHandleStandardArgs ) find_package_handle_standard_args( HUpnp DEFAULT_MSG HUPNP_INCLUDE_DIR HUPNP_LIBS ) mark_as_advanced( HUPNP_INCLUDE_DIR HUPNP_LIBS ) diff --git a/attic/modules/FindIOKit.cmake b/attic/modules/FindIOKit.cmake index f3e3ecb..54482c6 100644 --- a/attic/modules/FindIOKit.cmake +++ b/attic/modules/FindIOKit.cmake @@ -1,23 +1,22 @@ # - Find IOKit on Mac # # IOKIT_LIBRARY - the library to use IOKit # IOKIT_FOUND - true if IOKit has been found -# Copyright (c) 2009, Harald Fernengel +# SPDX-FileCopyrightText: 2009 Harald Fernengel # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-License-Identifier: BSD-3-Clause include(CMakeFindFrameworks) cmake_find_frameworks(IOKit) cmake_find_frameworks(CoreFoundation) if (IOKit_FRAMEWORKS) set(IOKIT_LIBRARY "-framework IOKit -framework CoreFoundation" CACHE FILEPATH "IOKit framework" FORCE) set(IOKIT_FOUND 1) endif (IOKit_FRAMEWORKS) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(IOKit DEFAULT_MSG IOKIT_LIBRARY) diff --git a/attic/modules/FindKDEWIN32.cmake b/attic/modules/FindKDEWIN32.cmake index 1f78055..b157c7b 100644 --- a/attic/modules/FindKDEWIN32.cmake +++ b/attic/modules/FindKDEWIN32.cmake @@ -1,26 +1,24 @@ # - Try to find the KDEWIN32 library -# - Try to find the KDEWIN32 library - deprecated -# +# - Try to find the KDEWIN32 library - deprecated +# # Once done this will define # # KDEWIN32_FOUND - system has KDEWIN32 # KDEWIN32_INCLUDES - the KDEWIN32 include directories # KDEWIN32_LIBRARIES - The libraries needed to use KDEWIN32 -# Copyright (c) 2006, Alexander Neundorf, -# Copyright (c) 2007-2009, Ralf Habacker, +# SPDX-FileCopyrightText: 2006 Alexander Neundorf +# SPDX-FileCopyrightText: 2007-2009 Ralf Habacker # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - +# SPDX-License-Identifier: BSD-3-Clause if (WIN32) message(STATUS "The kdewin32 cmake module is deprecated, use kdewin instead") find_package(KDEWIN) if (KDEWIN_FOUND) set(KDEWIN32_FOUND ${KDEWIN_FOUND}) set(KDEWIN32_INCLUDES ${KDEWIN_INCLUDES}) set(KDEWIN32_LIBRARIES ${KDEWIN_LIBRARIES}) endif (KDEWIN_FOUND) endif (WIN32) diff --git a/attic/modules/FindKDEWIN_Packager.cmake b/attic/modules/FindKDEWIN_Packager.cmake index 6a8af57..9d37199 100644 --- a/attic/modules/FindKDEWIN_Packager.cmake +++ b/attic/modules/FindKDEWIN_Packager.cmake @@ -1,171 +1,170 @@ # # KDEWIN packager http://www.winkde.org/pub/kde/ports/win32/installer -# -# The kdewin packager is searched in the following pathes and order -# +# +# The kdewin packager is searched in the following pathes and order +# # path specified by the environment dir KDEWIN_PACKAGER_DIR -# /kdewin-packager +# /kdewin-packager # /kdewin-installer # -# The macro KDEWIN_PACKAGER provides package building support and should be +# The macro KDEWIN_PACKAGER provides package building support and should be # added to the top level CMakeLists.txt as shown below -# +# # if (KDEWIN_PACKAGER_FOUND) # KDEWIN_PACKAGER( # "projectname" # "version" -# "description" +# "description" # "additional options" # ) # endif (KDEWIN_PACKAGER_FOUND) -# The macro KDEWIN_PACKAGER adds three additional makefile targets, which could be -# called using the regular make tool -# -# kdewin_package -# - build kdewin package with currently used compiler and build type -# kdewin_package_debug_and_release +# The macro KDEWIN_PACKAGER adds three additional makefile targets, which could be +# called using the regular make tool +# +# kdewin_package +# - build kdewin package with currently used compiler and build type +# kdewin_package_debug_and_release # - build kdewin debug and release package with currently used compiler # kdewin_package_debug_and_release_mingw_and_msvc # - build kdewin debug and release package with mingw and msvc compiler # # # -# Copyright (c) 2006-2007, Ralf Habacker -# -# Redistribution and use is allowed according to the terms of the BSD license. +# SPDX-FileCopyrightText: 2006-2007 Ralf Habacker # +# SPDX-License-Identifier: BSD-3-Clause if (WIN32) if(NOT KDEWIN_PACKAGER_DIR) # check for environment variable file(TO_CMAKE_PATH "$ENV{KDEWIN_PACKAGER_DIR}" KDEWIN_PACKAGER_DIR) if(NOT KDEWIN_PACKAGER_DIR) # search in the default program install folder file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _progFiles) find_file(KDEWIN_PACKAGER_DIR_tmp kdewin-packager kdewin-installer PATHS "${_progFiles}" ) set(KDEWIN_PACKAGER_DIR ${KDEWIN_PACKAGER_DIR_tmp}) endif() endif() if (KDEWIN_PACKAGER_DIR) - + find_program(KDEWIN_PACKAGER_EXECUTABLE kdewin-packager PATHS ${KDEWIN_PACKAGER_DIR}/bin ${CMAKE_INSTALL_PREFIX}/bin ) - + set(KDEWIN_PACKAGER_FOUND TRUE) else (KDEWIN_PACKAGER_DIR) set(KDEWIN_PACKAGER_FOUND) endif (KDEWIN_PACKAGER_DIR) - + if (KDEWIN_PACKAGER_FOUND) if (NOT KDEWIN_Packager_FIND_QUIETLY) message(STATUS "Found KDEWIN Packager: ${KDEWIN_PACKAGER_DIR}") endif (NOT KDEWIN_Packager_FIND_QUIETLY) else (KDEWIN_PACKAGER_FOUND) if (KDEWIN_Packager_FIND_REQUIRED) message(FATAL_ERROR "Could NOT find KDEWIN PAckager") endif (KDEWIN_Packager_FIND_REQUIRED) endif (KDEWIN_PACKAGER_FOUND) endif (WIN32) MACRO (KDEWIN_PACKAGER _name _version _notes _options) if (KDEWIN_PACKAGER_FOUND) if (MSVC) set (type "msvc") else (MSVC) set (type "mingw") endif (MSVC) - + add_custom_target(kdewin_package - COMMAND ${CMAKE_COMMAND} - -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/temp -P ${CMAKE_BINARY_DIR}/cmake_install.cmake - COMMAND ${KDEWIN_PACKAGER_EXECUTABLE} + COMMAND ${CMAKE_COMMAND} + -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/temp -P ${CMAKE_BINARY_DIR}/cmake_install.cmake + COMMAND ${KDEWIN_PACKAGER_EXECUTABLE} -name ${_name} -root ${CMAKE_BINARY_DIR}/temp -srcroot ${CMAKE_SOURCE_DIR} - -version ${_version} + -version ${_version} -notes "${_notes}" -type ${type} - ${_options} - # FIXME: cleanup does not work + ${_options} + # FIXME: cleanup does not work #COMMAND rmdir /Q /S ${CMAKE_BINARY_DIR}\temp ) # prelimary target add_custom_target(kdewin_package_without_compiler - COMMAND ${CMAKE_COMMAND} - -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/temp -P ${CMAKE_BINARY_DIR}/cmake_install.cmake - COMMAND ${KDEWIN_PACKAGER_EXECUTABLE} + COMMAND ${CMAKE_COMMAND} + -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/temp -P ${CMAKE_BINARY_DIR}/cmake_install.cmake + COMMAND ${KDEWIN_PACKAGER_EXECUTABLE} -name ${_name} -root ${CMAKE_BINARY_DIR}/temp -srcroot ${CMAKE_SOURCE_DIR} - -version ${_version} + -version ${_version} -notes "${_notes}" - ${_options} - # FIXME: cleanup does not work + ${_options} + # FIXME: cleanup does not work #COMMAND rmdir /Q /S ${CMAKE_BINARY_DIR}\temp ) add_custom_target(kdewin_package_debug_and_release - COMMAND ${CMAKE_COMMAND} - -H$(CMAKE_SOURCE_DIR) + COMMAND ${CMAKE_COMMAND} + -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) -DCMAKE_BUILD_TYPE=Debug - COMMAND ${CMAKE_MAKE_PROGRAM} + COMMAND ${CMAKE_MAKE_PROGRAM} clean - COMMAND ${CMAKE_MAKE_PROGRAM} + COMMAND ${CMAKE_MAKE_PROGRAM} install/local - COMMAND ${CMAKE_COMMAND} - -H$(CMAKE_SOURCE_DIR) + COMMAND ${CMAKE_COMMAND} + -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) -DCMAKE_BUILD_TYPE=Release - COMMAND ${CMAKE_MAKE_PROGRAM} + COMMAND ${CMAKE_MAKE_PROGRAM} clean - COMMAND ${CMAKE_MAKE_PROGRAM} + COMMAND ${CMAKE_MAKE_PROGRAM} install/local - COMMAND ${KDEWIN_PACKAGER_EXECUTABLE} + COMMAND ${KDEWIN_PACKAGER_EXECUTABLE} -name ${_name} -root ${CMAKE_BINARY_DIR}/temp -srcroot ${CMAKE_SOURCE_DIR} - -version ${_version} + -version ${_version} -notes "${_notes}" -type ${type} - ${_options} - # FIXME: cleanup does not work + ${_options} + # FIXME: cleanup does not work #COMMAND rmdir /Q /S ${CMAKE_BINARY_DIR}\temp ) set (CONTENT " if \"%1\" == \"package_only\" goto package_only del CMakeCache.txt -rmdir /Q /S ${CMAKE_BINARY_DIR}/temp +rmdir /Q /S ${CMAKE_BINARY_DIR}/temp ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR} -G \"MinGW Makefiles\" -DCMAKE_BUILD_TYPE=Debug mingw32-make ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/temp -P cmake_install.cmake ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR} -G \"MinGW Makefiles\" -DCMAKE_BUILD_TYPE=Release mingw32-make ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/temp -P cmake_install.cmake del CMakeCache.txt ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR} -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Debug nmake ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/temp -P cmake_install.cmake ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR} -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Release nmake ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/temp -P cmake_install.cmake :package_only -${KDEWIN_PACKAGER_EXECUTABLE} -name ${_name} -root ${CMAKE_BINARY_DIR}/temp -srcroot ${CMAKE_SOURCE_DIR} -version ${_version} -notes \"${_notes}\" ${_options} +${KDEWIN_PACKAGER_EXECUTABLE} -name ${_name} -root ${CMAKE_BINARY_DIR}/temp -srcroot ${CMAKE_SOURCE_DIR} -version ${_version} -notes \"${_notes}\" ${_options} " ) write_file(${CMAKE_BINARY_DIR}/kdewin_package_debug_and_release_mingw_and_msvc.bat "${CONTENT}") add_custom_target(kdewin_package_debug_and_release_mingw_and_msvc COMMAND ${CMAKE_BINARY_DIR}/kdewin_package_debug_and_release_mingw_and_msvc.bat ) endif (KDEWIN_PACKAGER_FOUND) ENDMACRO (KDEWIN_PACKAGER) diff --git a/attic/modules/FindKDEWin.cmake b/attic/modules/FindKDEWin.cmake index 8f69073..1cda59f 100644 --- a/attic/modules/FindKDEWin.cmake +++ b/attic/modules/FindKDEWin.cmake @@ -1,89 +1,87 @@ # - Try to find the KDEWIN library -# +# # Once done this will define # # KDEWIN_FOUND - system has KDEWIN # KDEWIN_INCLUDES - the KDEWIN include directories # KDEWIN_LIBRARIES - The libraries needed to use KDEWIN -# Copyright (c) 2006, Alexander Neundorf, -# Copyright (c) 2007-2009, Ralf Habacker, +# SPDX-FileCopyrightText: 2006 Alexander Neundorf +# SPDX-FileCopyrightText: 2007-2009 Ralf Habacker # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - +# SPDX-License-Identifier: BSD-3-Clause if (WIN32) if(WINCE) FIND_PACKAGE(WCECOMPAT REQUIRED) endif() - + if (NOT KDEWIN_LIBRARY) - + find_path(KDEWIN_INCLUDE_DIR kdewin_export.h ${KDE4_INCLUDE_DIR} ${CMAKE_INCLUDE_PATH} ${CMAKE_INSTALL_PREFIX}/include ) - + # search for kdewin in the default install directory for applications (default of (n)make install) FILE(TO_CMAKE_PATH "${CMAKE_LIBRARY_PATH}" _cmakeLibraryPathCmakeStyle) string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_TOLOWER) if (CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) set (LIBRARY_NAME kdewind) else() set (LIBRARY_NAME kdewin) endif (CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) find_library(KDEWIN_LIBRARY NAMES ${LIBRARY_NAME} - PATHS + PATHS ${KDE4_LIB_DIR} ${_cmakeLibraryPathCmakeStyle} ${CMAKE_INSTALL_PREFIX}/lib NO_SYSTEM_ENVIRONMENT_PATH ) endif (NOT KDEWIN_LIBRARY) if (KDEWIN_LIBRARY AND KDEWIN_INCLUDE_DIR) set(KDEWIN_FOUND TRUE) # add needed system libs if(NOT WINCE) set(KDEWIN_LIBRARIES ${KDEWIN_LIBRARY} user32 shell32 ws2_32 netapi32 userenv) else() set(KDEWIN_LIBRARIES ${KDEWIN_LIBRARY} ws2 ${WCECOMPAT_LIBRARIES}) endif() if (MINGW) #mingw compiler set(KDEWIN_INCLUDES ${KDEWIN_INCLUDE_DIR} ${KDEWIN_INCLUDE_DIR}/mingw ${QT_INCLUDES}) else (MINGW) # msvc compiler # add the MS SDK include directory if available file(TO_CMAKE_PATH "$ENV{MSSDK}" MSSDK_DIR) if (WINCE) set(KDEWIN_INCLUDES ${KDEWIN_INCLUDE_DIR} ${KDEWIN_INCLUDE_DIR}/msvc ${WCECOMPAT_INCLUDE_DIR} ${QT_INCLUDES} ${MSSDK_DIR}) else() set(KDEWIN_INCLUDES ${KDEWIN_INCLUDE_DIR} ${KDEWIN_INCLUDE_DIR}/msvc ${QT_INCLUDES} ${MSSDK_DIR}) endif() endif (MINGW) endif (KDEWIN_LIBRARY AND KDEWIN_INCLUDE_DIR) # required for configure set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${KDEWIN_INCLUDES}) - set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${KDEWIN_LIBRARIES}) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${KDEWIN_LIBRARIES}) if (KDEWIN_FOUND) if (NOT KDEWin_FIND_QUIETLY) message(STATUS "Found KDEWin library: ${KDEWIN_LIBRARY}") endif (NOT KDEWin_FIND_QUIETLY) else (KDEWIN_FOUND) if (KDEWin_FIND_REQUIRED) message(FATAL_ERROR "Could NOT find KDEWin library\nPlease install it first") endif (KDEWin_FIND_REQUIRED) endif (KDEWIN_FOUND) endif (WIN32) diff --git a/attic/modules/FindLibArt.cmake b/attic/modules/FindLibArt.cmake index b14cd9d..262007b 100644 --- a/attic/modules/FindLibArt.cmake +++ b/attic/modules/FindLibArt.cmake @@ -1,63 +1,61 @@ # - Try to find the LibArt 2D graphics library # Once done this will define # # LIBART_FOUND - system has the LibArt # LIBART_INCLUDE_DIR - the LibArt include directory # LIBART_LIBRARIES - The libraries needed to use LibArt -# Copyright (c) 2006, Alexander Neundorf, +# SPDX-FileCopyrightText: 2006 Alexander Neundorf # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - +# SPDX-License-Identifier: BSD-3-Clause if (LIBART_INCLUDE_DIR AND LIBART_LIBRARIES) # in cache already SET(LIBART_FOUND TRUE) else (LIBART_INCLUDE_DIR AND LIBART_LIBRARIES) IF (NOT WIN32) find_package(PkgConfig) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls pkg_check_modules(PC_LIBART QUIET libart-2.0) ######### ?? where is this used ?? ############### set(LIBART_DEFINITIONS ${PC_LIBART_CFLAGS_OTHER}) ENDIF (NOT WIN32) FIND_PATH(LIBART_INCLUDE_DIR NAMES libart_lgpl/libart.h PATHS ${PC_LIBART_INCLUDEDIR} ${PC_LIBART_INCLUDE_DIRS} PATH_SUFFIXES libart-2.0 ) - + FIND_LIBRARY(LIBART_LIBRARIES NAMES art_lgpl_2 PATHS ${PC_LIBART_LIBDIR} ${PC_LIBART_LIBRARY_DIRS} ) - - + + if (LIBART_INCLUDE_DIR AND LIBART_LIBRARIES) set(LIBART_FOUND TRUE) endif (LIBART_INCLUDE_DIR AND LIBART_LIBRARIES) - - + + if (LIBART_FOUND) if (NOT LibArt_FIND_QUIETLY) message(STATUS "Found libart: ${LIBART_LIBRARIES}") endif (NOT LibArt_FIND_QUIETLY) else (LIBART_FOUND) if (LibArt_FIND_REQUIRED) message(FATAL_ERROR "Could NOT find libart") endif (LibArt_FIND_REQUIRED) endif (LIBART_FOUND) MARK_AS_ADVANCED(LIBART_INCLUDE_DIR LIBART_LIBRARIES) endif (LIBART_INCLUDE_DIR AND LIBART_LIBRARIES) diff --git a/attic/modules/FindLibLZMA.cmake b/attic/modules/FindLibLZMA.cmake index 1a341b2..fb41d38 100644 --- a/attic/modules/FindLibLZMA.cmake +++ b/attic/modules/FindLibLZMA.cmake @@ -1,45 +1,43 @@ # - Find LibLZMA # Find LibLZMA headers and library # # LIBLZMA_FOUND - True if liblzma is found. # LIBLZMA_INCLUDE_DIRS - Directory where liblzma headers are located. # LIBLZMA_LIBRARIES - Lzma libraries to link against. # LIBLZMA_HAS_AUTO_DECODER - True if lzma_auto_decoder() is found (required). # LIBLZMA_HAS_EASY_ENCODER - True if lzma_easy_encoder() is found (required). # LIBLZMA_HAS_LZMA_PRESET - True if lzma_lzma_preset() is found (required). -# Copyright (c) 2008, Per Øyvind Karlsen, -# Copyright (c) 2009, Alexander Neundorf, -# Copyright (c) 2009, Helio Chissini de Castro, +# SPDX-FileCopyrightText: 2008 Per Øyvind Karlsen +# SPDX-FileCopyrightText: 2009 Alexander Neundorf +# SPDX-FileCopyrightText: 2009 Helio Chissini de Castro # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - +# SPDX-License-Identifier: BSD-3-Clause FIND_PATH(LIBLZMA_INCLUDE_DIR lzma.h ) FIND_LIBRARY(LIBLZMA_LIBRARY lzma) SET(LIBLZMA_LIBRARIES ${LIBLZMA_LIBRARY}) SET(LIBLZMA_INCLUDE_DIRS ${LIBLZMA_INCLUDE_DIR}) # We're using new code known now as XZ, even library still been called LZMA # it can be found in http://tukaani.org/xz/ # Avoid using old codebase IF (LIBLZMA_LIBRARIES) INCLUDE(CheckLibraryExists) CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARIES} lzma_auto_decoder "" LIBLZMA_HAS_AUTO_DECODER) CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARIES} lzma_easy_encoder "" LIBLZMA_HAS_EASY_ENCODER) CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARIES} lzma_lzma_preset "" LIBLZMA_HAS_LZMA_PRESET) ENDIF (LIBLZMA_LIBRARIES) INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBLZMA DEFAULT_MSG LIBLZMA_INCLUDE_DIR +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBLZMA DEFAULT_MSG LIBLZMA_INCLUDE_DIR LIBLZMA_LIBRARY LIBLZMA_HAS_AUTO_DECODER LIBLZMA_HAS_EASY_ENCODER LIBLZMA_HAS_LZMA_PRESET ) MARK_AS_ADVANCED( LIBLZMA_INCLUDE_DIR LIBLZMA_LIBRARY ) diff --git a/attic/modules/FindLibPython.py b/attic/modules/FindLibPython.py index ec21b33..ad091b4 100644 --- a/attic/modules/FindLibPython.py +++ b/attic/modules/FindLibPython.py @@ -1,13 +1,12 @@ - -# Copyright (c) 2007, Simon Edwards -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-FileCopyrightText: 2007 Simon Edwards +# +# SPDX-License-Identifier: BSD-3-Clause import sys import distutils.sysconfig print("exec_prefix:%s" % sys.exec_prefix) print("short_version:%s" % sys.version[:3]) print("long_version:%s" % sys.version.split()[0]) print("py_inc_dir:%s" % distutils.sysconfig.get_python_inc()) print("site_packages_dir:%s" % distutils.sysconfig.get_python_lib(plat_specific=1)) diff --git a/attic/modules/FindLibUSB1.cmake b/attic/modules/FindLibUSB1.cmake index eba4711..d25fe94 100644 --- a/attic/modules/FindLibUSB1.cmake +++ b/attic/modules/FindLibUSB1.cmake @@ -1,37 +1,37 @@ # - Try to find the libusb-1.0 library # Once done this defines # # LIBUSB1_FOUND - system has libusb-1.0 # LibUSB1_INCLUDE_DIRS - the libusb-1.0 include directory # LibUSB1_LIBRARIES - Link these to use libusb-1.0 -# Copyright (c) 2011, 2013 Yury Kudryashov, +# SPDX-FileCopyrightText: 2011, 2013 Yury Kudryashov +# # Based on FindUSB.cmake which is: -# Copyright (c) 2006, 2008 Laurent Montel, +# SPDX-FileCopyrightText: 2006, 2008 Laurent Montel # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-License-Identifier: BSD-3-Clause # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) pkg_check_modules(PC_LibUSB1 QUIET libusb-1.0) find_path(LibUSB1_TOP_INCLUDE_DIR libusb-1.0/libusb.h HINTS ${PC_LibUSB1_INCLUDEDIR}) set(LibUSB1_INCLUDE_DIRS ${LibUSB1_TOP_INCLUDE_DIR}/libusb-1.0) find_library(LibUSB1_LIBRARY NAMES usb-1.0 HINTS ${PC_LibUSB1_LIBDIR} ${PC_LibUSB1_LIBRARY_DIRS}) set(LibUSB1_LIBRARIES ${LibUSB1_LIBRARY}) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(LibUSB1 DEFAULT_MSG LibUSB1_LIBRARIES LibUSB1_INCLUDE_DIRS) include(FeatureSummary) set_package_properties(LibUSB1 PROPERTIES URL http://www.libusb.org/ DESCRIPTION "A library that provides uniform API to access USB devices on many OSes") mark_as_advanced(LibUSB1_TOP_INCLUDE_DIR LibUSB1_LIBRARY) diff --git a/attic/modules/FindLibintl.cmake b/attic/modules/FindLibintl.cmake index c7cbc96..b1ce9ac 100644 --- a/attic/modules/FindLibintl.cmake +++ b/attic/modules/FindLibintl.cmake @@ -1,46 +1,45 @@ # Try to find Libintl functionality # Once done this will define # # LIBINTL_FOUND - system has Libintl # LIBINTL_INCLUDE_DIR - Libintl include directory # LIBINTL_LIBRARIES - Libraries needed to use Libintl # # TODO: This will enable translations only if Gettext functionality is # present in libc. Must have more robust system for release, where Gettext # functionality can also reside in standalone Gettext library, or the one # embedded within kdelibs (cf. gettext.m4 from Gettext source). -# Copyright (c) 2006, Chusslove Illich, -# Copyright (c) 2007, Alexander Neundorf, +# SPDX-FileCopyrightText: 2006 Chusslove Illich +# SPDX-FileCopyrightText: 2007 Alexander Neundorf # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-License-Identifier: BSD-3-Clause if(LIBINTL_INCLUDE_DIR AND LIBINTL_LIB_FOUND) set(Libintl_FIND_QUIETLY TRUE) endif() find_path(LIBINTL_INCLUDE_DIR libintl.h) set(LIBINTL_LIB_FOUND FALSE) if(LIBINTL_INCLUDE_DIR) include(CheckFunctionExists) check_function_exists(dgettext LIBINTL_LIBC_HAS_DGETTEXT) if (LIBINTL_LIBC_HAS_DGETTEXT) set(LIBINTL_LIBRARIES) set(LIBINTL_LIB_FOUND TRUE) else (LIBINTL_LIBC_HAS_DGETTEXT) find_library(LIBINTL_LIBRARIES NAMES intl libintl ) if(LIBINTL_LIBRARIES) set(LIBINTL_LIB_FOUND TRUE) endif() endif (LIBINTL_LIBC_HAS_DGETTEXT) endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Libintl DEFAULT_MSG LIBINTL_INCLUDE_DIR LIBINTL_LIB_FOUND) mark_as_advanced(LIBINTL_INCLUDE_DIR LIBINTL_LIBRARIES LIBINTL_LIBC_HAS_DGETTEXT LIBINTL_LIB_FOUND) diff --git a/attic/modules/FindLibraryWithDebug.cmake b/attic/modules/FindLibraryWithDebug.cmake index 58cd730..30d7d33 100644 --- a/attic/modules/FindLibraryWithDebug.cmake +++ b/attic/modules/FindLibraryWithDebug.cmake @@ -1,113 +1,113 @@ # # FIND_LIBRARY_WITH_DEBUG # -> enhanced FIND_LIBRARY to allow the search for an # optional debug library with a WIN32_DEBUG_POSTFIX similar # to CMAKE_DEBUG_POSTFIX when creating a shared lib # it has to be the second and third argument -# Copyright (c) 2007, Christian Ehrlicher, -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-FileCopyrightText: 2007 Christian Ehrlicher +# +# SPDX-License-Identifier: BSD-3-Clause MACRO(FIND_LIBRARY_WITH_DEBUG var_name win32_dbg_postfix_name dgb_postfix libname) IF(NOT "${win32_dbg_postfix_name}" STREQUAL "WIN32_DEBUG_POSTFIX") # no WIN32_DEBUG_POSTFIX -> simply pass all arguments to FIND_LIBRARY FIND_LIBRARY(${var_name} ${win32_dbg_postfix_name} ${dgb_postfix} ${libname} ${ARGN} ) ELSE(NOT "${win32_dbg_postfix_name}" STREQUAL "WIN32_DEBUG_POSTFIX") IF(NOT WIN32) # on non-win32 we don't need to take care about WIN32_DEBUG_POSTFIX FIND_LIBRARY(${var_name} ${libname} ${ARGN}) ELSE(NOT WIN32) # 1. get all possible libnames SET(args ${ARGN}) SET(newargs "") SET(libnames_release "") SET(libnames_debug "") LIST(LENGTH args listCount) IF("${libname}" STREQUAL "NAMES") SET(append_rest 0) LIST(APPEND args " ") FOREACH(i RANGE ${listCount}) LIST(GET args ${i} val) IF(append_rest) LIST(APPEND newargs ${val}) ELSE(append_rest) IF("${val}" STREQUAL "PATHS") LIST(APPEND newargs ${val}) SET(append_rest 1) ELSE("${val}" STREQUAL "PATHS") LIST(APPEND libnames_release "${val}") LIST(APPEND libnames_debug "${val}${dgb_postfix}") ENDIF("${val}" STREQUAL "PATHS") ENDIF(append_rest) ENDFOREACH(i) ELSE("${libname}" STREQUAL "NAMES") # just one name LIST(APPEND libnames_release "${libname}") LIST(APPEND libnames_debug "${libname}${dgb_postfix}") SET(newargs ${args}) ENDIF("${libname}" STREQUAL "NAMES") # search the release lib FIND_LIBRARY(${var_name}_RELEASE NAMES ${libnames_release} ${newargs} ) # search the debug lib FIND_LIBRARY(${var_name}_DEBUG NAMES ${libnames_debug} ${newargs} ) IF(${var_name}_RELEASE AND ${var_name}_DEBUG) # both libs found SET(${var_name} optimized ${${var_name}_RELEASE} debug ${${var_name}_DEBUG}) ELSE(${var_name}_RELEASE AND ${var_name}_DEBUG) IF(${var_name}_RELEASE) # only release found SET(${var_name} ${${var_name}_RELEASE}) ELSE(${var_name}_RELEASE) # only debug (or nothing) found SET(${var_name} ${${var_name}_DEBUG}) ENDIF(${var_name}_RELEASE) - + ENDIF(${var_name}_RELEASE AND ${var_name}_DEBUG) MARK_AS_ADVANCED(${var_name}_RELEASE) MARK_AS_ADVANCED(${var_name}_DEBUG) ENDIF(NOT WIN32) ENDIF(NOT "${win32_dbg_postfix_name}" STREQUAL "WIN32_DEBUG_POSTFIX") ENDMACRO(FIND_LIBRARY_WITH_DEBUG) diff --git a/attic/modules/FindLinuxWirelesstools.cmake b/attic/modules/FindLinuxWirelesstools.cmake index 794bba7..38e7f59 100644 --- a/attic/modules/FindLinuxWirelesstools.cmake +++ b/attic/modules/FindLinuxWirelesstools.cmake @@ -1,29 +1,27 @@ # - Try to find wireless extensions support libraries # Once done this will define # # IW_FOUND - system has IW # IW_INCLUDE_DIR - the IW include directory # IW_LIBRARIES - Link to these to use IW -# Copyright (c) 2006, Thorsten Roeder, +# SPDX-FileCopyrightText: 2006 Thorsten Roeder # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - +# SPDX-License-Identifier: BSD-3-Clause IF (IW_INCLUDE_DIR) # Already in cache, be silent SET(LinuxWirelesstools_FIND_QUIETLY TRUE) ENDIF (IW_INCLUDE_DIR) FIND_PATH(IW_INCLUDE_DIR iwlib.h) FIND_LIBRARY(IW_LIBRARIES NAMES iw) include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(IW "Could not find Linux Wirelesstools (libIW)" IW_INCLUDE_DIR IW_LIBRARIES ) # show the IW_INCLUDE_DIR and IW_LIBRARIES variables only in the advanced view MARK_AS_ADVANCED(IW_INCLUDE_DIR IW_LIBRARIES ) diff --git a/attic/modules/FindMySQL.cmake b/attic/modules/FindMySQL.cmake index c0ef879..4fdec6a 100644 --- a/attic/modules/FindMySQL.cmake +++ b/attic/modules/FindMySQL.cmake @@ -1,140 +1,139 @@ # - Try to find MySQL / MySQL Embedded library # Find the MySQL includes and client library # This module defines # MYSQL_INCLUDE_DIR, where to find mysql.h # MYSQL_LIBRARIES, the libraries needed to use MySQL. # MYSQL_LIB_DIR, path to the MYSQL_LIBRARIES # MYSQL_EMBEDDED_LIBRARIES, the libraries needed to use MySQL Embedded. # MYSQL_EMBEDDED_LIB_DIR, path to the MYSQL_EMBEDDED_LIBRARIES # MYSQL_FOUND, If false, do not try to use MySQL. # MYSQL_EMBEDDED_FOUND, If false, do not try to use MySQL Embedded. -# Copyright (c) 2006-2008, Jarosław Staniek +# SPDX-FileCopyrightText: 2006-2008 Jarosław Staniek # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-License-Identifier: BSD-3-Clause include(CheckCXXSourceCompiles) include(MacroPushRequiredVars) if(WIN32) find_path(MYSQL_INCLUDE_DIR mysql.h PATHS $ENV{MYSQL_INCLUDE_DIR} $ENV{MYSQL_DIR}/include $ENV{ProgramFiles}/MySQL/*/include $ENV{SystemDrive}/MySQL/*/include ) else() find_path(MYSQL_INCLUDE_DIR mysql.h PATHS $ENV{MYSQL_INCLUDE_DIR} $ENV{MYSQL_DIR}/include /usr/local/mysql/include /opt/mysql/mysql/include PATH_SUFFIXES mysql ) endif() if(WIN32) string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER) # path suffix for debug/release mode # binary_dist: mysql binary distribution # build_dist: custom build if(CMAKE_BUILD_TYPE_TOLOWER MATCHES "debug") set(binary_dist debug) set(build_dist Debug) else() ADD_DEFINITIONS(-DDBUG_OFF) set(binary_dist opt) set(build_dist Release) endif() # find_library(MYSQL_LIBRARIES NAMES mysqlclient find_library(MYSQL_LIBRARIES NAMES libmysql PATHS $ENV{MYSQL_DIR}/lib/${binary_dist} $ENV{MYSQL_DIR}/libmysql/${build_dist} $ENV{MYSQL_DIR}/client/${build_dist} $ENV{ProgramFiles}/MySQL/*/lib/${binary_dist} $ENV{SystemDrive}/MySQL/*/lib/${binary_dist} ) else() # find_library(MYSQL_LIBRARIES NAMES mysqlclient find_library(MYSQL_LIBRARIES NAMES libmysql PATHS $ENV{MYSQL_DIR}/libmysql_r/.libs $ENV{MYSQL_DIR}/lib $ENV{MYSQL_DIR}/lib/mysql /usr/local/mysql/lib /opt/mysql/mysql/lib - PATH_SUFFIXES + PATH_SUFFIXES mysql ) endif() if(WIN32) set(MYSQL_LIB_PATHS $ENV{MYSQL_DIR}/lib/opt $ENV{MYSQL_DIR}/client/release $ENV{ProgramFiles}/MySQL/*/lib/opt $ENV{SystemDrive}/MySQL/*/lib/opt ) find_library(MYSQL_LIBRARIES NAMES mysqlclient PATHS ${MYSQL_LIB_PATHS} ) else() set(MYSQL_LIB_PATHS $ENV{MYSQL_DIR}/libmysql_r/.libs $ENV{MYSQL_DIR}/lib $ENV{MYSQL_DIR}/lib/mysql /usr/local/mysql/lib /opt/mysql/mysql/lib PATH_SUFFIXES mysql ) find_library(MYSQL_LIBRARIES NAMES mysqlclient PATHS ${MYSQL_LIB_PATHS} ) endif() find_library(MYSQL_EMBEDDED_LIBRARIES NAMES mysqld PATHS ${MYSQL_LIB_PATHS} ) if(MYSQL_LIBRARIES) get_filename_component(MYSQL_LIB_DIR ${MYSQL_LIBRARIES} PATH) endif() if(MYSQL_EMBEDDED_LIBRARIES) get_filename_component(MYSQL_EMBEDDED_LIB_DIR ${MYSQL_EMBEDDED_LIBRARIES} PATH) endif() macro_push_required_vars() set( CMAKE_REQUIRED_INCLUDES ${MYSQL_INCLUDE_DIR} ) set( CMAKE_REQUIRED_LIBRARIES ${MYSQL_EMBEDDED_LIBRARIES} ) check_cxx_source_compiles( "#include \nint main() { int i = MYSQL_OPT_USE_EMBEDDED_CONNECTION; }" HAVE_MYSQL_OPT_EMBEDDED_CONNECTION ) macro_pop_required_vars() if(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES) set(MYSQL_FOUND TRUE) message(STATUS "Found MySQL: ${MYSQL_INCLUDE_DIR}, ${MYSQL_LIBRARIES}") else() set(MYSQL_FOUND FALSE) message(STATUS "MySQL not found.") endif() if(MYSQL_INCLUDE_DIR AND MYSQL_EMBEDDED_LIBRARIES AND HAVE_MYSQL_OPT_EMBEDDED_CONNECTION) set(MYSQL_EMBEDDED_FOUND TRUE) message(STATUS "Found MySQL Embedded: ${MYSQL_INCLUDE_DIR}, ${MYSQL_EMBEDDED_LIBRARIES}") else() set(MYSQL_EMBEDDED_FOUND FALSE) message(STATUS "MySQL Embedded not found.") endif() mark_as_advanced(MYSQL_INCLUDE_DIR MYSQL_LIBRARIES MYSQL_EMBEDDED_LIBRARIES) diff --git a/attic/modules/FindNetworkManager.cmake b/attic/modules/FindNetworkManager.cmake index ced2017..bea52e7 100644 --- a/attic/modules/FindNetworkManager.cmake +++ b/attic/modules/FindNetworkManager.cmake @@ -1,42 +1,40 @@ # - Try to find NetworkManager # Once done this will define # # NETWORKMANAGER_FOUND - system has NetworkManager # NETWORKMANAGER_INCLUDE_DIRS - the NetworkManager include directories # NETWORKMANAGER_LIBRARIES - the libraries needed to use NetworkManager # NETWORKMANAGER_CFLAGS - Compiler switches required for using NetworkManager # NETWORKMANAGER_VERSION - version number of NetworkManager -# Copyright (c) 2006, Alexander Neundorf, -# Copyright (c) 2007, Will Stephenson, +# SPDX-FileCopyrightText: 2006 Alexander Neundorf +# SPDX-FileCopyrightText: 2007 Will Stephenson # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - +# SPDX-License-Identifier: BSD-3-Clause IF (NETWORKMANAGER_INCLUDE_DIRS AND NM-UTIL_INCLUDE_DIRS) # in cache already SET(NetworkManager_FIND_QUIETLY TRUE) ENDIF (NETWORKMANAGER_INCLUDE_DIRS AND NM-UTIL_INCLUDE_DIRS) IF (NOT WIN32) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) PKG_SEARCH_MODULE( NETWORKMANAGER NetworkManager ) PKG_SEARCH_MODULE( NM-UTIL libnm-util ) ENDIF (NOT WIN32) IF (NETWORKMANAGER_FOUND AND NM-UTIL_FOUND) IF (NOT NetworkManager_FIND_QUIETLY) MESSAGE(STATUS "Found NetworkManager ${NETWORKMANAGER_VERSION}: ${NETWORKMANAGER_LIBRARY_DIRS}") MESSAGE(STATUS "Found libnm-util: ${NM-UTIL_LIBRARY_DIRS}") ENDIF (NOT NetworkManager_FIND_QUIETLY) ELSE (NETWORKMANAGER_FOUND AND NM-UTIL_FOUND) IF (NetworkManager_FIND_REQUIRED) MESSAGE(FATAL_ERROR "Could NOT find NetworkManager or libnm-util, check FindPkgConfig output above!") ENDIF (NetworkManager_FIND_REQUIRED) ENDIF (NETWORKMANAGER_FOUND AND NM-UTIL_FOUND) MARK_AS_ADVANCED(NETWORKMANAGER_INCLUDE_DIRS NM-UTIL_INCLUDE_DIRS) diff --git a/attic/modules/FindOggVorbis.cmake b/attic/modules/FindOggVorbis.cmake index 28575d3..0b2d122 100644 --- a/attic/modules/FindOggVorbis.cmake +++ b/attic/modules/FindOggVorbis.cmake @@ -1,76 +1,74 @@ # - Try to find the OggVorbis libraries # Once done this will define # # OGGVORBIS_FOUND - system has OggVorbis # OGGVORBIS_VERSION - set either to 1 or 2 # OGGVORBIS_INCLUDE_DIR - the OggVorbis include directory # OGGVORBIS_LIBRARIES - The libraries needed to use OggVorbis # OGG_LIBRARY - The Ogg library # VORBIS_LIBRARY - The Vorbis library # VORBISFILE_LIBRARY - The VorbisFile library # VORBISENC_LIBRARY - The VorbisEnc library -# Copyright (c) 2006, Richard Laerkaeng, +# SPDX-FileCopyrightText: 2006 Richard Laerkaeng # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - +# SPDX-License-Identifier: BSD-3-Clause include (CheckLibraryExists) find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h) find_path(OGG_INCLUDE_DIR ogg/ogg.h) find_library(OGG_LIBRARY NAMES ogg) find_library(VORBIS_LIBRARY NAMES vorbis) find_library(VORBISFILE_LIBRARY NAMES vorbisfile) find_library(VORBISENC_LIBRARY NAMES vorbisenc) mark_as_advanced(VORBIS_INCLUDE_DIR OGG_INCLUDE_DIR OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY VORBISENC_LIBRARY) if (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY) set(OGGVORBIS_LIBRARIES ${OGG_LIBRARY} ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBISENC_LIBRARY}) set(_CMAKE_REQUIRED_LIBRARIES_TMP ${CMAKE_REQUIRED_LIBRARIES}) set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${OGGVORBIS_LIBRARIES}) check_library_exists(vorbis vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2) set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_TMP}) if (HAVE_LIBVORBISENC2) set (OGGVORBIS_VERSION 2) else (HAVE_LIBVORBISENC2) set (OGGVORBIS_VERSION 1) endif (HAVE_LIBVORBISENC2) endif (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(OggVorbis REQUIRED_VARS VORBIS_LIBRARY OGG_LIBRARY VORBISFILE_LIBRARY VORBISENC_LIBRARY VORBIS_INCLUDE_DIR OGG_INCLUDE_DIR) #check_include_files(vorbis/vorbisfile.h HAVE_VORBISFILE_H) #check_library_exists(ogg ogg_page_version "" HAVE_LIBOGG) #check_library_exists(vorbis vorbis_info_init "" HAVE_LIBVORBIS) #check_library_exists(vorbisfile ov_open "" HAVE_LIBVORBISFILE) #check_library_exists(vorbisenc vorbis_info_clear "" HAVE_LIBVORBISENC) #check_library_exists(vorbis vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2) #if (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC) # message(STATUS "Ogg/Vorbis found") # set (VORBIS_LIBS "-lvorbis -logg") # set (VORBISFILE_LIBS "-lvorbisfile") # set (VORBISENC_LIBS "-lvorbisenc") # set (OGGVORBIS_FOUND TRUE) # if (HAVE_LIBVORBISENC2) # set (HAVE_VORBIS 2) # else (HAVE_LIBVORBISENC2) # set (HAVE_VORBIS 1) # endif (HAVE_LIBVORBISENC2) #else (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC) # message(STATUS "Ogg/Vorbis not found") #endif (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC) diff --git a/attic/modules/FindPCRE.cmake b/attic/modules/FindPCRE.cmake index 0fe3210..acf127f 100644 --- a/attic/modules/FindPCRE.cmake +++ b/attic/modules/FindPCRE.cmake @@ -1,44 +1,42 @@ # - Try to find the PCRE regular expression library # Once done this will define # # PCRE_FOUND - system has the PCRE library # PCRE_INCLUDE_DIR - the PCRE include directory # PCRE_LIBRARIES - The libraries needed to use PCRE -# Copyright (c) 2006, Alexander Neundorf, +# SPDX-FileCopyrightText: 2006 Alexander Neundorf # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - +# SPDX-License-Identifier: BSD-3-Clause if (PCRE_INCLUDE_DIR AND PCRE_PCREPOSIX_LIBRARY AND PCRE_PCRE_LIBRARY) # Already in cache, be silent set(PCRE_FIND_QUIETLY TRUE) endif (PCRE_INCLUDE_DIR AND PCRE_PCREPOSIX_LIBRARY AND PCRE_PCRE_LIBRARY) if (NOT WIN32) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) pkg_check_modules(PC_PCRE QUIET libpcre) set(PCRE_DEFINITIONS ${PC_PCRE_CFLAGS_OTHER}) endif (NOT WIN32) -find_path(PCRE_INCLUDE_DIR pcre.h - HINTS ${PC_PCRE_INCLUDEDIR} ${PC_PCRE_INCLUDE_DIRS} +find_path(PCRE_INCLUDE_DIR pcre.h + HINTS ${PC_PCRE_INCLUDEDIR} ${PC_PCRE_INCLUDE_DIRS} PATH_SUFFIXES pcre) find_library(PCRE_PCRE_LIBRARY NAMES pcre pcred HINTS ${PC_PCRE_LIBDIR} ${PC_PCRE_LIBRARY_DIRS}) find_library(PCRE_PCREPOSIX_LIBRARY NAMES pcreposix pcreposixd HINTS ${PC_PCRE_LIBDIR} ${PC_PCRE_LIBRARY_DIRS}) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(PCRE DEFAULT_MSG PCRE_INCLUDE_DIR PCRE_PCRE_LIBRARY PCRE_PCREPOSIX_LIBRARY ) set(PCRE_LIBRARIES ${PCRE_PCRE_LIBRARY} ${PCRE_PCREPOSIX_LIBRARY}) mark_as_advanced(PCRE_INCLUDE_DIR PCRE_LIBRARIES PCRE_PCREPOSIX_LIBRARY PCRE_PCRE_LIBRARY) diff --git a/attic/modules/FindPhonon.cmake b/attic/modules/FindPhonon.cmake index 197f47f..93cbc88 100644 --- a/attic/modules/FindPhonon.cmake +++ b/attic/modules/FindPhonon.cmake @@ -1,37 +1,36 @@ # Find libphonon # Once done this will define # # PHONON_FOUND - system has Phonon Library # PHONON_INCLUDES - the Phonon include directory # PHONON_LIBS - link these to use Phonon # PHONON_VERSION - the version of the Phonon Library -# Copyright (c) 2008, Matthias Kretz +# SPDX-FileCopyrightText: 2008 Matthias Kretz # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-License-Identifier: BSD-3-Clause macro(_phonon_find_version) set(_phonon_namespace_header_file "${PHONON_INCLUDE_DIR}/phonon/phononnamespace.h") if (APPLE AND EXISTS "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h") set(_phonon_namespace_header_file "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h") endif (APPLE AND EXISTS "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h") file(READ ${_phonon_namespace_header_file} _phonon_header LIMIT 5000 OFFSET 1000) string(REGEX MATCH "define PHONON_VERSION_STR \"(4\\.[0-9]+\\.[0-9a-z]+)\"" _phonon_version_match "${_phonon_header}") set(PHONON_VERSION "${CMAKE_MATCH_1}") endmacro(_phonon_find_version) # the dirs listed with HINTS are searched before the default sets of dirs find_library(PHONON_LIBRARY NAMES phonon HINTS ${KDE4_LIB_INSTALL_DIR} ${QT_LIBRARY_DIR}) find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h HINTS ${KDE4_INCLUDE_INSTALL_DIR} ${QT_INCLUDE_DIR} ${INCLUDE_INSTALL_DIR} ${QT_LIBRARY_DIR}) if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY) set(PHONON_LIBS ${phonon_LIB_DEPENDS} ${PHONON_LIBRARY}) set(PHONON_INCLUDES ${PHONON_INCLUDE_DIR}/KDE ${PHONON_INCLUDE_DIR}) _phonon_find_version() endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Phonon DEFAULT_MSG PHONON_INCLUDE_DIR PHONON_LIBRARY) mark_as_advanced(PHONON_INCLUDE_DIR PHONON_LIBRARY) diff --git a/attic/modules/FindPolkitQt-1.cmake b/attic/modules/FindPolkitQt-1.cmake index 4e90537..106e06b 100644 --- a/attic/modules/FindPolkitQt-1.cmake +++ b/attic/modules/FindPolkitQt-1.cmake @@ -1,37 +1,36 @@ # - Try to find PolkitQt-1 # Once done this will define # # POLKITQT-1_FOUND - system has Polkit-qt # POLKITQT-1_INCLUDE_DIR - the Polkit-qt include directory # POLKITQT-1_LIBRARIES - Link these to use all Polkit-qt libs # POLKITQT-1_CORE_LIBRARY - Link this to use the polkit-qt-core library only # POLKITQT-1_GUI_LIBRARY - Link this to use GUI elements in polkit-qt (polkit-qt-gui) # POLKITQT-1_AGENT_LIBRARY - Link this to use the agent wrapper in polkit-qt # POLKITQT-1_DEFINITIONS - Compiler switches required for using Polkit-qt # # The minimum required version of PolkitQt-1 can be specified using the # standard syntax, e.g. find_package(PolkitQt-1 1.0) -# Copyright (c) 2009, Dario Freddi, +# SPDX-FileCopyrightText: 2009 Dario Freddi # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-License-Identifier: BSD-3-Clause # Support POLKITQT-1_MIN_VERSION for compatibility: if ( NOT PolkitQt-1_FIND_VERSION AND POLKITQT-1_MIN_VERSION ) set ( PolkitQt-1_FIND_VERSION ${POLKITQT-1_MIN_VERSION} ) endif ( NOT PolkitQt-1_FIND_VERSION AND POLKITQT-1_MIN_VERSION ) set( _PolkitQt-1_FIND_QUIETLY ${PolkitQt-1_FIND_QUIETLY} ) find_package( PolkitQt-1 ${PolkitQt-1_FIND_VERSION} QUIET NO_MODULE PATHS ${LIB_INSTALL_DIR}/PolkitQt-1/cmake ) set( PolkitQt-1_FIND_QUIETLY ${_PolkitQt-1_FIND_QUIETLY} ) include( FindPackageHandleStandardArgs ) find_package_handle_standard_args( PolkitQt-1 DEFAULT_MSG PolkitQt-1_CONFIG ) if (POLKITQT-1_FOUND) if (NOT POLKITQT-1_INSTALL_DIR STREQUAL CMAKE_INSTALL_PREFIX) message("WARNING: Installation prefix does not match PolicyKit install prefixes. You probably will need to move files installed " "in POLICY_FILES_INSTALL_DIR and by dbus_add_activation_system_service to the ${PC_POLKITQT-1_PREFIX} prefix") endif (NOT POLKITQT-1_INSTALL_DIR STREQUAL CMAKE_INSTALL_PREFIX) endif (POLKITQT-1_FOUND) diff --git a/attic/modules/FindPyKDE4.cmake b/attic/modules/FindPyKDE4.cmake index b062912..7a0889c 100644 --- a/attic/modules/FindPyKDE4.cmake +++ b/attic/modules/FindPyKDE4.cmake @@ -1,184 +1,185 @@ # FindPyKDE4 # # Checks that Python and PyKDE4 are installed and defines a couple macros: # * PYKDE4_INSTALL_PYTHON_FILES # * PYKDE4_ADD_UI_FILES # * PYKDE4_ADD_EXECUTABLE -# By Simon Edwards -# This file is in the public domain. +# SPDX-FileCopyrightText: Simon Edwards +# +# SPDX-License-Identifier: CC-PDDC INCLUDE(FindPythonInterp) SET(PYKDE4_FOUND FALSE) get_filename_component( current_module_dir ${CMAKE_CURRENT_LIST_FILE} PATH) IF(PYTHONINTERP_FOUND) EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${current_module_dir}/FindPyKDE4.py OUTPUT_VARIABLE pykde_config) IF(NOT pykde_config) # Failure to run SET(PYKDE4_FOUND FALSE) ELSE(NOT pykde_config) STRING(REGEX REPLACE ".*\npykde_version:([^\n]+).*$" "\\1" PYKDE4_VERSION ${pykde_config}) STRING(REGEX REPLACE ".*\npykde_version_str:([^\n]+).*$" "\\1" PYKDE4_VERSION_STR ${pykde_config}) STRING(REGEX REPLACE ".*\npykde_kde_sip_flags:([^\n]+).*$" "\\1" PYKDE4_SIP_FLAGS ${pykde_config}) STRING(REGEX REPLACE ".*\npykde_sip_dir:([^\n]+).*$" "\\1" PYKDE4_SIP_DIR ${pykde_config}) MESSAGE(STATUS "Found PyKDE4 version ${PYKDE4_VERSION_STR} ${PYKDE4_SIP_DIR}") SET(PYKDE4_FOUND TRUE) # PyKDE4 doesn't install pykdeuic4 when installing via CMake. # Fortunately pykdeuic4 isn't needed by pate. - # + # ## FIND_PROGRAM(PYKDE4_PYKDEUIC_EXE pykdeuic4 PATHS)# ${PYKDE4_BIN_DIR}) ## IF(NOT PYKDE4_PYKDEUIC_EXE) ## MESSAGE(FATAL_ERROR "ERROR: Could not find pykdeuic4 (part of PyKDE4)") ## ENDIF(NOT PYKDE4_PYKDEUIC_EXE) ########################################################################### # This comes mostly from KDE's FindKDE4Internal.cmake macro(_SET_FANCY _var _value _comment) set(predefinedvalue "${_value}") if ("${CMAKE_INSTALL_PREFIX}" STREQUAL "${KDE4_INSTALL_DIR}" AND DEFINED KDE4_${_var}) set(predefinedvalue "${KDE4_${_var}}") endif ("${CMAKE_INSTALL_PREFIX}" STREQUAL "${KDE4_INSTALL_DIR}" AND DEFINED KDE4_${_var}) 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 (WIN32) # use relative install prefix to avoid hardcoded install pathes in cmake_install.cmake files _set_fancy(EXEC_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 "bin" "The install dir for executables (default ${EXEC_INSTALL_PREFIX}/bin)") _set_fancy(SBIN_INSTALL_DIR "sbin" "The install dir for system executables (default ${EXEC_INSTALL_PREFIX}/sbin)") else (WIN32) _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)") endif (WIN32) _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(KCONF_UPDATE_INSTALL_DIR "${DATA_INSTALL_DIR}/kconf_update" "The kconf_update install dir") # this one shouldn't be used anymore _set_fancy(APPLNK_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applnk" "Is this still used ?") _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 /etc)") _set_fancy(MAN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/man" "The kde man install dir (default ${CMAKE_INSTALL_PREFIX}/man/)") _set_fancy(INFO_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/info" "The kde info install dir (default ${CMAKE_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(NOT pykde_config) ENDIF(PYTHONINTERP_FOUND) ########################################################################### # PYKDE4_INSTALL_PYTHON_FILES(file_name...) # # Installs and bytes compiles Python files into the data directory for this # project.. # MACRO(PYKDE4_INSTALL_PYTHON_FILES) ADD_CUSTOM_TARGET(pysupport ALL) FOREACH (_current_file ${ARGN}) # Install the source file. INSTALL(FILES ${_current_file} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME}) - # Byte compile and install the .pyc file. + # Byte compile and install the .pyc file. GET_FILENAME_COMPONENT(_absfilename ${_current_file} ABSOLUTE) GET_FILENAME_COMPONENT(_filename ${_current_file} NAME) GET_FILENAME_COMPONENT(_filenamebase ${_current_file} NAME_WE) GET_FILENAME_COMPONENT(_basepath ${_current_file} PATH) SET(_bin_py ${CMAKE_BINARY_DIR}/${_basepath}/${_filename}) SET(_bin_pyc ${CMAKE_BINARY_DIR}/${_basepath}/${_filenamebase}.pyc) FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_basepath}) SET(_message "-DMESSAGE=Byte-compiling ${_bin_py}") GET_FILENAME_COMPONENT(_abs_bin_py ${_bin_py} ABSOLUTE) IF(_abs_bin_py STREQUAL ${_absfilename}) # Don't copy the file onto itself. ADD_CUSTOM_COMMAND( TARGET pysupport COMMAND ${CMAKE_COMMAND} -E echo ${message} COMMAND ${PYTHON_EXECUTABLE} ${current_module_dir}/PythonCompile.py ${_bin_py} DEPENDS ${_absfilename} ) ELSE(_abs_bin_py STREQUAL ${_absfilename}) ADD_CUSTOM_COMMAND( TARGET pysupport COMMAND ${CMAKE_COMMAND} -E echo ${message} COMMAND ${CMAKE_COMMAND} -E copy ${_absfilename} ${_bin_py} COMMAND ${PYTHON_EXECUTABLE} ${current_module_dir}/PythonCompile.py ${_bin_py} DEPENDS ${_absfilename} ) ENDIF(_abs_bin_py STREQUAL ${_absfilename}) INSTALL(FILES ${_bin_pyc} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME}) ENDFOREACH (_current_file) ENDMACRO(PYKDE4_INSTALL_PYTHON_FILES) ########################################################################### # PYKDE4_ADD_EXECUTABLE(py_name exe_name) # # Creates a smybolic link with name exe_name at install time from the # install bin directory to the Python file. The Python file is also make # executable. # MACRO(PYKDE4_ADD_EXECUTABLE _pyname _exename) if(NOT PROJECT_NAME) MESSAGE(STATUS "Project name is necessary to create symlink against python program!!! It will fail.") endif() if(WIN32) # we generate a batch file instead of a symlink. A windows link would only # work if the file extension .py is associated with python - but that is # not guaranteed. # What if python.exe is not in PATH or points to a wrong python version? # The python app should check for compatible versions at startup. # TODO: we cannot attach an icon to a bat file. So we might have to write a # C program which then calls python FILE(TO_CMAKE_PATH "${BIN_INSTALL_DIR}/${_exename}.bat" LINK_NAME) FILE(TO_CMAKE_PATH "${DATA_INSTALL_DIR}/${PROJECT_NAME}/${_pyname}" TARGET) GET_FILENAME_COMPONENT(abs_link_name $ENV{DESTDIR}/${LINK_NAME} ABSOLUTE) GET_FILENAME_COMPONENT(link_path $ENV{DESTDIR}/${LINK_NAME} PATH) GET_FILENAME_COMPONENT(abs_link_path ${link_path} ABSOLUTE) FILE(MAKE_DIRECTORY ${abs_link_path}) FILE(TO_NATIVE_PATH "../${TARGET}" rel_target) FILE(WRITE ${abs_link_name} "rem this file has been generated by PYKDE4_ADD_EXECUTABLE\n") FILE(APPEND ${abs_link_name} "python ${rel_target}\n") INSTALL(PROGRAMS ${LINK_NAME} DESTINATION $ENV{DESTDIR}/${BIN_INSTALL_DIR}) else() INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -DTARGET=${DATA_INSTALL_DIR}/${PROJECT_NAME}/${_pyname} -DLINK_NAME=${BIN_INSTALL_DIR}/${_exename} -P ${current_module_dir}/create_exe_symlink.cmake)" ) endif() ENDMACRO(PYKDE4_ADD_EXECUTABLE) diff --git a/attic/modules/FindPyKDE4.py b/attic/modules/FindPyKDE4.py index 7916aa6..416e91e 100644 --- a/attic/modules/FindPyKDE4.py +++ b/attic/modules/FindPyKDE4.py @@ -1,22 +1,22 @@ -# Copyright (c) 2014, Raphael Kubo da Costa -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-FileCopyrightText: 2014 Raphael Kubo da Costa +# +# SPDX-License-Identifier: BSD-3-Clause import PyKDE4.kdecore if __name__ == '__main__': try: import PyKDE4.pykdeconfig pykdecfg = PyKDE4.pykdeconfig.Configuration() sip_dir = pykdecfg.pykde_sip_dir sip_flags = pykdecfg.pykde_kde_sip_flags except ImportError: # PyQt4 >= 4.10.0 was built with configure-ng.py instead of # configure.py, so pyqtconfig.py and pykdeconfig.py are not installed. sip_dir = PyKDE4.kdecore.PYKDE_CONFIGURATION['sip_dir'] sip_flags = PyKDE4.kdecore.PYKDE_CONFIGURATION['sip_flags'] print('pykde_version:%06.x' % PyKDE4.kdecore.version()) print('pykde_version_str:%s' % PyKDE4.kdecore.versionString()) print('pykde_sip_dir:%s' % sip_dir) print('pykde_sip_flags:%s' % sip_flags) diff --git a/attic/modules/FindPyQt.py b/attic/modules/FindPyQt.py index 6c1c759..ccd012a 100644 --- a/attic/modules/FindPyQt.py +++ b/attic/modules/FindPyQt.py @@ -1,48 +1,48 @@ -# Copyright (c) 2007, Simon Edwards -# Copyright (c) 2014, Raphael Kubo da Costa -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-FileCopyrightText: 2007 Simon Edwards +# SPDX-FileCopyrightText: 2014 Raphael Kubo da Costa +# +# SPDX-License-Identifier: BSD-3-Clause import PyQt4.QtCore import os import sys def get_default_sip_dir(): # This is based on QScintilla's configure.py, and only works for the # default case where installation paths have not been changed in PyQt's # configuration process. if sys.platform == 'win32': pyqt_sip_dir = os.path.join(sys.prefix, 'sip', 'PyQt4') else: pyqt_sip_dir = os.path.join(sys.prefix, 'share', 'sip', 'PyQt4') return pyqt_sip_dir def get_qt4_tag(sip_flags): in_t = False for item in sip_flags.split(' '): if item == '-t': in_t = True elif in_t: if item.startswith('Qt_4'): return item else: in_t = False raise ValueError('Cannot find Qt\'s tag in PyQt4\'s SIP flags.') if __name__ == '__main__': try: import PyQt4.pyqtconfig pyqtcfg = PyQt4.pyqtconfig.Configuration() sip_dir = pyqtcfg.pyqt_sip_dir sip_flags = pyqtcfg.pyqt_sip_flags except ImportError: # PyQt4 >= 4.10.0 was built with configure-ng.py instead of # configure.py, so pyqtconfig.py is not installed. sip_dir = get_default_sip_dir() sip_flags = PyQt4.QtCore.PYQT_CONFIGURATION['sip_flags'] print('pyqt_version:%06.x' % PyQt4.QtCore.PYQT_VERSION) print('pyqt_version_str:%s' % PyQt4.QtCore.PYQT_VERSION_STR) print('pyqt_version_tag:%s' % get_qt4_tag(sip_flags)) print('pyqt_sip_dir:%s' % sip_dir) print('pyqt_sip_flags:%s' % sip_flags) diff --git a/attic/modules/FindPyQt4.cmake b/attic/modules/FindPyQt4.cmake index dab7a9f..90b6a8b 100644 --- a/attic/modules/FindPyQt4.cmake +++ b/attic/modules/FindPyQt4.cmake @@ -1,71 +1,71 @@ # Find PyQt4 # ~~~~~~~~~~ -# Copyright (c) 2007-2008, Simon Edwards -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-FileCopyrightText: 2007-2008 Simon Edwards +# +# SPDX-License-Identifier: BSD-3-Clause # # PyQt4 website: http://www.riverbankcomputing.co.uk/pyqt/index.php # # Find the installed version of PyQt4. FindPyQt4 should only be called after # Python has been found. # # This file defines the following variables, which can also be overridden by # users: # # PYQT4_VERSION - The version of PyQt4 found expressed as a 6 digit hex number # suitable for comparison as a string # # PYQT4_VERSION_STR - The version of PyQt4 as a human readable string. # # PYQT4_VERSION_TAG - The Qt4 version tag used by PyQt's sip files. # # PYQT4_SIP_DIR - The directory holding the PyQt4 .sip files. This can be unset # if PyQt4 was built using its new build system and pyqtconfig.py is not # present on the system, as in this case its value cannot be determined # automatically. # # PYQT4_SIP_FLAGS - The SIP flags used to build PyQt. IF(EXISTS PYQT4_VERSION) # Already in cache, be silent SET(PYQT4_FOUND TRUE) ELSE(EXISTS PYQT4_VERSION) FIND_FILE(_find_pyqt_py FindPyQt.py PATHS ${CMAKE_MODULE_PATH}) EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${_find_pyqt_py} OUTPUT_VARIABLE pyqt_config) IF(pyqt_config) STRING(REGEX MATCH "^pyqt_version:([^\n]+).*$" _dummy ${pyqt_config}) SET(PYQT4_VERSION "${CMAKE_MATCH_1}" CACHE STRING "PyQt4's version as a 6-digit hexadecimal number") STRING(REGEX MATCH ".*\npyqt_version_str:([^\n]+).*$" _dummy ${pyqt_config}) SET(PYQT4_VERSION_STR "${CMAKE_MATCH_1}" CACHE STRING "PyQt4's version as a human-readable string") STRING(REGEX MATCH ".*\npyqt_version_tag:([^\n]+).*$" _dummy ${pyqt_config}) SET(PYQT4_VERSION_TAG "${CMAKE_MATCH_1}" CACHE STRING "The Qt4 version tag used by PyQt4's .sip files") STRING(REGEX MATCH ".*\npyqt_sip_dir:([^\n]+).*$" _dummy ${pyqt_config}) SET(PYQT4_SIP_DIR "${CMAKE_MATCH_1}" CACHE PATH "The base directory where PyQt4's .sip files are installed") STRING(REGEX MATCH ".*\npyqt_sip_flags:([^\n]+).*$" _dummy ${pyqt_config}) SET(PYQT4_SIP_FLAGS "${CMAKE_MATCH_1}" CACHE STRING "The SIP flags used to build PyQt4") IF(NOT IS_DIRECTORY "${PYQT4_SIP_DIR}") MESSAGE(WARNING "The base directory where PyQt4's SIP files are installed could not be determined. This usually means PyQt4 was built with its new build system and pyqtconfig.py is not present.\n" "Please set the PYQT4_SIP_DIR variable manually.") ELSE(NOT IS_DIRECTORY "${PYQT4_SIP_DIR}") SET(PYQT4_FOUND TRUE) ENDIF(NOT IS_DIRECTORY "${PYQT4_SIP_DIR}") ENDIF(pyqt_config) IF(PYQT4_FOUND) IF(NOT PYQT4_FIND_QUIETLY) MESSAGE(STATUS "Found PyQt4 version: ${PYQT4_VERSION_STR}") ENDIF(NOT PYQT4_FIND_QUIETLY) ELSE(PYQT4_FOUND) IF(PYQT4_FIND_REQUIRED) MESSAGE(FATAL_ERROR "Could not find Python") ENDIF(PYQT4_FIND_REQUIRED) ENDIF(PYQT4_FOUND) ENDIF(EXISTS PYQT4_VERSION) diff --git a/attic/modules/FindPythonLibrary.cmake b/attic/modules/FindPythonLibrary.cmake index bb02c1b..e1a5f9e 100644 --- a/attic/modules/FindPythonLibrary.cmake +++ b/attic/modules/FindPythonLibrary.cmake @@ -1,106 +1,104 @@ # Find Python # ~~~~~~~~~~~ # Find the Python interpreter and related Python directories. # # This file defines the following variables: # # PYTHON_EXECUTABLE - The path and filename of the Python interpreter. # # PYTHON_SHORT_VERSION - The version of the Python interpreter found, # excluding the patch version number. (e.g. 2.5 and not 2.5.1)) # # PYTHON_LONG_VERSION - The version of the Python interpreter found as a human # readable string. # -# PYTHON_SITE_PACKAGES_INSTALL_DIR - this cache variable can be used for installing +# PYTHON_SITE_PACKAGES_INSTALL_DIR - this cache variable can be used for installing # own python modules. You may want to adjust this to be the # same as ${PYTHON_SITE_PACKAGES_DIR}, but then admin # privileges may be required for installation. # # PYTHON_SITE_PACKAGES_DIR - Location of the Python site-packages directory. # # PYTHON_INCLUDE_PATH - Directory holding the python.h include file. # # PYTHON_LIBRARY, PYTHON_LIBRARIES- Location of the Python library. -# Copyright (c) 2007, Simon Edwards -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - - +# SPDX-FileCopyrightText: 2007 Simon Edwards +# +# SPDX-License-Identifier: BSD-3-Clause include(CMakeFindFrameworks) if(EXISTS PYTHON_LIBRARY) # Already in cache, be silent set(PYTHONLIBRARY_FOUND TRUE) else() find_package(PythonInterp) if(PYTHONINTERP_FOUND) # get the directory of the current file, used later on in the file get_filename_component( _py_cmake_module_dir ${CMAKE_CURRENT_LIST_FILE} PATH) if(NOT EXISTS "${_py_cmake_module_dir}/FindLibPython.py") message(FATAL_ERROR "The file FindLibPython.py does not exist in ${_py_cmake_module_dir} (the directory where FindPythonLibrary.cmake is located). Check your installation.") endif() execute_process(COMMAND ${PYTHON_EXECUTABLE} "${_py_cmake_module_dir}/FindLibPython.py" OUTPUT_VARIABLE python_config) if(python_config) string(REGEX REPLACE ".*exec_prefix:([^\n]+).*$" "\\1" PYTHON_PREFIX ${python_config}) string(REGEX REPLACE ".*\nshort_version:([^\n]+).*$" "\\1" PYTHON_SHORT_VERSION ${python_config}) string(REGEX REPLACE ".*\nlong_version:([^\n]+).*$" "\\1" PYTHON_LONG_VERSION ${python_config}) string(REGEX REPLACE ".*\npy_inc_dir:([^\n]+).*$" "\\1" _TMP_PYTHON_INCLUDE_PATH ${python_config}) string(REGEX REPLACE ".*\nsite_packages_dir:([^\n]+).*$" "\\1" _TMP_PYTHON_SITE_PACKAGES_DIR ${python_config}) # Put these two variables in the cache so they are visible for the user, but read-only: set(PYTHON_INCLUDE_PATH "${_TMP_PYTHON_INCLUDE_PATH}" CACHE PATH "The python include directory" FORCE) set(PYTHON_SITE_PACKAGES_DIR "${_TMP_PYTHON_SITE_PACKAGES_DIR}" CACHE PATH "The python site packages dir" FORCE) # This one is intended to be used and changed by the user for installing own modules: set(PYTHON_SITE_PACKAGES_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/python${PYTHON_SHORT_VERSION}/site-packages CACHE PATH "The directory where python modules will be installed to.") string(REGEX REPLACE "([0-9]+).([0-9]+)" "\\1\\2" PYTHON_SHORT_VERSION_NO_DOT ${PYTHON_SHORT_VERSION}) set(PYTHON_LIBRARY_NAMES python${PYTHON_SHORT_VERSION} python${PYTHON_SHORT_VERSION_NO_DOT}) if(WIN32) string(REPLACE "\\" "/" PYTHON_SITE_PACKAGES_DIR ${PYTHON_SITE_PACKAGES_DIR}) endif() find_library(PYTHON_LIBRARY NAMES ${PYTHON_LIBRARY_NAMES} PATHS ${PYTHON_PREFIX}/lib ${PYTHON_PREFIX}/libs NO_DEFAULT_PATH) set(PYTHONLIBRARY_FOUND TRUE) endif() # adapted from cmake's builtin FindPythonLibs if(APPLE) cmake_find_frameworks(Python) set(PYTHON_FRAMEWORK_INCLUDES) if(Python_FRAMEWORKS) # If a framework has been selected for the include path, # make sure "-framework" is used to link it. if("${PYTHON_INCLUDE_PATH}" MATCHES "Python\\.framework") set(PYTHON_LIBRARY "") set(PYTHON_DEBUG_LIBRARY "") endif() if(NOT PYTHON_LIBRARY) set (PYTHON_LIBRARY "-framework Python" CACHE FILEPATH "Python Framework" FORCE) endif() set(PYTHONLIBRARY_FOUND TRUE) endif() endif() endif() if(PYTHONLIBRARY_FOUND) set(PYTHON_LIBRARIES ${PYTHON_LIBRARY}) if(NOT PYTHONLIBRARY_FIND_QUIETLY) message(STATUS "Found Python executable: ${PYTHON_EXECUTABLE}") message(STATUS "Found Python version: ${PYTHON_LONG_VERSION}") message(STATUS "Found Python library: ${PYTHON_LIBRARY}") endif() else() if(PYTHONLIBRARY_FIND_REQUIRED) message(FATAL_ERROR "Could not find Python") endif() endif() endif (EXISTS PYTHON_LIBRARY) diff --git a/attic/modules/FindQCA2.cmake b/attic/modules/FindQCA2.cmake index e2d8f2a..7f340d8 100644 --- a/attic/modules/FindQCA2.cmake +++ b/attic/modules/FindQCA2.cmake @@ -1,48 +1,47 @@ # - Try to find QCA2 (Qt Cryptography Architecture 2) # Once done this will define # # QCA2_FOUND - system has QCA2 # QCA2_INCLUDE_DIR - the QCA2 include directory # QCA2_LIBRARIES - the libraries needed to use QCA2 # QCA2_DEFINITIONS - Compiler switches required for using QCA2 # # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls -# Copyright (c) 2006, Michael Larouche, +# SPDX-FileCopyrightText: 2006 Michael Larouche # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-License-Identifier: BSD-3-Clause include(FindLibraryWithDebug) if (QCA2_INCLUDE_DIR AND QCA2_LIBRARIES) # in cache already set(QCA2_FOUND TRUE) else (QCA2_INCLUDE_DIR AND QCA2_LIBRARIES) if (NOT WIN32) find_package(PkgConfig) pkg_check_modules(PC_QCA2 QUIET qca2) set(QCA2_DEFINITIONS ${PC_QCA2_CFLAGS_OTHER}) endif (NOT WIN32) find_library_with_debug(QCA2_LIBRARIES WIN32_DEBUG_POSTFIX d NAMES qca HINTS ${PC_QCA2_LIBDIR} ${PC_QCA2_LIBRARY_DIRS} ) find_path(QCA2_INCLUDE_DIR QtCrypto HINTS ${PC_QCA2_INCLUDEDIR} ${PC_QCA2_INCLUDE_DIRS} PATH_SUFFIXES QtCrypto) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(QCA2 DEFAULT_MSG QCA2_LIBRARIES QCA2_INCLUDE_DIR) mark_as_advanced(QCA2_INCLUDE_DIR QCA2_LIBRARIES) endif (QCA2_INCLUDE_DIR AND QCA2_LIBRARIES) diff --git a/attic/modules/FindQImageBlitz.cmake b/attic/modules/FindQImageBlitz.cmake index 1b34741..53388b6 100644 --- a/attic/modules/FindQImageBlitz.cmake +++ b/attic/modules/FindQImageBlitz.cmake @@ -1,51 +1,51 @@ # - Try to find the qimageblitz lib # Once done this will define # # QIMAGEBLITZ_FOUND - system has qimageblitz lib # QIMAGEBLITZ_INCLUDES - the qimageblitz include directory # QIMAGEBLITZ_LIBRARIES - The libraries needed to use qimageblitz -# Copyright (c) 2006, Montel Laurent, -# Copyright (c) 2007, Allen Winter, -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-FileCopyrightText: 2006 Montel Laurent +# SPDX-FileCopyrightText: 2007 Allen Winter +# +# SPDX-License-Identifier: BSD-3-Clause include(FindLibraryWithDebug) if (QIMAGEBLITZ_INCLUDES AND QIMAGEBLITZ_LIBRARIES) set(QImageBlitz_FIND_QUIETLY TRUE) endif (QIMAGEBLITZ_INCLUDES AND QIMAGEBLITZ_LIBRARIES) if (NOT WIN32) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) pkg_check_modules(PC_QIMAGEBLITZ QUIET qimageblitz) endif (NOT WIN32) find_path(QIMAGEBLITZ_INCLUDES NAMES qimageblitz.h PATH_SUFFIXES qimageblitz HINTS $ENV{QIMAGEBLITZDIR}/include ${PC_QIMAGEBLITZ_INCLUDEDIR} ${KDE4_INCLUDE_DIR} ${INCLUDE_INSTALL_DIR} ) find_library_with_debug(QIMAGEBLITZ_LIBRARIES WIN32_DEBUG_POSTFIX d qimageblitz HINTS $ENV{QIMAGEBLITZDIR}/lib ${PC_QIMAGEBLITZ_LIBDIR} ${KDE4_LIB_DIR} ${LIB_INSTALL_DIR} ) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(QImageBlitz DEFAULT_MSG +find_package_handle_standard_args(QImageBlitz DEFAULT_MSG QIMAGEBLITZ_INCLUDES QIMAGEBLITZ_LIBRARIES) mark_as_advanced(QIMAGEBLITZ_INCLUDES QIMAGEBLITZ_LIBRARIES) diff --git a/attic/modules/FindQt4.cmake b/attic/modules/FindQt4.cmake index f501f35..f886e8c 100644 --- a/attic/modules/FindQt4.cmake +++ b/attic/modules/FindQt4.cmake @@ -1,1272 +1,1272 @@ # - Find QT 4 # This module can be used to find Qt4. # The most important issue is that the Qt4 qmake is available via the system path. # This qmake is then used to detect basically everything else. # This module defines a number of key variables and macros. # The variable QT_USE_FILE is set which is the path to a CMake file that can be included # to compile Qt 4 applications and libraries. It sets up the compilation # environment for include directories, preprocessor defines and populates a # QT_LIBRARIES variable. # # Typical usage could be something like: # find_package(Qt4 4.4.3 COMPONENTS QtCore QtGui QtXml REQUIRED ) # include(${QT_USE_FILE}) # add_executable(myexe main.cpp) # target_link_libraries(myexe ${QT_LIBRARIES}) # # The minimum required version can be specified using the standard find_package()-syntax # (see example above). # For compatibility with older versions of FindQt4.cmake it is also possible to # set the variable QT_MIN_VERSION to the minimum required version of Qt4 before the # find_package(Qt4) command. # If both are used, the version used in the find_package() command overrides the # one from QT_MIN_VERSION. # # When using the components argument, QT_USE_QT* variables are automatically set # for the QT_USE_FILE to pick up. If one wishes to manually set them, the # available ones to set include: # QT_DONT_USE_QTCORE # QT_DONT_USE_QTGUI # QT_USE_QT3SUPPORT # QT_USE_QTASSISTANT # QT_USE_QAXCONTAINER # QT_USE_QAXSERVER # QT_USE_QTDESIGNER # QT_USE_QTMOTIF # QT_USE_QTMAIN # QT_USE_QTMULTIMEDIA # QT_USE_QTNETWORK # QT_USE_QTNSPLUGIN # QT_USE_QTOPENGL # QT_USE_QTSQL # QT_USE_QTXML # QT_USE_QTSVG # QT_USE_QTTEST # QT_USE_QTUITOOLS # QT_USE_QTDBUS # QT_USE_QTSCRIPT # QT_USE_QTASSISTANTCLIENT # QT_USE_QTHELP # QT_USE_QTWEBKIT # QT_USE_QTXMLPATTERNS # QT_USE_PHONON # QT_USE_QTSCRIPTTOOLS # QT_USE_QTDECLARATIVE # # QT_USE_IMPORTED_TARGETS # If this variable is set to TRUE, FindQt4.cmake will create imported # library targets for the various Qt libraries and set the # library variables like QT_QTCORE_LIBRARY to point at these imported # targets instead of the library file on disk. This provides much better # handling of the release and debug versions of the Qt libraries and is # also always backwards compatible, except for the case that dependencies # of libraries are exported, these will then also list the names of the # imported targets as dependency and not the file location on disk. This # is much more flexible, but requires that FindQt4.cmake is executed before # such an exported dependency file is processed. # # There are also some files that need processing by some Qt tools such as moc # and uic. Listed below are macros that may be used to process those files. # # macro QT4_WRAP_CPP(outfiles inputfile ... OPTIONS ...) # create moc code from a list of files containing Qt class with # the Q_OBJECT declaration. Per-direcotry preprocessor definitions # are also added. Options may be given to moc, such as those found # when executing "moc -help". # # macro QT4_WRAP_UI(outfiles inputfile ... OPTIONS ...) # create code from a list of Qt designer ui files. # Options may be given to uic, such as those found # when executing "uic -help" # # macro QT4_ADD_RESOURCES(outfiles inputfile ... OPTIONS ...) # create code from a list of Qt resource files. # Options may be given to rcc, such as those found # when executing "rcc -help" # # macro QT4_GENERATE_MOC(inputfile outputfile ) # creates a rule to run moc on infile and create outfile. # Use this if for some reason QT4_WRAP_CPP() isn't appropriate, e.g. # because you need a custom filename for the moc file or something similar. # # macro QT4_AUTOMOC(sourcefile1 sourcefile2 ... ) # This macro is still experimental. # It can be used to have moc automatically handled. # So if you have the files foo.h and foo.cpp, and in foo.h a # a class uses the Q_OBJECT macro, moc has to run on it. If you don't # want to use QT4_WRAP_CPP() (which is reliable and mature), you can insert # #include "foo.moc" # in foo.cpp and then give foo.cpp as argument to QT4_AUTOMOC(). This will the # scan all listed files at cmake-time for such included moc files and if it finds # them cause a rule to be generated to run moc at build time on the # accompanying header file foo.h. # If a source file has the SKIP_AUTOMOC property set it will be ignored by this macro. # # macro QT4_ADD_DBUS_INTERFACE(outfiles interface basename) # create a the interface header and implementation files with the # given basename from the given interface xml file and add it to # the list of sources. # To disable generating a namespace header, set the source file property # NO_NAMESPACE to TRUE on the interface file. # To include a header in the interface header, set the source file property # INCLUDE to the name of the header. # To specify a class name to use, set the source file property CLASSNAME # to the name of the class. # # macro QT4_ADD_DBUS_INTERFACES(outfiles inputfile ... ) # create the interface header and implementation files # for all listed interface xml files # the name will be automatically determined from the name of the xml file # To disable generating namespace headers, set the source file property # NO_NAMESPACE to TRUE for these inputfiles. # To include a header in the interface header, set the source file property # INCLUDE to the name of the header. # To specify a class name to use, set the source file property CLASSNAME # to the name of the class. # # macro QT4_ADD_DBUS_ADAPTOR(outfiles xmlfile parentheader parentclassname [basename] [classname]) # create a dbus adaptor (header and implementation file) from the xml file # describing the interface, and add it to the list of sources. The adaptor # forwards the calls to a parent class, defined in parentheader and named # parentclassname. The name of the generated files will be # adaptor.{cpp,h} where basename defaults to the basename of the xml file. # If is provided, then it will be used as the classname of the # adaptor itself. # # macro QT4_GENERATE_DBUS_INTERFACE( header [interfacename] OPTIONS ...) # generate the xml interface file from the given header. # If the optional argument interfacename is omitted, the name of the # interface file is constructed from the basename of the header with # the suffix .xml appended. # Options may be given to qdbuscpp2xml, such as those found when executing "qdbuscpp2xml --help" # # macro QT4_CREATE_TRANSLATION( qm_files directories ... sources ... # ts_files ... OPTIONS ...) # out: qm_files # in: directories sources ts_files # options: flags to pass to lupdate, such as -extensions to specify # extensions for a directory scan. # generates commands to create .ts (vie lupdate) and .qm # (via lrelease) - files from directories and/or sources. The ts files are # created and/or updated in the source tree (unless given with full paths). # The qm files are generated in the build tree. # Updating the translations can be done by adding the qm_files # to the source list of your library/executable, so they are # always updated, or by adding a custom target to control when # they get updated/generated. # # macro QT4_ADD_TRANSLATION( qm_files ts_files ... ) # out: qm_files # in: ts_files # generates commands to create .qm from .ts - files. The generated # filenames can be found in qm_files. The ts_files # must exists and are not updated in any way. # # # Below is a detailed list of variables that FindQt4.cmake sets. # QT_FOUND If false, don't try to use Qt. # QT4_FOUND If false, don't try to use Qt 4. # # QT_VERSION_MAJOR The major version of Qt found. # QT_VERSION_MINOR The minor version of Qt found. # QT_VERSION_PATCH The patch version of Qt found. # # QT_EDITION Set to the edition of Qt (i.e. DesktopLight) # QT_EDITION_DESKTOPLIGHT True if QT_EDITION == DesktopLight # QT_QTCORE_FOUND True if QtCore was found. # QT_QTGUI_FOUND True if QtGui was found. # QT_QT3SUPPORT_FOUND True if Qt3Support was found. # QT_QTASSISTANT_FOUND True if QtAssistant was found. # QT_QTASSISTANTCLIENT_FOUND True if QtAssistantClient was found. # QT_QAXCONTAINER_FOUND True if QAxContainer was found (Windows only). # QT_QAXSERVER_FOUND True if QAxServer was found (Windows only). # QT_QTDBUS_FOUND True if QtDBus was found. # QT_QTDESIGNER_FOUND True if QtDesigner was found. # QT_QTDESIGNERCOMPONENTS True if QtDesignerComponents was found. # QT_QTHELP_FOUND True if QtHelp was found. # QT_QTMOTIF_FOUND True if QtMotif was found. # QT_QTMULTIMEDIA_FOUND True if QtMultimedia was found (since Qt 4.6.0). # QT_QTNETWORK_FOUND True if QtNetwork was found. # QT_QTNSPLUGIN_FOUND True if QtNsPlugin was found. # QT_QTOPENGL_FOUND True if QtOpenGL was found. # QT_QTSQL_FOUND True if QtSql was found. # QT_QTSVG_FOUND True if QtSvg was found. # QT_QTSCRIPT_FOUND True if QtScript was found. # QT_QTSCRIPTTOOLS_FOUND True if QtScriptTools was found. # QT_QTTEST_FOUND True if QtTest was found. # QT_QTUITOOLS_FOUND True if QtUiTools was found. # QT_QTWEBKIT_FOUND True if QtWebKit was found. # QT_QTXML_FOUND True if QtXml was found. # QT_QTXMLPATTERNS_FOUND True if QtXmlPatterns was found. # QT_PHONON_FOUND True if phonon was found. # QT_QTDECLARATIVE_FOUND True if QtDeclarative was found. # # QT_MAC_USE_COCOA For Mac OS X, its whether Cocoa or Carbon is used. # In general, this should not be used, but its useful # when having platform specific code. # # QT_DEFINITIONS Definitions to use when compiling code that uses Qt. # You do not need to use this if you include QT_USE_FILE. # The QT_USE_FILE will also define QT_DEBUG and QT_NO_DEBUG # to fit your current build type. Those are not contained # in QT_DEFINITIONS. # # QT_INCLUDES List of paths to all include directories of # Qt4 QT_INCLUDE_DIR and QT_QTCORE_INCLUDE_DIR are # always in this variable even if NOTFOUND, # all other INCLUDE_DIRS are # only added if they are found. # You do not need to use this if you include QT_USE_FILE. # # # Include directories for the Qt modules are listed here. # You do not need to use these variables if you include QT_USE_FILE. # # QT_INCLUDE_DIR Path to "include" of Qt4 # QT_QT_INCLUDE_DIR Path to "include/Qt" # QT_QT3SUPPORT_INCLUDE_DIR Path to "include/Qt3Support" # QT_QTASSISTANT_INCLUDE_DIR Path to "include/QtAssistant" # QT_QTASSISTANTCLIENT_INCLUDE_DIR Path to "include/QtAssistant" # QT_QAXCONTAINER_INCLUDE_DIR Path to "include/ActiveQt" (Windows only) # QT_QAXSERVER_INCLUDE_DIR Path to "include/ActiveQt" (Windows only) # QT_QTCORE_INCLUDE_DIR Path to "include/QtCore" # QT_QTDBUS_INCLUDE_DIR Path to "include/QtDBus" # QT_QTDESIGNER_INCLUDE_DIR Path to "include/QtDesigner" # QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR Path to "include/QtDesigner" # QT_QTGUI_INCLUDE_DIR Path to "include/QtGui" # QT_QTHELP_INCLUDE_DIR Path to "include/QtHelp" # QT_QTMOTIF_INCLUDE_DIR Path to "include/QtMotif" # QT_QTMULTIMEDIA_INCLUDE_DIR Path to "include/QtMultimedia" # QT_QTNETWORK_INCLUDE_DIR Path to "include/QtNetwork" # QT_QTNSPLUGIN_INCLUDE_DIR Path to "include/QtNsPlugin" # QT_QTOPENGL_INCLUDE_DIR Path to "include/QtOpenGL" # QT_QTSCRIPT_INCLUDE_DIR Path to "include/QtScript" # QT_QTSQL_INCLUDE_DIR Path to "include/QtSql" # QT_QTSVG_INCLUDE_DIR Path to "include/QtSvg" # QT_QTTEST_INCLUDE_DIR Path to "include/QtTest" # QT_QTWEBKIT_INCLUDE_DIR Path to "include/QtWebKit" # QT_QTXML_INCLUDE_DIR Path to "include/QtXml" # QT_QTXMLPATTERNS_INCLUDE_DIR Path to "include/QtXmlPatterns" # QT_PHONON_INCLUDE_DIR Path to "include/phonon" # QT_QTSCRIPTTOOLS_INCLUDE_DIR Path to "include/QtScriptTools" # QT_QTDECLARATIVE_INCLUDE_DIR Path to "include/QtDeclarative" # # QT_BINARY_DIR Path to "bin" of Qt4 # QT_LIBRARY_DIR Path to "lib" of Qt4 # QT_PLUGINS_DIR Path to "plugins" for Qt4 # QT_TRANSLATIONS_DIR Path to "translations" of Qt4 # QT_IMPORTS_DIR Path to "imports" of Qt4 # QT_DOC_DIR Path to "doc" of Qt4 # QT_MKSPECS_DIR Path to "mkspecs" of Qt4 # # # For every library of Qt, a QT_QTFOO_LIBRARY variable is defined, with the full path to the library. # # So there are the following variables: # The Qt3Support library: QT_QT3SUPPORT_LIBRARY # # The QtAssistant library: QT_QTASSISTANT_LIBRARY # # The QtAssistantClient library: QT_QTASSISTANTCLIENT_LIBRARY # # The QAxServer library: QT_QAXSERVER_LIBRARY # # The QAxContainer library: QT_QAXCONTAINER_LIBRARY # # The QtCore library: QT_QTCORE_LIBRARY # # The QtDBus library: QT_QTDBUS_LIBRARY # # The QtDesigner library: QT_QTDESIGNER_LIBRARY # # The QtDesignerComponents library: QT_QTDESIGNERCOMPONENTS_LIBRARY # # The QtGui library: QT_QTGUI_LIBRARY # # The QtHelp library: QT_QTHELP_LIBRARY # # The QtMotif library: QT_QTMOTIF_LIBRARY # # The QtMultimedia library: QT_QTMULTIMEDIA_LIBRARY # # The QtNetwork library: QT_QTNETWORK_LIBRARY # # The QtNsPLugin library: QT_QTNSPLUGIN_LIBRARY # # The QtOpenGL library: QT_QTOPENGL_LIBRARY # # The QtScript library: QT_QTSCRIPT_LIBRARY # # The QtScriptTools library: QT_QTSCRIPTTOOLS_LIBRARY # # The QtSql library: QT_QTSQL_LIBRARY # # The QtSvg library: QT_QTSVG_LIBRARY # # The QtTest library: QT_QTTEST_LIBRARY # # The QtUiTools library: QT_QTUITOOLS_LIBRARY # # The QtWebKit library: QT_QTWEBKIT_LIBRARY # # The QtXml library: QT_QTXML_LIBRARY # # The QtXmlPatterns library: QT_QTXMLPATTERNS_LIBRARY # # The qtmain library for Windows QT_QTMAIN_LIBRARY # # The Phonon library: QT_PHONON_LIBRARY # # The QtDeclarative library: QT_QTDECLARATIVE_LIBRARY # # also defined, but NOT for general use are # QT_MOC_EXECUTABLE Where to find the moc tool. # QT_UIC_EXECUTABLE Where to find the uic tool. # QT_UIC3_EXECUTABLE Where to find the uic3 tool. # QT_RCC_EXECUTABLE Where to find the rcc tool # QT_DBUSCPP2XML_EXECUTABLE Where to find the qdbuscpp2xml tool. # QT_DBUSXML2CPP_EXECUTABLE Where to find the qdbusxml2cpp tool. # QT_LUPDATE_EXECUTABLE Where to find the lupdate tool. # QT_LRELEASE_EXECUTABLE Where to find the lrelease tool. # QT_QCOLLECTIONGENERATOR_EXECUTABLE Where to find the qcollectiongenerator tool. # QT_DESIGNER_EXECUTABLE Where to find the Qt designer tool. # QT_LINGUIST_EXECUTABLE Where to find the Qt linguist tool. # # # These are around for backwards compatibility # they will be set # QT_WRAP_CPP Set true if QT_MOC_EXECUTABLE is found # QT_WRAP_UI Set true if QT_UIC_EXECUTABLE is found # # These variables do _NOT_ have any effect anymore (compared to FindQt.cmake) # QT_MT_REQUIRED Qt4 is now always multithreaded # # These variables are set to "" Because Qt structure changed # (They make no sense in Qt4) # QT_QT_LIBRARY Qt-Library is now split -# Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. +# SPDX-FileCopyrightText: 2002 Kitware , Inc., Insight Consortium. All rights reserved. # See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. # Use FIND_PACKAGE( Qt4 COMPONENTS ... ) to enable modules IF( Qt4_FIND_COMPONENTS ) FOREACH( component ${Qt4_FIND_COMPONENTS} ) STRING( TOUPPER ${component} _COMPONENT ) SET( QT_USE_${_COMPONENT} 1 ) ENDFOREACH( component ) # To make sure we don't use QtCore or QtGui when not in COMPONENTS IF(NOT QT_USE_QTCORE) SET( QT_DONT_USE_QTCORE 1 ) ENDIF(NOT QT_USE_QTCORE) IF(NOT QT_USE_QTGUI) SET( QT_DONT_USE_QTGUI 1 ) ENDIF(NOT QT_USE_QTGUI) ENDIF( Qt4_FIND_COMPONENTS ) # If Qt3 has already been found, fail. IF(QT_QT_LIBRARY) IF(Qt4_FIND_REQUIRED) MESSAGE( FATAL_ERROR "Qt3 and Qt4 cannot be used together in one project. If switching to Qt4, the CMakeCache.txt needs to be cleaned.") ELSE(Qt4_FIND_REQUIRED) IF(NOT Qt4_FIND_QUIETLY) MESSAGE( STATUS "Qt3 and Qt4 cannot be used together in one project. If switching to Qt4, the CMakeCache.txt needs to be cleaned.") ENDIF(NOT Qt4_FIND_QUIETLY) RETURN() ENDIF(Qt4_FIND_REQUIRED) ENDIF(QT_QT_LIBRARY) function(_QT4_QUERY_QMAKE VAR RESULT) exec_program(${QT_QMAKE_EXECUTABLE} ARGS "-query ${VAR}" RETURN_VALUE return_code OUTPUT_VARIABLE output ) if(NOT return_code) file(TO_CMAKE_PATH "${output}" output) set(${RESULT} ${output} PARENT_SCOPE) endif() endfunction(_QT4_QUERY_QMAKE) IF (QT4_QMAKE_FOUND AND Qt4::QtCore) # Check already done in this cmake run, nothing more to do RETURN() ENDIF (QT4_QMAKE_FOUND AND Qt4::QtCore) # check that QT_NO_DEBUG is defined for release configurations MACRO(QT_CHECK_FLAG_EXISTS FLAG VAR DOC) IF(NOT ${VAR} MATCHES "${FLAG}") SET(${VAR} "${${VAR}} ${FLAG}" CACHE STRING "Flags used by the compiler during ${DOC} builds." FORCE) ENDIF(NOT ${VAR} MATCHES "${FLAG}") ENDMACRO(QT_CHECK_FLAG_EXISTS FLAG VAR) QT_CHECK_FLAG_EXISTS(-DQT_NO_DEBUG CMAKE_CXX_FLAGS_RELWITHDEBINFO "Release with Debug Info") QT_CHECK_FLAG_EXISTS(-DQT_NO_DEBUG CMAKE_CXX_FLAGS_RELEASE "release") QT_CHECK_FLAG_EXISTS(-DQT_NO_DEBUG CMAKE_CXX_FLAGS_MINSIZEREL "release minsize") INCLUDE(MacroPushRequiredVars) INCLUDE(CheckSymbolExists) INCLUDE(MacroAddFileDependencies) SET(QT_USE_FILE ${CMAKE_ROOT}/Modules/UseQt4.cmake) SET( QT_DEFINITIONS "") SET(QT4_INSTALLED_VERSION_TOO_OLD FALSE) # macro for asking qmake to process pro files MACRO(QT_QUERY_QMAKE outvar invar) IF(QT_QMAKE_EXECUTABLE) FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake/tmp.pro "message(CMAKE_MESSAGE<$$${invar}>)") # Invoke qmake with the tmp.pro program to get the desired # information. Use the same variable for both stdout and stderr # to make sure we get the output on all platforms. EXECUTE_PROCESS(COMMAND ${QT_QMAKE_EXECUTABLE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake OUTPUT_VARIABLE _qmake_query_output RESULT_VARIABLE _qmake_result ERROR_VARIABLE _qmake_query_output ) FILE(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake") IF(_qmake_result) MESSAGE(WARNING " querying qmake for ${invar}. qmake reported:\n${_qmake_query_output}") ELSE(_qmake_result) STRING(REGEX REPLACE ".*CMAKE_MESSAGE<([^>]*).*" "\\1" ${outvar} "${_qmake_query_output}") ENDIF(_qmake_result) ENDIF(QT_QMAKE_EXECUTABLE) ENDMACRO(QT_QUERY_QMAKE) GET_FILENAME_COMPONENT(qt_install_version "[HKEY_CURRENT_USER\\Software\\trolltech\\Versions;DefaultQtVersion]" NAME) # check for qmake # Debian uses qmake-qt4 # macports' Qt uses qmake-mac FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake qmake4 qmake-qt4 qmake-mac PATHS "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\${qt_install_version};InstallDir]/bin" $ENV{QTDIR}/bin DOC "The qmake executable for the Qt installation to use" ) IF (QT_QMAKE_EXECUTABLE) IF(QT_QMAKE_EXECUTABLE_LAST) STRING(COMPARE NOTEQUAL "${QT_QMAKE_EXECUTABLE_LAST}" "${QT_QMAKE_EXECUTABLE}" QT_QMAKE_CHANGED) ENDIF(QT_QMAKE_EXECUTABLE_LAST) SET(QT_QMAKE_EXECUTABLE_LAST "${QT_QMAKE_EXECUTABLE}" CACHE INTERNAL "" FORCE) SET(QT4_QMAKE_FOUND FALSE) _qt4_query_qmake(QT_VERSION QTVERSION) # check for qt3 qmake and then try and find qmake4 or qmake-qt4 in the path IF(NOT QTVERSION) SET(QT_QMAKE_EXECUTABLE NOTFOUND CACHE FILEPATH "" FORCE) FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake4 qmake-qt4 PATHS "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin" $ENV{QTDIR}/bin DOC "The qmake executable for the Qt installation to use" ) IF(QT_QMAKE_EXECUTABLE) _qt4_query_qmake(QT_VERSION QTVERSION) ENDIF(QT_QMAKE_EXECUTABLE) ENDIF(NOT QTVERSION) # check that we found the Qt4 qmake, Qt3 qmake output won't match here STRING(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" qt_version_tmp "${QTVERSION}") IF (qt_version_tmp) # we need at least version 4.0.0 IF (NOT QT_MIN_VERSION) SET(QT_MIN_VERSION "4.0.0") ENDIF (NOT QT_MIN_VERSION) #now parse the parts of the user given version string into variables STRING(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" req_qt_major_vers "${QT_MIN_VERSION}") IF (NOT req_qt_major_vers) MESSAGE( FATAL_ERROR "Invalid Qt version string given: \"${QT_MIN_VERSION}\", expected e.g. \"4.0.1\"") ENDIF (NOT req_qt_major_vers) # now parse the parts of the user given version string into variables STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" req_qt_major_vers "${QT_MIN_VERSION}") STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" req_qt_minor_vers "${QT_MIN_VERSION}") STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" req_qt_patch_vers "${QT_MIN_VERSION}") # Suppport finding at least a particular version, for instance FIND_PACKAGE( Qt4 4.4.3 ) # This implementation is a hack to avoid duplicating code and make sure we stay # source-compatible with CMake 2.6.x IF( Qt4_FIND_VERSION ) SET( QT_MIN_VERSION ${Qt4_FIND_VERSION} ) SET( req_qt_major_vers ${Qt4_FIND_VERSION_MAJOR} ) SET( req_qt_minor_vers ${Qt4_FIND_VERSION_MINOR} ) SET( req_qt_patch_vers ${Qt4_FIND_VERSION_PATCH} ) ENDIF( Qt4_FIND_VERSION ) IF (NOT req_qt_major_vers EQUAL 4) MESSAGE( FATAL_ERROR "Invalid Qt version string given: \"${QT_MIN_VERSION}\", major version 4 is required, e.g. \"4.0.1\"") ENDIF (NOT req_qt_major_vers EQUAL 4) # and now the version string given by qmake STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" QT_VERSION_MAJOR "${QTVERSION}") STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+.*" "\\1" QT_VERSION_MINOR "${QTVERSION}") STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" QT_VERSION_PATCH "${QTVERSION}") # compute an overall version number which can be compared at once MATH(EXPR req_vers "${req_qt_major_vers}*10000 + ${req_qt_minor_vers}*100 + ${req_qt_patch_vers}") MATH(EXPR found_vers "${QT_VERSION_MAJOR}*10000 + ${QT_VERSION_MINOR}*100 + ${QT_VERSION_PATCH}") # Support finding *exactly* a particular version, for instance FIND_PACKAGE( Qt4 4.4.3 EXACT ) IF( Qt4_FIND_VERSION_EXACT ) IF(found_vers EQUAL req_vers) SET( QT4_QMAKE_FOUND TRUE ) ELSE(found_vers EQUAL req_vers) SET( QT4_QMAKE_FOUND FALSE ) IF (found_vers LESS req_vers) SET(QT4_INSTALLED_VERSION_TOO_OLD TRUE) ELSE (found_vers LESS req_vers) SET(QT4_INSTALLED_VERSION_TOO_NEW TRUE) ENDIF (found_vers LESS req_vers) ENDIF(found_vers EQUAL req_vers) ELSE( Qt4_FIND_VERSION_EXACT ) IF (found_vers LESS req_vers) SET(QT4_QMAKE_FOUND FALSE) SET(QT4_INSTALLED_VERSION_TOO_OLD TRUE) ELSE (found_vers LESS req_vers) SET(QT4_QMAKE_FOUND TRUE) ENDIF (found_vers LESS req_vers) ENDIF( Qt4_FIND_VERSION_EXACT ) ENDIF (qt_version_tmp) ENDIF (QT_QMAKE_EXECUTABLE) IF (QT4_QMAKE_FOUND) if (WIN32) # get qt install dir get_filename_component(_DIR ${QT_QMAKE_EXECUTABLE} PATH ) get_filename_component(QT_INSTALL_DIR ${_DIR} PATH ) endif (WIN32) # ask qmake for the library dir # Set QT_LIBRARY_DIR IF (NOT QT_LIBRARY_DIR OR QT_QMAKE_CHANGED) _qt4_query_qmake(QT_INSTALL_LIBS QT_LIBRARY_DIR_TMP) IF(EXISTS "${QT_LIBRARY_DIR_TMP}") SET(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE PATH "Qt library dir" FORCE) ELSE(EXISTS "${QT_LIBRARY_DIR_TMP}") MESSAGE("Warning: QT_QMAKE_EXECUTABLE reported QT_INSTALL_LIBS as ${QT_LIBRARY_DIR_TMP}") MESSAGE("Warning: ${QT_LIBRARY_DIR_TMP} does NOT exist, Qt must NOT be installed correctly.") ENDIF(EXISTS "${QT_LIBRARY_DIR_TMP}") ENDIF(NOT QT_LIBRARY_DIR OR QT_QMAKE_CHANGED) IF (APPLE) IF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) SET(QT_USE_FRAMEWORKS ON CACHE BOOL "Set to ON if Qt build uses frameworks." FORCE) ELSE (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) SET(QT_USE_FRAMEWORKS OFF CACHE BOOL "Set to ON if Qt build uses frameworks." FORCE) ENDIF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) MARK_AS_ADVANCED(QT_USE_FRAMEWORKS) ENDIF (APPLE) # ask qmake for the binary dir IF (QT_LIBRARY_DIR AND NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED) _qt4_query_qmake(QT_INSTALL_BINS qt_bins) SET(QT_BINARY_DIR ${qt_bins} CACHE INTERNAL "" FORCE) ENDIF (QT_LIBRARY_DIR AND NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED) # ask qmake for the include dir IF (QT_LIBRARY_DIR AND NOT QT_HEADERS_DIR OR QT_QMAKE_CHANGED) _qt4_query_qmake(QT_INSTALL_HEADERS qt_headers) SET(QT_HEADERS_DIR ${qt_headers} CACHE INTERNAL "" FORCE) ENDIF (QT_LIBRARY_DIR AND NOT QT_HEADERS_DIR OR QT_QMAKE_CHANGED) # ask qmake for the documentation directory IF (QT_LIBRARY_DIR AND NOT QT_DOC_DIR OR QT_QMAKE_CHANGED) _qt4_query_qmake(QT_INSTALL_DOCS qt_doc_dir) SET(QT_DOC_DIR ${qt_doc_dir} CACHE PATH "The location of the Qt docs" FORCE) ENDIF (QT_LIBRARY_DIR AND NOT QT_DOC_DIR OR QT_QMAKE_CHANGED) # ask qmake for the mkspecs directory IF (QT_LIBRARY_DIR AND NOT QT_MKSPECS_DIR OR QT_QMAKE_CHANGED) _qt4_query_qmake(QMAKE_MKSPECS qt_mkspecs_dirs) # do not replace : on windows as it might be a drive letter # and windows should already use ; as a separator IF(UNIX) STRING(REPLACE ":" ";" qt_mkspecs_dirs "${qt_mkspecs_dirs}") ENDIF(UNIX) SET(QT_MKSPECS_DIR NOTFOUND) FIND_PATH(QT_MKSPECS_DIR qconfig.pri PATHS ${qt_mkspecs_dirs} DOC "The location of the Qt mkspecs containing qconfig.pri" NO_DEFAULT_PATH ) ENDIF (QT_LIBRARY_DIR AND NOT QT_MKSPECS_DIR OR QT_QMAKE_CHANGED) # ask qmake for the plugins directory IF (QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR OR QT_QMAKE_CHANGED) _qt4_query_qmake(QT_INSTALL_PLUGINS qt_plugins_dir) SET(QT_PLUGINS_DIR ${qt_plugins_dir} CACHE PATH "The location of the Qt plugins" FORCE) ENDIF (QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR OR QT_QMAKE_CHANGED) # ask qmake for the translations directory IF (QT_LIBRARY_DIR AND NOT QT_TRANSLATIONS_DIR OR QT_QMAKE_CHANGED) _qt4_query_qmake(QT_INSTALL_TRANSLATIONS qt_translations_dir) SET(QT_TRANSLATIONS_DIR ${qt_translations_dir} CACHE PATH "The location of the Qt translations" FORCE) ENDIF (QT_LIBRARY_DIR AND NOT QT_TRANSLATIONS_DIR OR QT_QMAKE_CHANGED) # ask qmake for the imports directory IF (QT_LIBRARY_DIR AND NOT QT_IMPORTS_DIR OR QT_QMAKE_CHANGED) _qt4_query_qmake(QT_INSTALL_IMPORTS qt_imports_dir) if(qt_imports_dir) SET(QT_IMPORTS_DIR NOTFOUND) foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH}) set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/imports") endforeach(qt_cross_path) FIND_PATH(QT_IMPORTS_DIR NAMES Qt HINTS ${qt_cross_paths} ${qt_imports_dir} DOC "The location of the Qt imports" NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) mark_as_advanced(QT_IMPORTS_DIR) endif() ENDIF (QT_LIBRARY_DIR AND NOT QT_IMPORTS_DIR OR QT_QMAKE_CHANGED) # Make variables changeble to the advanced user MARK_AS_ADVANCED( QT_LIBRARY_DIR QT_DOC_DIR QT_MKSPECS_DIR QT_PLUGINS_DIR QT_TRANSLATIONS_DIR) ############################################# # # Find out what window system we're using # ############################################# # Save required includes and required_flags variables MACRO_PUSH_REQUIRED_VARS() # Add QT_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES SET(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${QT_HEADERS_DIR}") # On Mac OS X when Qt has framework support, also add the framework path IF( QT_USE_FRAMEWORKS ) SET(CMAKE_REQUIRED_FLAGS "-F${QT_LIBRARY_DIR} ") ENDIF( QT_USE_FRAMEWORKS ) # Check for Window system symbols (note: only one should end up being set) CHECK_SYMBOL_EXISTS(Q_WS_X11 "QtCore/qglobal.h" Q_WS_X11) CHECK_SYMBOL_EXISTS(Q_WS_WIN "QtCore/qglobal.h" Q_WS_WIN) CHECK_SYMBOL_EXISTS(Q_WS_QWS "QtCore/qglobal.h" Q_WS_QWS) CHECK_SYMBOL_EXISTS(Q_WS_MAC "QtCore/qglobal.h" Q_WS_MAC) IF(Q_WS_MAC) IF(QT_QMAKE_CHANGED) UNSET(QT_MAC_USE_COCOA CACHE) ENDIF(QT_QMAKE_CHANGED) CHECK_SYMBOL_EXISTS(QT_MAC_USE_COCOA "QtCore/qconfig.h" QT_MAC_USE_COCOA) ENDIF(Q_WS_MAC) IF (QT_QTCOPY_REQUIRED) CHECK_SYMBOL_EXISTS(QT_IS_QTCOPY "QtCore/qglobal.h" QT_KDE_QT_COPY) IF (NOT QT_IS_QTCOPY) MESSAGE(FATAL_ERROR "qt-copy is required, but hasn't been found") ENDIF (NOT QT_IS_QTCOPY) ENDIF (QT_QTCOPY_REQUIRED) # Restore CMAKE_REQUIRED_INCLUDES+CMAKE_REQUIRED_FLAGS variables MACRO_POP_REQUIRED_VARS() # ############################################# ######################################## # # Setting the INCLUDE-Variables # ######################################## SET(QT_MODULES QtCore QtGui Qt3Support QtSvg QtScript QtTest QtUiTools QtHelp QtWebKit QtXmlPatterns QtNetwork QtMultimedia QtNsPlugin QtOpenGL QtSql QtXml QtDesigner QtDBus QtScriptTools QtDeclarative) IF(Q_WS_X11) SET(QT_MODULES ${QT_MODULES} QtMotif) ENDIF(Q_WS_X11) IF(QT_QMAKE_CHANGED) FOREACH(QT_MODULE ${QT_MODULES}) STRING(TOUPPER ${QT_MODULE} _upper_qt_module) SET(QT_${_upper_qt_module}_INCLUDE_DIR NOTFOUND) SET(QT_${_upper_qt_module}_LIBRARY_RELEASE NOTFOUND) SET(QT_${_upper_qt_module}_LIBRARY_DEBUG NOTFOUND) ENDFOREACH(QT_MODULE) SET(QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR NOTFOUND) SET(QT_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE NOTFOUND) SET(QT_QTDESIGNERCOMPONENTS_LIBRARY_DEBUG NOTFOUND) SET(QT_QTASSISTANTCLIENT_INCLUDE_DIR NOTFOUND) SET(QT_QTASSISTANTCLIENT_LIBRARY_RELEASE NOTFOUND) SET(QT_QTASSISTANTCLIENT_LIBRARY_DEBUG NOTFOUND) SET(QT_QTASSISTANT_INCLUDE_DIR NOTFOUND) SET(QT_QTASSISTANT_LIBRARY_RELEASE NOTFOUND) SET(QT_QTASSISTANT_LIBRARY_DEBUG NOTFOUND) SET(QT_QTCLUCENE_LIBRARY_RELEASE NOTFOUND) SET(QT_QTCLUCENE_LIBRARY_DEBUG NOTFOUND) SET(QT_QAXCONTAINER_INCLUDE_DIR NOTFOUND) SET(QT_QAXCONTAINER_LIBRARY_RELEASE NOTFOUND) SET(QT_QAXCONTAINER_LIBRARY_DEBUG NOTFOUND) SET(QT_QAXSERVER_INCLUDE_DIR NOTFOUND) SET(QT_QAXSERVER_LIBRARY_RELEASE NOTFOUND) SET(QT_QAXSERVER_LIBRARY_DEBUG NOTFOUND) IF(WIN32) SET(QT_QTMAIN_LIBRARY_DEBUG NOTFOUND) SET(QT_QTMAIN_LIBRARY_RELEASE NOTFOUND) ENDIF(WIN32) SET(QT_PHONON_INCLUDE_DIR NOTFOUND) ENDIF(QT_QMAKE_CHANGED) FOREACH(QT_MODULE ${QT_MODULES}) STRING(TOUPPER ${QT_MODULE} _upper_qt_module) FIND_PATH(QT_${_upper_qt_module}_INCLUDE_DIR ${QT_MODULE} PATHS ${QT_HEADERS_DIR}/${QT_MODULE} ${QT_LIBRARY_DIR}/${QT_MODULE}.framework/Headers NO_DEFAULT_PATH ) ENDFOREACH(QT_MODULE) IF(WIN32) SET(QT_MODULES ${QT_MODULES} QAxContainer QAxServer) # Set QT_AXCONTAINER_INCLUDE_DIR and QT_AXSERVER_INCLUDE_DIR FIND_PATH(QT_QAXCONTAINER_INCLUDE_DIR ActiveQt PATHS ${QT_HEADERS_DIR}/ActiveQt NO_DEFAULT_PATH ) FIND_PATH(QT_QAXSERVER_INCLUDE_DIR ActiveQt PATHS ${QT_HEADERS_DIR}/ActiveQt NO_DEFAULT_PATH ) ENDIF(WIN32) # Set QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR FIND_PATH(QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR QDesignerComponents PATHS ${QT_HEADERS_DIR}/QtDesigner ${QT_LIBRARY_DIR}/QtDesigner.framework/Headers NO_DEFAULT_PATH ) # Set QT_QTASSISTANT_INCLUDE_DIR FIND_PATH(QT_QTASSISTANT_INCLUDE_DIR QtAssistant PATHS ${QT_HEADERS_DIR}/QtAssistant ${QT_LIBRARY_DIR}/QtAssistant.framework/Headers NO_DEFAULT_PATH ) # Set QT_QTASSISTANTCLIENT_INCLUDE_DIR FIND_PATH(QT_QTASSISTANTCLIENT_INCLUDE_DIR QAssistantClient PATHS ${QT_HEADERS_DIR}/QtAssistant ${QT_LIBRARY_DIR}/QtAssistant.framework/Headers NO_DEFAULT_PATH ) # Set QT_QT_INCLUDE_DIR FIND_PATH(QT_QT_INCLUDE_DIR qglobal.h PATHS ${QT_HEADERS_DIR}/Qt ${QT_LIBRARY_DIR}/QtCore.framework/Headers NO_DEFAULT_PATH ) # Set QT_PHONON_INCLUDE_DIR # Qt >= 4.5.3 (or kde-qt-4.5.2 which has the fix too) : Phonon/ClassName is inside include/phonon # With previous versions of Qt, this could not work; upgrade Qt or use a standalone phonon FIND_PATH(QT_PHONON_INCLUDE_DIR Phonon PATHS ${QT_HEADERS_DIR}/phonon NO_DEFAULT_PATH ) SET(QT_MODULES ${QT_MODULES} phonon) # Set QT_INCLUDE_DIR by removine "/QtCore" in the string ${QT_QTCORE_INCLUDE_DIR} IF( QT_QTCORE_INCLUDE_DIR AND NOT QT_INCLUDE_DIR) IF (QT_USE_FRAMEWORKS) SET(QT_INCLUDE_DIR ${QT_HEADERS_DIR}) ELSE (QT_USE_FRAMEWORKS) STRING( REGEX REPLACE "/QtCore$" "" qt4_include_dir ${QT_QTCORE_INCLUDE_DIR}) SET( QT_INCLUDE_DIR ${qt4_include_dir} CACHE PATH "") ENDIF (QT_USE_FRAMEWORKS) ENDIF( QT_QTCORE_INCLUDE_DIR AND NOT QT_INCLUDE_DIR) IF( NOT QT_INCLUDE_DIR) IF(Qt4_FIND_REQUIRED) MESSAGE( FATAL_ERROR "Could NOT find QtCore header") ENDIF(Qt4_FIND_REQUIRED) ENDIF( NOT QT_INCLUDE_DIR) # Make variables changeble to the advanced user MARK_AS_ADVANCED( QT_INCLUDE_DIR QT_QT_INCLUDE_DIR) # Set QT_INCLUDES SET( QT_INCLUDES ${QT_QT_INCLUDE_DIR} ${QT_MKSPECS_DIR}/default ${QT_INCLUDE_DIR} ) ####################################### # # Qt configuration # ####################################### IF(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri") FILE(READ ${QT_MKSPECS_DIR}/qconfig.pri _qconfig_FILE_contents) STRING(REGEX MATCH "QT_CONFIG[^\n]+" QT_QCONFIG "${_qconfig_FILE_contents}") STRING(REGEX MATCH "CONFIG[^\n]+" QT_CONFIG "${_qconfig_FILE_contents}") STRING(REGEX MATCH "EDITION[^\n]+" QT_EDITION "${_qconfig_FILE_contents}") STRING(REGEX MATCH "QT_LIBINFIX[^\n]+" _qconfig_qt_libinfix "${_qconfig_FILE_contents}") STRING(REGEX REPLACE "QT_LIBINFIX *= *([^\n]*)" "\\1" QT_LIBINFIX "${_qconfig_qt_libinfix}") ENDIF(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri") IF("${QT_EDITION}" MATCHES "DesktopLight") SET(QT_EDITION_DESKTOPLIGHT 1) ENDIF("${QT_EDITION}" MATCHES "DesktopLight") ######################################## # # Setting the LIBRARY-Variables # ######################################## # find the libraries FOREACH(QT_MODULE ${QT_MODULES}) STRING(TOUPPER ${QT_MODULE} _upper_qt_module) FIND_LIBRARY(QT_${_upper_qt_module}_LIBRARY_RELEASE NAMES ${QT_MODULE}${QT_LIBINFIX} ${QT_MODULE}${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH ) FIND_LIBRARY(QT_${_upper_qt_module}_LIBRARY_DEBUG NAMES ${QT_MODULE}${QT_LIBINFIX}_debug ${QT_MODULE}${QT_LIBINFIX}d ${QT_MODULE}${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH ) ENDFOREACH(QT_MODULE) # QtUiTools not with other frameworks with binary installation (in /usr/lib) IF(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTUITOOLS_LIBRARY_RELEASE) FIND_LIBRARY(QT_QTUITOOLS_LIBRARY_RELEASE NAMES QtUiTools${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR}) ENDIF(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTUITOOLS_LIBRARY_RELEASE) IF( NOT QT_QTCORE_LIBRARY_DEBUG AND NOT QT_QTCORE_LIBRARY_RELEASE ) # try dropping a hint if trying to use Visual Studio with Qt built by mingw IF(QT_LIBRARY_DIR AND MSVC) IF(EXISTS ${QT_LIBRARY_DIR}/libqtmain.a) MESSAGE( FATAL_ERROR "It appears you're trying to use Visual Studio with Qt built by mingw") ENDIF(EXISTS ${QT_LIBRARY_DIR}/libqtmain.a) ENDIF(QT_LIBRARY_DIR AND MSVC) IF(Qt4_FIND_REQUIRED) MESSAGE( FATAL_ERROR "Could NOT find QtCore. Check ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log for more details.") ENDIF(Qt4_FIND_REQUIRED) ENDIF( NOT QT_QTCORE_LIBRARY_DEBUG AND NOT QT_QTCORE_LIBRARY_RELEASE ) # Set QT_QTDESIGNERCOMPONENTS_LIBRARY FIND_LIBRARY(QT_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE NAMES QtDesignerComponents${QT_LIBINFIX} QtDesignerComponents${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) FIND_LIBRARY(QT_QTDESIGNERCOMPONENTS_LIBRARY_DEBUG NAMES QtDesignerComponents${QT_LIBINFIX}_debug QtDesignerComponents${QT_LIBINFIX}d QtDesignerComponents${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) # Set QT_QTMAIN_LIBRARY IF(WIN32) FIND_LIBRARY(QT_QTMAIN_LIBRARY_RELEASE NAMES qtmain${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) FIND_LIBRARY(QT_QTMAIN_LIBRARY_DEBUG NAMES qtmain${QT_LIBINFIX}d PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) ENDIF(WIN32) # Set QT_QTASSISTANTCLIENT_LIBRARY FIND_LIBRARY(QT_QTASSISTANTCLIENT_LIBRARY_RELEASE NAMES QtAssistantClient${QT_LIBINFIX} QtAssistantClient${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) FIND_LIBRARY(QT_QTASSISTANTCLIENT_LIBRARY_DEBUG NAMES QtAssistantClient${QT_LIBINFIX}_debug QtAssistantClient${QT_LIBINFIX}d QtAssistantClient${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) # Set QT_QTASSISTANT_LIBRARY FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_RELEASE NAMES QtAssistantClient${QT_LIBINFIX} QtAssistantClient${QT_LIBINFIX}4 QtAssistant${QT_LIBINFIX} QtAssistant${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_DEBUG NAMES QtAssistantClient${QT_LIBINFIX}_debug QtAssistantClient${QT_LIBINFIX}d QtAssistantClient${QT_LIBINFIX}d4 QtAssistant${QT_LIBINFIX}_debug QtAssistant${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) # Set QT_QTHELP_LIBRARY FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene${QT_LIBINFIX} QtCLucene${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_DEBUG NAMES QtCLucene${QT_LIBINFIX}_debug QtCLucene${QT_LIBINFIX}d QtCLucene${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) # QtCLucene not with other frameworks with binary installation (in /usr/lib) IF(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCLUCENE_LIBRARY_RELEASE) FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR}) ENDIF(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCLUCENE_LIBRARY_RELEASE) ############################################ # # Check the existence of the libraries. # ############################################ # On OSX when Qt is found as framework, never use the imported targets for now, since # in this case the handling of the framework directory currently does not work correctly. IF(QT_USE_FRAMEWORKS) SET(QT_USE_IMPORTED_TARGETS FALSE) ENDIF(QT_USE_FRAMEWORKS) MACRO (_QT4_ADJUST_LIB_VARS _camelCaseBasename) STRING(TOUPPER "${_camelCaseBasename}" basename) # The name of the imported targets, i.e. the prefix "Qt4::" must not change, # since it is stored in EXPORT-files as name of a required library. If the name would change # here, this would lead to the imported Qt4-library targets not being resolved by cmake anymore. IF (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG) IF(NOT TARGET Qt4::${_camelCaseBasename}) ADD_LIBRARY(Qt4::${_camelCaseBasename} UNKNOWN IMPORTED ) IF (QT_${basename}_LIBRARY_RELEASE) SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_RELEASE "${QT_${basename}_LIBRARY_RELEASE}" ) ENDIF (QT_${basename}_LIBRARY_RELEASE) IF (QT_${basename}_LIBRARY_DEBUG) SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}" ) ENDIF (QT_${basename}_LIBRARY_DEBUG) ENDIF(NOT TARGET Qt4::${_camelCaseBasename}) # If QT_USE_IMPORTED_TARGETS is enabled, the QT_QTFOO_LIBRARY variables are set to point at these # imported targets. This works better in general, and is also in almost all cases fully # backward compatible. The only issue is when a project A which had this enabled then exports its # libraries via export or EXPORT_LIBRARY_DEPENDENCIES(). In this case the libraries from project # A will depend on the imported Qt targets, and the names of these imported targets will be stored # in the dependency files on disk. This means when a project B then uses project A, these imported # targets must be created again, otherwise e.g. "Qt4__QtCore" will be interpreted as name of a # library file on disk, and not as a target, and linking will fail: IF(QT_USE_IMPORTED_TARGETS) SET(QT_${basename}_LIBRARY Qt4::${_camelCaseBasename} ) SET(QT_${basename}_LIBRARIES Qt4::${_camelCaseBasename} ) ELSE(QT_USE_IMPORTED_TARGETS) # if the release- as well as the debug-version of the library have been found: IF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE) # if the generator supports configuration types then set # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) SET(QT_${basename}_LIBRARY optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG}) ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) # if there are no configuration types and CMAKE_BUILD_TYPE has no value # then just use the release libraries SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE} ) ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) SET(QT_${basename}_LIBRARIES optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG}) ENDIF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE) # if only the release version was found, set the debug variable also to the release version IF (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG) SET(QT_${basename}_LIBRARY_DEBUG ${QT_${basename}_LIBRARY_RELEASE}) SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE}) SET(QT_${basename}_LIBRARIES ${QT_${basename}_LIBRARY_RELEASE}) ENDIF (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG) # if only the debug version was found, set the release variable also to the debug version IF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE) SET(QT_${basename}_LIBRARY_RELEASE ${QT_${basename}_LIBRARY_DEBUG}) SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_DEBUG}) SET(QT_${basename}_LIBRARIES ${QT_${basename}_LIBRARY_DEBUG}) ENDIF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE) # put the value in the cache: SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY} CACHE STRING "The Qt ${basename} library" FORCE) ENDIF(QT_USE_IMPORTED_TARGETS) # message(STATUS "QT_${basename}_LIBRARY: ${QT_${basename}_LIBRARY}") SET(QT_${basename}_FOUND 1) ENDIF (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG) IF (QT_${basename}_INCLUDE_DIR) #add the include directory to QT_INCLUDES SET(QT_INCLUDES "${QT_${basename}_INCLUDE_DIR}" ${QT_INCLUDES}) ENDIF (QT_${basename}_INCLUDE_DIR) # Make variables changeble to the advanced user MARK_AS_ADVANCED(QT_${basename}_LIBRARY QT_${basename}_LIBRARY_RELEASE QT_${basename}_LIBRARY_DEBUG QT_${basename}_INCLUDE_DIR) ENDMACRO (_QT4_ADJUST_LIB_VARS) # Set QT_xyz_LIBRARY variable and add # library include path to QT_INCLUDES _QT4_ADJUST_LIB_VARS(QtCore) _QT4_ADJUST_LIB_VARS(QtGui) _QT4_ADJUST_LIB_VARS(Qt3Support) _QT4_ADJUST_LIB_VARS(QtAssistant) _QT4_ADJUST_LIB_VARS(QtAssistantClient) _QT4_ADJUST_LIB_VARS(QtCLucene) _QT4_ADJUST_LIB_VARS(QtDBus) _QT4_ADJUST_LIB_VARS(QtDeclarative) _QT4_ADJUST_LIB_VARS(QtDesigner) _QT4_ADJUST_LIB_VARS(QtDesignerComponents) _QT4_ADJUST_LIB_VARS(QtHelp) _QT4_ADJUST_LIB_VARS(QtMultimedia) _QT4_ADJUST_LIB_VARS(QtNetwork) _QT4_ADJUST_LIB_VARS(QtNsPlugin) _QT4_ADJUST_LIB_VARS(QtOpenGL) _QT4_ADJUST_LIB_VARS(QtScript) _QT4_ADJUST_LIB_VARS(QtScriptTools) _QT4_ADJUST_LIB_VARS(QtSql) _QT4_ADJUST_LIB_VARS(QtSvg) _QT4_ADJUST_LIB_VARS(QtTest) _QT4_ADJUST_LIB_VARS(QtUiTools) _QT4_ADJUST_LIB_VARS(QtWebKit) _QT4_ADJUST_LIB_VARS(QtXml) _QT4_ADJUST_LIB_VARS(QtXmlPatterns) _QT4_ADJUST_LIB_VARS(phonon) # platform dependent libraries IF(Q_WS_X11) _QT4_ADJUST_LIB_VARS(QtMotif) ENDIF(Q_WS_X11) IF(WIN32) _QT4_ADJUST_LIB_VARS(qtmain) _QT4_ADJUST_LIB_VARS(QAxServer) _QT4_ADJUST_LIB_VARS(QAxContainer) ENDIF(WIN32) # If Qt is installed as a framework, we need to add QT_QTCORE_LIBRARY here (which # is the framework directory in that case), since this will make the cmake include_directories() # command recognize that we need the framework flag with the respective directory (-F) IF(QT_USE_FRAMEWORKS) SET(QT_INCLUDES ${QT_INCLUDES} ${QT_QTCORE_LIBRARY} ) SET(QT_INCLUDE_DIR ${QT_INCLUDE_DIR} ${QT_QTCORE_LIBRARY} ) ENDIF(QT_USE_FRAMEWORKS) ####################################### # # Check the executables of Qt # ( moc, uic, rcc ) # ####################################### IF(QT_QMAKE_CHANGED) SET(QT_UIC_EXECUTABLE NOTFOUND) SET(QT_MOC_EXECUTABLE NOTFOUND) SET(QT_UIC3_EXECUTABLE NOTFOUND) SET(QT_RCC_EXECUTABLE NOTFOUND) SET(QT_DBUSCPP2XML_EXECUTABLE NOTFOUND) SET(QT_DBUSXML2CPP_EXECUTABLE NOTFOUND) SET(QT_LUPDATE_EXECUTABLE NOTFOUND) SET(QT_LRELEASE_EXECUTABLE NOTFOUND) SET(QT_QCOLLECTIONGENERATOR_EXECUTABLE NOTFOUND) SET(QT_DESIGNER_EXECUTABLE NOTFOUND) SET(QT_LINGUIST_EXECUTABLE NOTFOUND) ENDIF(QT_QMAKE_CHANGED) FIND_PROGRAM(QT_MOC_EXECUTABLE NAMES moc-qt4 moc PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH ) FIND_PROGRAM(QT_UIC_EXECUTABLE NAMES uic-qt4 uic PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH ) FIND_PROGRAM(QT_UIC3_EXECUTABLE NAMES uic3 PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH ) FIND_PROGRAM(QT_RCC_EXECUTABLE NAMES rcc PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH ) if(NOT WINCE) FIND_PROGRAM(QT_DBUSCPP2XML_EXECUTABLE NAMES qdbuscpp2xml PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH ) FIND_PROGRAM(QT_DBUSXML2CPP_EXECUTABLE NAMES qdbusxml2cpp PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH ) else() FIND_PROGRAM(QT_DBUSCPP2XML_EXECUTABLE NAMES qdbuscpp2xml PATHS ${HOST_BINDIR} NO_DEFAULT_PATH ) FIND_PROGRAM(QT_DBUSXML2CPP_EXECUTABLE NAMES qdbusxml2cpp PATHS ${HOST_BINDIR} NO_DEFAULT_PATH ) endif() FIND_PROGRAM(QT_LUPDATE_EXECUTABLE NAMES lupdate-qt4 lupdate PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH ) FIND_PROGRAM(QT_LRELEASE_EXECUTABLE NAMES lrelease-qt4 lrelease PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH ) FIND_PROGRAM(QT_QCOLLECTIONGENERATOR_EXECUTABLE NAMES qcollectiongenerator-qt4 qcollectiongenerator PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH ) FIND_PROGRAM(QT_DESIGNER_EXECUTABLE NAMES designer-qt4 designer PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH ) FIND_PROGRAM(QT_LINGUIST_EXECUTABLE NAMES linguist-qt4 linguist PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH ) IF (QT_MOC_EXECUTABLE) SET(QT_WRAP_CPP "YES") ENDIF (QT_MOC_EXECUTABLE) IF (QT_UIC_EXECUTABLE) SET(QT_WRAP_UI "YES") ENDIF (QT_UIC_EXECUTABLE) MARK_AS_ADVANCED( QT_UIC_EXECUTABLE QT_UIC3_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE QT_DBUSXML2CPP_EXECUTABLE QT_DBUSCPP2XML_EXECUTABLE QT_LUPDATE_EXECUTABLE QT_LRELEASE_EXECUTABLE QT_QCOLLECTIONGENERATOR_EXECUTABLE QT_DESIGNER_EXECUTABLE QT_LINGUIST_EXECUTABLE) # get the directory of the current file, used later on in the file GET_FILENAME_COMPONENT( _qt4_current_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) ###################################### # # Macros for building Qt files # ###################################### INCLUDE("${_qt4_current_dir}/Qt4Macros.cmake") ###################################### # # decide if Qt got found # ###################################### # if the includes,libraries,moc,uic and rcc are found then we have it IF( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE AND QT_QTCORE_LIBRARY) SET( QT4_FOUND "YES" ) IF( NOT Qt4_FIND_QUIETLY) MESSAGE(STATUS "Found Qt-Version ${QTVERSION} (using ${QT_QMAKE_EXECUTABLE})") ENDIF( NOT Qt4_FIND_QUIETLY) ELSE( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE AND QT_QTCORE_LIBRARY) SET( QT4_FOUND "NO") SET(QT_QMAKE_EXECUTABLE "${QT_QMAKE_EXECUTABLE}-NOTFOUND" CACHE FILEPATH "Invalid qmake found" FORCE) IF( Qt4_FIND_REQUIRED) IF ( NOT QT_LIBRARY_DIR ) MESSAGE(STATUS "Qt libraries NOT found!") ENDIF(NOT QT_LIBRARY_DIR ) IF ( NOT QT_INCLUDE_DIR ) MESSAGE(STATUS "Qt includes NOT found!") ENDIF( NOT QT_INCLUDE_DIR ) IF ( NOT QT_MOC_EXECUTABLE ) MESSAGE(STATUS "Qt's moc NOT found!") ENDIF( NOT QT_MOC_EXECUTABLE ) IF ( NOT QT_UIC_EXECUTABLE ) MESSAGE(STATUS "Qt's uic NOT found!") ENDIF( NOT QT_UIC_EXECUTABLE ) IF ( NOT QT_RCC_EXECUTABLE ) MESSAGE(STATUS "Qt's rcc NOT found!") ENDIF( NOT QT_RCC_EXECUTABLE ) MESSAGE( FATAL_ERROR "Qt libraries, includes, moc, uic or/and rcc NOT found!") ENDIF( Qt4_FIND_REQUIRED) ENDIF( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE AND QT_QTCORE_LIBRARY) SET(QT_FOUND ${QT4_FOUND}) ############################################### # # configuration/system dependent settings # ############################################### INCLUDE("${_qt4_current_dir}/Qt4ConfigDependentSettings.cmake") ####################################### # # compatibility settings # ####################################### # Backwards compatibility for CMake1.4 and 1.2 SET (QT_MOC_EXE ${QT_MOC_EXECUTABLE} ) SET (QT_UIC_EXE ${QT_UIC_EXECUTABLE} ) SET( QT_QT_LIBRARY "") ELSE(QT4_QMAKE_FOUND) SET(QT_QMAKE_EXECUTABLE "${QT_QMAKE_EXECUTABLE}-NOTFOUND" CACHE FILEPATH "Invalid qmake found" FORCE) # The code below is overly complex to make sure we do not break compatibility with CMake 2.6.x # For CMake 2.8, it should be simplified by getting rid of QT4_INSTALLED_VERSION_TOO_OLD and # QT4_INSTALLED_VERSION_TOO_NEW IF(Qt4_FIND_REQUIRED) IF(QT4_INSTALLED_VERSION_TOO_OLD) IF( Qt4_FIND_VERSION_EXACT ) MESSAGE(FATAL_ERROR "The installed Qt version ${QTVERSION} is too old, version ${QT_MIN_VERSION} is required") ELSE( Qt4_FIND_VERSION_EXACT ) MESSAGE(FATAL_ERROR "The installed Qt version ${QTVERSION} is too old, at least version ${QT_MIN_VERSION} is required") ENDIF( Qt4_FIND_VERSION_EXACT ) ELSE(QT4_INSTALLED_VERSION_TOO_OLD) IF( Qt4_FIND_VERSION_EXACT AND QT4_INSTALLED_VERSION_TOO_NEW ) MESSAGE(FATAL_ERROR "The installed Qt version ${QTVERSION} is too new, version ${QT_MIN_VERSION} is required") ELSE( Qt4_FIND_VERSION_EXACT AND QT4_INSTALLED_VERSION_TOO_NEW ) MESSAGE( FATAL_ERROR "Qt qmake not found!") ENDIF( Qt4_FIND_VERSION_EXACT AND QT4_INSTALLED_VERSION_TOO_NEW ) ENDIF(QT4_INSTALLED_VERSION_TOO_OLD) ELSE(Qt4_FIND_REQUIRED) IF(QT4_INSTALLED_VERSION_TOO_OLD AND NOT Qt4_FIND_QUIETLY) MESSAGE(STATUS "The installed Qt version ${QTVERSION} is too old, at least version ${QT_MIN_VERSION} is required") ENDIF(QT4_INSTALLED_VERSION_TOO_OLD AND NOT Qt4_FIND_QUIETLY) ENDIF(Qt4_FIND_REQUIRED) ENDIF (QT4_QMAKE_FOUND) diff --git a/attic/modules/FindSIP.cmake b/attic/modules/FindSIP.cmake index 58b95c8..65ba041 100644 --- a/attic/modules/FindSIP.cmake +++ b/attic/modules/FindSIP.cmake @@ -1,60 +1,57 @@ # Find SIP # ~~~~~~~~ # # SIP website: http://www.riverbankcomputing.co.uk/sip/index.php # # Find the installed version of SIP. FindSIP should be called after Python # has been found. # # This file defines the following variables: # # SIP_VERSION - The version of SIP found expressed as a 6 digit hex number # suitable for comparison as a string. # # SIP_VERSION_STR - The version of SIP found as a human readable string. # # SIP_EXECUTABLE - Path and filename of the SIP command line executable. # # SIP_INCLUDE_DIR - Directory holding the SIP C++ header file. # # SIP_DEFAULT_SIP_DIR - Default directory where .sip files should be installed # into. -# Copyright (c) 2007, Simon Edwards -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - - +# SPDX-FileCopyrightText: 2007 Simon Edwards +# SPDX-License-Identifier: BSD-3-Clause IF(SIP_VERSION) # Already in cache, be silent SET(SIP_FOUND TRUE) ELSE(SIP_VERSION) FIND_FILE(_find_sip_py FindSIP.py PATHS ${CMAKE_MODULE_PATH}) EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${_find_sip_py} OUTPUT_VARIABLE sip_config) IF(sip_config) STRING(REGEX REPLACE "^sip_version:([^\n]+).*$" "\\1" SIP_VERSION ${sip_config}) STRING(REGEX REPLACE ".*\nsip_version_str:([^\n]+).*$" "\\1" SIP_VERSION_STR ${sip_config}) STRING(REGEX REPLACE ".*\nsip_bin:([^\n]+).*$" "\\1" SIP_EXECUTABLE ${sip_config}) IF(NOT SIP_DEFAULT_SIP_DIR) STRING(REGEX REPLACE ".*\ndefault_sip_dir:([^\n]+).*$" "\\1" SIP_DEFAULT_SIP_DIR ${sip_config}) ENDIF(NOT SIP_DEFAULT_SIP_DIR) STRING(REGEX REPLACE ".*\nsip_inc_dir:([^\n]+).*$" "\\1" SIP_INCLUDE_DIR ${sip_config}) FILE(TO_CMAKE_PATH ${SIP_DEFAULT_SIP_DIR} SIP_DEFAULT_SIP_DIR) FILE(TO_CMAKE_PATH ${SIP_INCLUDE_DIR} SIP_INCLUDE_DIR) SET(SIP_FOUND TRUE) ENDIF(sip_config) IF(SIP_FOUND) IF(NOT SIP_FIND_QUIETLY) MESSAGE(STATUS "Found SIP version: ${SIP_VERSION_STR}") ENDIF(NOT SIP_FIND_QUIETLY) ELSE(SIP_FOUND) IF(SIP_FIND_REQUIRED) MESSAGE(FATAL_ERROR "Could not find SIP") ENDIF(SIP_FIND_REQUIRED) ENDIF(SIP_FOUND) ENDIF(SIP_VERSION) diff --git a/attic/modules/FindSIP.py b/attic/modules/FindSIP.py index ecb734f..3f6844b 100644 --- a/attic/modules/FindSIP.py +++ b/attic/modules/FindSIP.py @@ -1,15 +1,14 @@ # FindSIP.py # -# Copyright (c) 2007, Simon Edwards -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-FileCopyrightText: 2007 Simon Edwards +# SPDX-License-Identifier: BSD-3-Clause import sys import sipconfig sipcfg = sipconfig.Configuration() print("sip_version:%06.0x" % sipcfg.sip_version) print("sip_version_str:%s" % sipcfg.sip_version_str) print("sip_bin:%s" % sipcfg.sip_bin) print("default_sip_dir:%s" % sipcfg.default_sip_dir) print("sip_inc_dir:%s" % sipcfg.sip_inc_dir) diff --git a/attic/modules/FindSamba.cmake b/attic/modules/FindSamba.cmake index 92746fd..377ef5c 100644 --- a/attic/modules/FindSamba.cmake +++ b/attic/modules/FindSamba.cmake @@ -1,62 +1,61 @@ # - Try to find the samba directory library # Once done this will define # # SAMBA_FOUND - system has SAMBA # SAMBA_INCLUDE_DIR - the SAMBA include directory # SAMBA_LIBRARIES - The libraries needed to use SAMBA # Set SAMBA_REQUIRE_SMBC_SET_CONTEXT to TRUE if you need a version of Samba # which comes with smbc_set_context() -# Copyright (c) 2006, Alexander Neundorf, +# SPDX-FileCopyrightText: 2006 Alexander Neundorf # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-License-Identifier: BSD-3-Clause if(SAMBA_INCLUDE_DIR AND SAMBA_LIBRARIES) # Already in cache, be silent set(Samba_FIND_QUIETLY TRUE) endif() find_path(SAMBA_INCLUDE_DIR NAMES libsmbclient.h ) find_library(SAMBA_LIBRARIES NAMES smbclient ) if(SAMBA_INCLUDE_DIR AND SAMBA_LIBRARIES) set(SAMBA_FOUND TRUE) # check whether libsmbclient has smbc_set_context() include(CheckSymbolExists) include(MacroPushRequiredVars) macro_push_required_vars() set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${SAMBA_LIBRARIES}) set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${SAMBA_INCLUDE_DIR}) check_symbol_exists(smbc_set_context "libsmbclient.h" SAMBA_HAVE_SMBC_SET_CONTEXT) check_symbol_exists(smbc_option_set "libsmbclient.h" SAMBA_HAVE_SMBC_OPTION_SET) macro_pop_required_vars() # fail if smbc_set_context() was required but hasn't been found if (SAMBA_REQUIRE_SMBC_SET_CONTEXT AND NOT SAMBA_HAVE_SMBC_SET_CONTEXT) set(SAMBA_FOUND FALSE) endif (SAMBA_REQUIRE_SMBC_SET_CONTEXT AND NOT SAMBA_HAVE_SMBC_SET_CONTEXT) # fail if smbc_option_set() was required but hasn't been found if (SAMBA_REQUIRE_SMBC_OPTION_SET AND NOT SAMBA_HAVE_SMBC_OPTION_SET) set(SAMBA_FOUND FALSE) endif (SAMBA_REQUIRE_SMBC_OPTION_SET AND NOT SAMBA_HAVE_SMBC_OPTION_SET) - + else() set(SAMBA_FOUND FALSE) set(SAMBA_HAVE_SMBC_SET_CONTEXT FALSE) endif() if(SAMBA_FOUND) if(NOT Samba_FIND_QUIETLY) message(STATUS "Found samba: ${SAMBA_LIBRARIES}") endif() else() if (Samba_FIND_REQUIRED) message(FATAL_ERROR "Could not find Samba library") endif (Samba_FIND_REQUIRED) endif() mark_as_advanced(SAMBA_INCLUDE_DIR SAMBA_LIBRARIES) diff --git a/attic/modules/FindSane.cmake b/attic/modules/FindSane.cmake index 64efa87..5dfdb23 100644 --- a/attic/modules/FindSane.cmake +++ b/attic/modules/FindSane.cmake @@ -1,21 +1,20 @@ # cmake macro to test if we use sane # # SANE_FOUND - system has SANE libs # SANE_INCLUDE_DIR - the SANE include directory # SANE_LIBRARIES - The libraries needed to use SANE -# Copyright (c) 2006, Marcus Hufgard 2006 +# SPDX-FileCopyrightText: 2006 Marcus Hufgard # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-License-Identifier: BSD-3-Clause FIND_PATH(SANE_INCLUDE_DIR sane/sane.h) FIND_LIBRARY(SANE_LIBRARY NAMES sane libsane PATH_SUFFIXES sane ) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Sane DEFAULT_MSG SANE_LIBRARY SANE_INCLUDE_DIR ) MARK_AS_ADVANCED(SANE_INCLUDE_DIR SANE_LIBRARY) diff --git a/attic/modules/FindSqlite.cmake b/attic/modules/FindSqlite.cmake index ed8d4ea..1a78b81 100644 --- a/attic/modules/FindSqlite.cmake +++ b/attic/modules/FindSqlite.cmake @@ -1,50 +1,45 @@ # - Try to find Sqlite # Once done this will define # # SQLITE_FOUND - system has Sqlite # SQLITE_INCLUDE_DIR - the Sqlite include directory # SQLITE_LIBRARIES - Link these to use Sqlite # SQLITE_DEFINITIONS - Compiler switches required for using Sqlite -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. -# - -# Copyright (c) 2008, Gilles Caulier, +# SPDX-FileCopyrightText: 2008 Gilles Caulier # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-License-Identifier: BSD-3-Clause if ( SQLITE_INCLUDE_DIR AND SQLITE_LIBRARIES ) # in cache already SET(Sqlite_FIND_QUIETLY TRUE) endif ( SQLITE_INCLUDE_DIR AND SQLITE_LIBRARIES ) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls if( NOT WIN32 ) find_package(PkgConfig) pkg_check_modules(PC_SQLITE QUIET sqlite3) set(SQLITE_DEFINITIONS ${PC_SQLITE_CFLAGS_OTHER}) endif() find_path(SQLITE_INCLUDE_DIR NAMES sqlite3.h PATHS ${PC_SQLITE_INCLUDEDIR} ${PC_SQLITE_INCLUDE_DIRS} ) find_library(SQLITE_LIBRARIES NAMES sqlite3 PATHS ${PC_SQLITE_LIBDIR} ${PC_SQLITE_LIBRARY_DIRS} ) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Sqlite DEFAULT_MSG SQLITE_INCLUDE_DIR SQLITE_LIBRARIES ) # show the SQLITE_INCLUDE_DIR and SQLITE_LIBRARIES variables only in the advanced view mark_as_advanced(SQLITE_INCLUDE_DIR SQLITE_LIBRARIES ) diff --git a/attic/modules/FindStrigi.cmake b/attic/modules/FindStrigi.cmake index 214894c..1fb2652 100644 --- a/attic/modules/FindStrigi.cmake +++ b/attic/modules/FindStrigi.cmake @@ -1,148 +1,146 @@ # - Try to find Strigi, a fast and small desktop search program (http://strigi.sourceforge.net ) # Once done this will define # # STRIGI_FOUND - system has Strigi # STRIGI_INCLUDE_DIR - the Strigi include directory # STRIGI_STREAMANALYZER_LIBRARY - Link these to use Strigi streamanalyzer # STRIGI_STREAMS_LIBRARY - Link these to use Strigi streams # STRIGI_LINE_ANALYZER_PREFIX - strigi plugin prefix # STRIGI_THROUGH_ANALYZER_PREFIX - strigi plugin prefix -# Copyright (c) 2008, Jos van den Oever, +# SPDX-FileCopyrightText: 2008 Jos van den Oever # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - +# SPDX-License-Identifier: BSD-3-Clause if(NOT STRIGI_MIN_VERSION) set(STRIGI_MIN_VERSION "0.5.9") endif() file(TO_CMAKE_PATH "$ENV{STRIGI_HOME}" strigi_home) set(_Strigi_FIND_QUIETLY ${Strigi_FIND_QUIETLY}) # Try to find and load the StrigiConfig.cmake installed by kdesupport/strigi find_package(Strigi QUIET NO_MODULE PATHS "${strigi_home}/lib/strigi" "${strigi_home}/lib64/strigi") set(Strigi_FIND_QUIETLY ${_Strigi_FIND_QUIETLY}) # If StrigiConfig.cmake (installed by kdesupport/Strigi) has been found -# and it contains all necessary information (since November 16th, 2008), use the information -# included there, otherwise search it in the same way as any non-cmake project. +# and it contains all necessary information (since November 16th, 2008), use the information +# included there, otherwise search it in the same way as any non-cmake project. # This variable is set by StrigiConfig.cmake . Alex if (STRIGI_CONFIG_FOUND_AND_HAS_COMPLETE_INFORMATION) set (_strigiErrorMessage "Couldn't find Strigi streams and streamanalyzer libraries. Set the environment variable STRIGI_HOME (or CMAKE_PREFIX_PATH) to the strigi install dir.") set(STRIGI_VERSION_OK TRUE) if(STRIGI_VERSION VERSION_LESS ${STRIGI_MIN_VERSION}) set(_strigiErrorMessage "Strigi version ${STRIGI_VERSION} found, but at least version ${STRIGI_MIN_VERSION} is required") set(STRIGI_VERSION_OK FALSE) endif() include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(Strigi + find_package_handle_standard_args(Strigi "${_strigiErrorMessage}" STRIGI_STREAMS_LIBRARY STRIGI_STREAMANALYZER_LIBRARY STRIGI_INCLUDE_DIR STRIGI_VERSION_OK) else() # this else() branch is for finding strigi versions before November 16th, 2008. Alex include(FindLibraryWithDebug) include(MacroPushRequiredVars) if (WIN32) file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _program_FILES_DIR) endif() if (NOT WIN32) if(NOT strigi_home) find_package(PkgConfig) if(PKG_CONFIG_EXECUTABLE) pkg_check_modules(STRIGI QUIET libstreamanalyzer>=${STRIGI_MIN_VERSION}) endif() endif() endif() if (NOT STRIGI_INCLUDEDIR) - find_path(STRIGI_INCLUDE_DIR strigi/streamanalyzer.h + find_path(STRIGI_INCLUDE_DIR strigi/streamanalyzer.h PATHS ${strigi_home}/include ${STRIGI_INCLUDEDIR} ${_program_FILES_DIR}/strigi/include ) set( STRIGI_INCLUDEDIR ${STRIGI_INCLUDE_DIR} ) else (NOT STRIGI_INCLUDEDIR) set( STRIGI_INCLUDE_DIR ${STRIGI_INCLUDEDIR} ) endif (NOT STRIGI_INCLUDEDIR) find_library_with_debug(STRIGI_STREAMANALYZER_LIBRARY WIN32_DEBUG_POSTFIX d NAMES streamanalyzer PATHS ${strigi_home}/lib ${STRIGI_LIBRARY_DIRS} ${_program_FILES_DIR}/strigi/lib ) find_library_with_debug(STRIGI_STREAMS_LIBRARY WIN32_DEBUG_POSTFIX d NAMES streams PATHS ${strigi_home}/lib ${STRIGI_LIBRARY_DIRS} ${_program_FILES_DIR}/strigi/lib ) find_library_with_debug(STRIGI_STRIGIQTDBUSCLIENT_LIBRARY WIN32_DEBUG_POSTFIX d NAMES strigiqtdbusclient PATHS ${strigi_home}/lib ${STRIGI_LIBRARY_DIRS} ${_program_FILES_DIR}/strigi/lib ) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Strigi "Couldn't find Strigi streams and streamanalyzer libraries. Set the environment variable STRIGI_HOME (or CMAKE_PREFIX_PATH if using CMake >=2.6) to the strigi install dir." STRIGI_STREAMS_LIBRARY STRIGI_STREAMANALYZER_LIBRARY STRIGI_INCLUDE_DIR) if (STRIGI_FOUND) set( STRIGI_NEEDS_SIGNED_CHAR TRUE CACHE BOOL "TRUE if strigi is 0.6.0 or later" ) set( STRIGI_NEEDS_CHAR FALSE CACHE BOOL "TRUE if strigi is 0.5.9 or before" ) endif (STRIGI_FOUND) endif (STRIGI_CONFIG_FOUND_AND_HAS_COMPLETE_INFORMATION) if(WIN32) # this is needed to have mingw, cygwin and msvc libs installed in one directory if(MSVC) set(STRIGI_LINE_ANALYZER_PREFIX msvc_strigila_) set(STRIGI_THROUGH_ANALYZER_PREFIX msvc_strigita_) elseif(CYGWIN) set(STRIGI_LINE_ANALYZER_PREFIX cyg_strigila_) set(STRIGI_THROUGH_ANALYZER_PREFIX cyg_strigita_) elseif(MINGW) set(STRIGI_LINE_ANALYZER_PREFIX mingw_strigila_) set(STRIGI_THROUGH_ANALYZER_PREFIX mingw_strigita_) endif() else() set(STRIGI_LINE_ANALYZER_PREFIX strigila_) set(STRIGI_THROUGH_ANALYZER_PREFIX strigita_) endif() mark_as_advanced( STRIGI_INCLUDE_DIR STRIGI_STREAMANALYZER_LIBRARY STRIGI_STREAMANALYZER_LIBRARY_DEBUG STRIGI_STREAMANALYZER_LIBRARY_RELEASE STRIGI_STREAMS_LIBRARY STRIGI_STREAMS_LIBRARY_DEBUG STRIGI_STREAMS_LIBRARY_RELEASE STRIGI_STRIGIQTDBUSCLIENT_LIBRARY STRIGI_STRIGIQTDBUSCLIENT_LIBRARY_DEBUG STRIGI_STRIGIQTDBUSCLIENT_LIBRARY_RELEASE STRIGI_LINE_ANALYZER_PREFIX STRIGI_THROUGH_ANALYZER_PREFIX STRIGI_NEEDS_SIGNED_CHAR STRIGI_NEEDS_CHAR ) diff --git a/attic/modules/FindTaglib.cmake b/attic/modules/FindTaglib.cmake index 4b58bf6..c73bc43 100644 --- a/attic/modules/FindTaglib.cmake +++ b/attic/modules/FindTaglib.cmake @@ -1,85 +1,84 @@ # - Try to find the Taglib library # Once done this will define # # TAGLIB_FOUND - system has the taglib library # TAGLIB_CFLAGS - the taglib cflags # TAGLIB_LIBRARIES - The libraries needed to use taglib -# Copyright (c) 2006, Laurent Montel, +# SPDX-FileCopyrightText: 2006 Laurent Montel # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-License-Identifier: BSD-3-Clause if(NOT TAGLIB_MIN_VERSION) set(TAGLIB_MIN_VERSION "1.4") endif() if(NOT WIN32) find_program(TAGLIBCONFIG_EXECUTABLE NAMES taglib-config PATHS ${BIN_INSTALL_DIR} ) endif() #reset vars set(TAGLIB_LIBRARIES) set(TAGLIB_CFLAGS) # if taglib-config has been found if(TAGLIBCONFIG_EXECUTABLE) exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --version RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_VERSION) if(TAGLIB_VERSION STRLESS "${TAGLIB_MIN_VERSION}") message(STATUS "TagLib version not found: version searched :${TAGLIB_MIN_VERSION}, found ${TAGLIB_VERSION}") set(TAGLIB_FOUND FALSE) else() exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_LIBRARIES) exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_CFLAGS) if(TAGLIB_LIBRARIES AND TAGLIB_CFLAGS) set(TAGLIB_FOUND TRUE) message(STATUS "Found taglib: ${TAGLIB_LIBRARIES}") endif() string(REGEX REPLACE " *-I" ";" TAGLIB_INCLUDES "${TAGLIB_CFLAGS}") - endif() + endif() mark_as_advanced(TAGLIB_CFLAGS TAGLIB_LIBRARIES TAGLIB_INCLUDES) else() include(FindLibraryWithDebug) include(FindPackageHandleStandardArgs) find_path(TAGLIB_INCLUDES NAMES tag.h PATH_SUFFIXES taglib PATHS ${KDE4_INCLUDE_DIR} ${INCLUDE_INSTALL_DIR} ) find_library_with_debug(TAGLIB_LIBRARIES WIN32_DEBUG_POSTFIX d NAMES tag PATHS ${KDE4_LIB_DIR} ${LIB_INSTALL_DIR} ) - - find_package_handle_standard_args(Taglib DEFAULT_MSG + + find_package_handle_standard_args(Taglib DEFAULT_MSG TAGLIB_INCLUDES TAGLIB_LIBRARIES) endif() if(TAGLIB_FOUND) if(NOT Taglib_FIND_QUIETLY AND TAGLIBCONFIG_EXECUTABLE) message(STATUS "Taglib found: ${TAGLIB_LIBRARIES}") endif() else() if(Taglib_FIND_REQUIRED) message(FATAL_ERROR "Could not find Taglib") endif() endif() diff --git a/attic/modules/FindUSB.cmake b/attic/modules/FindUSB.cmake index 73b54a8..0a86a21 100644 --- a/attic/modules/FindUSB.cmake +++ b/attic/modules/FindUSB.cmake @@ -1,30 +1,28 @@ # - Try to find the freetype library # Once done this defines # # LIBUSB_FOUND - system has libusb # LIBUSB_INCLUDE_DIR - the libusb include directory # LIBUSB_LIBRARIES - Link these to use libusb -# Copyright (c) 2006, 2008 Laurent Montel, +# SPDX-FileCopyrightText: 2006, 2008 Laurent Montel # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - +# SPDX-License-Identifier: BSD-3-Clause if (NOT WIN32) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) pkg_check_modules(PC_LIBUSB QUIET libusb) endif() find_path(LIBUSB_INCLUDE_DIR usb.h HINTS ${PC_LIBUSB_INCLUDEDIR} ${PC_LIBUSB_INCLUDE_DIRS}) find_library(LIBUSB_LIBRARIES NAMES usb HINTS ${PC_LIBUSB_LIBDIR} ${PC_LIBUSB_LIBRARY_DIRS}) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(LIBUSB DEFAULT_MSG LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIR) mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES) diff --git a/attic/modules/FindWcecompat.cmake b/attic/modules/FindWcecompat.cmake index acba2dd..64ba2c8 100644 --- a/attic/modules/FindWcecompat.cmake +++ b/attic/modules/FindWcecompat.cmake @@ -1,25 +1,25 @@ # Try to find Wcecompat functionality # Once done this will define # # WCECOMPAT_FOUND - system has Wcecompat # WCECOMPAT_INCLUDE_DIR - Wcecompat include directory # WCECOMPAT_LIBRARIES - Libraries needed to use Wcecompat # -# Copyright (c) 2010, Andreas Holzammer, +# SPDX-FileCopyrightText: 2010 Andreas Holzammer # -# Redistribution and use is allowed according to the terms of the BSD license. +# SPDX-License-Identifier: BSD-3-Clause find_path(WCECOMPAT_INCLUDE_DIR errno.h PATH_SUFFIXES wcecompat) set(WCECOMPAT_LIB_FOUND FALSE) if(WCECOMPAT_INCLUDE_DIR) find_library(WCECOMPAT_LIBRARIES NAMES wcecompat wcecompatex ) if(WCECOMPAT_LIBRARIES) set(WCECOMPAT_LIB_FOUND TRUE) endif() endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Wcecompat DEFAULT_MSG WCECOMPAT_LIBRARIES WCECOMPAT_LIB_FOUND) diff --git a/attic/modules/FindXine.cmake b/attic/modules/FindXine.cmake index de29679..43dd408 100644 --- a/attic/modules/FindXine.cmake +++ b/attic/modules/FindXine.cmake @@ -1,64 +1,63 @@ # - Try to find the XINE library # Once done this will define # # XINE_FOUND - system has the XINE library # XINE_VERSION - XINE version # XINE_BUGFIX_VERSION - the XINE bugfix version # XINE_INCLUDE_DIR - the XINE include directory # XINE_LIBRARY - The libraries needed to use XINE # XINE_XCB_FOUND - libxine can use XCB for video output -# Copyright (c) 2006,2007 Laurent Montel, -# Copyright (c) 2006, Matthias Kretz, +# SPDX-FileCopyrightText: 2006, 2007 Laurent Montel +# SPDX-FileCopyrightText: 2006 Matthias Kretz # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-License-Identifier: BSD-3-Clause if (XINE_INCLUDE_DIR AND XINE_LIBRARY) # Already in cache, be silent set(Xine_FIND_QUIETLY TRUE) endif (XINE_INCLUDE_DIR AND XINE_LIBRARY) find_package(PkgConfig) if (PKG_CONFIG_FOUND) pkg_check_modules(PC_LIBXINE QUIET libxine) endif (PKG_CONFIG_FOUND) -find_path(XINE_INCLUDE_DIR NAMES xine.h +find_path(XINE_INCLUDE_DIR NAMES xine.h HINTS # HINTS is new in cmake 2.6. These dirs will be preferred over the default ones - ${PC_LIBXINE_INCLUDEDIR} - ${PC_LIBXINE_INCLUDE_DIRS} + ${PC_LIBXINE_INCLUDEDIR} + ${PC_LIBXINE_INCLUDE_DIRS} ) find_library(XINE_LIBRARY NAMES xine HINTS ${PC_LIBXINE_LIBDIR} ${PC_LIBXINE_LIBRARY_DIRS} ) -find_program(XINECONFIG_EXECUTABLE NAMES xine-config +find_program(XINECONFIG_EXECUTABLE NAMES xine-config HINTS ${PC_LIBXINE_PREFIX}/bin ) if (XINE_INCLUDE_DIR AND XINE_LIBRARY AND XINECONFIG_EXECUTABLE) exec_program(${XINECONFIG_EXECUTABLE} ARGS --version RETURN_VALUE _return_VALUE OUTPUT_VARIABLE XINE_VERSION) if("${XINE_VERSION}" VERSION_GREATER "1.1.0") #if (... VERSION_GREATER) is new since cmake 2.6.2 set(XINE_VERSION_OK TRUE) string(REGEX REPLACE "[0-9]\\.[0-9]\\." "" XINE_BUGFIX_VERSION ${XINE_VERSION}) endif() endif (XINE_INCLUDE_DIR AND XINE_LIBRARY AND XINECONFIG_EXECUTABLE) if( XINE_VERSION_OK) include(CheckCSourceCompiles) set(CMAKE_REQUIRED_INCLUDES ${XINE_INCLUDE_DIR}) set(CMAKE_REQUIRED_LIBRARIES ${XINE_LIBRARY}) check_c_source_compiles("#include \nint main()\n{\n xine_open_video_driver(xine_new(), \"auto\", XINE_VISUAL_TYPE_XCB, NULL);\n return 0;\n}\n" XINE_XCB_FOUND) set(XINE_FOUND TRUE) endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Xine "Could NOT find XINE 1.1.1 or greater" XINE_INCLUDE_DIR XINE_LIBRARY XINECONFIG_EXECUTABLE XINE_VERSION_OK) mark_as_advanced(XINE_INCLUDE_DIR XINE_LIBRARY XINECONFIG_EXECUTABLE) diff --git a/attic/modules/FindXmms.cmake b/attic/modules/FindXmms.cmake index b687d12..e87965b 100644 --- a/attic/modules/FindXmms.cmake +++ b/attic/modules/FindXmms.cmake @@ -1,44 +1,43 @@ # Search xmms # Once done this will define # # XMMS_FOUND - system has xmms # XMMS_INCLUDE_DIRS - the xmms include directory # XMMS_LIBRARIES - Link these to use xmms # XMMS_LDFLAGS - for compatibility only, same as XMMS_LIBRARIES -# Copyright (c) 2006, 2007 Laurent Montel, -# Copyright (c) 2007 Allen Winter +# SPDX-FileCopyrightText: 2006, 2007 Laurent Montel +# SPDX-FileCopyrightText: 2007 Allen Winter # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-License-Identifier: BSD-3-Clause if (XMMS_INCLUDE_DIRS AND XMMS_LIBRARIES) # in cache already set(XMMS_FOUND TRUE) else (XMMS_INCLUDE_DIRS AND XMMS_LIBRARIES) if (NOT WIN32) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) pkg_check_modules(PC_XMMS QUIET xmms) endif() find_path(XMMS_INCLUDE_DIRS xmmsctrl.h - PATHS ${PC_XMMS_INCLUDEDIR} ${PC_XMMS_INCLUDE_DIRS} + PATHS ${PC_XMMS_INCLUDEDIR} ${PC_XMMS_INCLUDE_DIRS} PATH_SUFFIXES xmms) find_library(XMMS_LIBRARIES NAMES xmms PATHS ${PC_XMMS_LIBDIR} ${PC_XMMS_LIBRARY_DIRS}) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Xmms DEFAULT_MSG XMMS_LIBRARIES XMMS_INCLUDE_DIRS) mark_as_advanced(XMMS_INCLUDE_DIRS XMMS_LIBRARIES) endif (XMMS_INCLUDE_DIRS AND XMMS_LIBRARIES) # for compatibility set(XMMS_LDFLAGS ${XMMS_LIBRARIES}) diff --git a/attic/modules/HandleImportedTargetsInCMakeRequiredLibraries.cmake b/attic/modules/HandleImportedTargetsInCMakeRequiredLibraries.cmake index b775b42..d43d38e 100644 --- a/attic/modules/HandleImportedTargetsInCMakeRequiredLibraries.cmake +++ b/attic/modules/HandleImportedTargetsInCMakeRequiredLibraries.cmake @@ -1,85 +1,84 @@ -# This is a helper function used by CheckCXXSourceRuns.cmake and -# CheckCXXSourceCompiles.cmake. Actually it should be used by all macros which +# This is a helper function used by CheckCXXSourceRuns.cmake and +# CheckCXXSourceCompiles.cmake. Actually it should be used by all macros which # use TRY_COMPILE() or TRY_RUN(). # It takes the CMAKE_REQUIRED_LIBRARY variable and searches it for imported # (library) targets. Since the project created by TRY_COMPILE() (and TRY_RUN()) # does not know about these imported targets, this macro here replaces these # imported targets with the actual library files on disk and it also # adds the libraries from the link interface of these imported targets. # E.g the imported target KDE4__kdeui is replaced on my system with /opt/kdelibs/lib/libkdeui.so # and the link interface libraries, which includes e.g. /opt/kdelibs/lib/libkdecore.so. # This way imported targets work also when used with CHECK_CXX_SOURCE_COMPILES/RUNS(). -# Copyright (c) 2009, Alexander Neundorf, +# SPDX-FileCopyrightText: 2009 Alexander Neundorf # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-License-Identifier: BSD-3-Clause FUNCTION(HANDLE_IMPORTED_TARGETS_IN_CMAKE_REQUIRED_LIBRARIES _RESULT) # handle imported library targets SET(_CCSR_IMP_TARGETS_MAP) SET(_CCSR_REQ_LIBS ${CMAKE_REQUIRED_LIBRARIES}) SET(_CHECK_FOR_IMPORTED_TARGETS TRUE) SET(_CCSR_LOOP_COUNTER 0) WHILE(_CHECK_FOR_IMPORTED_TARGETS) MATH(EXPR _CCSR_LOOP_COUNTER "${_CCSR_LOOP_COUNTER} + 1 ") SET(_CCSR_NEW_REQ_LIBS ) SET(_CHECK_FOR_IMPORTED_TARGETS FALSE) FOREACH(_CURRENT_LIB ${_CCSR_REQ_LIBS}) GET_TARGET_PROPERTY(_importedConfigs ${_CURRENT_LIB} IMPORTED_CONFIGURATIONS) IF (_importedConfigs) # Ok, so this is an imported target. # First we get the imported configurations. # Then we get the location of the actual library on disk of the first configuration. # then we'll get its link interface libraries property, # iterate through it and replace all imported targets we find there # with there actual location. # guard against infinite loop: abort after 100 iterations ( 100 is arbitrary chosen) IF ("${_CCSR_LOOP_COUNTER}" LESS 100) SET(_CHECK_FOR_IMPORTED_TARGETS TRUE) # ELSE ("${_CCSR_LOOP_COUNTER}" LESS 1) # MESSAGE(STATUS "********* aborting loop, counter : ${_CCSR_LOOP_COUNTER}") ENDIF ("${_CCSR_LOOP_COUNTER}" LESS 100) LIST(GET _importedConfigs 0 _firstImportedConfig) GET_TARGET_PROPERTY(_firstImportedLocation ${_CURRENT_LIB} IMPORTED_LOCATION_${_firstImportedConfig}) GET_TARGET_PROPERTY(_linkInterfaceLibs ${_CURRENT_LIB} IMPORTED_LINK_INTERFACE_LIBRARIES_${_firstImportedConfig} ) LIST(APPEND _CCSR_NEW_REQ_LIBS ${_firstImportedLocation}) # MESSAGE(STATUS "Appending lib ${_CURRENT_LIB} as ${_firstImportedLocation}") IF(_linkInterfaceLibs) FOREACH(_currentLinkInterfaceLib ${_linkInterfaceLibs}) # MESSAGE(STATUS "Appending link interface lib ${_currentLinkInterfaceLib}") IF(_currentLinkInterfaceLib) LIST(APPEND _CCSR_NEW_REQ_LIBS ${_currentLinkInterfaceLib} ) - ENDIF(_currentLinkInterfaceLib) + ENDIF(_currentLinkInterfaceLib) ENDFOREACH(_currentLinkInterfaceLib ${_linkInterfaceLibs}) ENDIF(_linkInterfaceLibs) ELSE(_importedConfigs) # "Normal" libraries are just used as they are. LIST(APPEND _CCSR_NEW_REQ_LIBS ${_CURRENT_LIB} ) # MESSAGE(STATUS "Appending lib directly: ${_CURRENT_LIB}") ENDIF(_importedConfigs) ENDFOREACH(_CURRENT_LIB ${_CCSR_REQ_LIBS}) SET(_CCSR_REQ_LIBS ${_CCSR_NEW_REQ_LIBS} ) ENDWHILE(_CHECK_FOR_IMPORTED_TARGETS) # Finally we iterate once more over all libraries. This loop only removes # all remaining imported target names (there shouldn't be any left anyway). SET(_CCSR_NEW_REQ_LIBS ) FOREACH(_CURRENT_LIB ${_CCSR_REQ_LIBS}) GET_TARGET_PROPERTY(_importedConfigs ${_CURRENT_LIB} IMPORTED_CONFIGURATIONS) IF (NOT _importedConfigs) LIST(APPEND _CCSR_NEW_REQ_LIBS ${_CURRENT_LIB} ) # MESSAGE(STATUS "final: appending ${_CURRENT_LIB}") ELSE (NOT _importedConfigs) # MESSAGE(STATUS "final: skipping ${_CURRENT_LIB}") ENDIF (NOT _importedConfigs) ENDFOREACH(_CURRENT_LIB ${_CCSR_REQ_LIBS}) SET(${_RESULT} ${_CCSR_NEW_REQ_LIBS} PARENT_SCOPE) ENDFUNCTION(HANDLE_IMPORTED_TARGETS_IN_CMAKE_REQUIRED_LIBRARIES _CCSR_REQ_LIBS) diff --git a/attic/modules/MacroAppendIf.cmake b/attic/modules/MacroAppendIf.cmake index 90f26af..83da4c1 100644 --- a/attic/modules/MacroAppendIf.cmake +++ b/attic/modules/MacroAppendIf.cmake @@ -1,22 +1,21 @@ # MACRO_APPEND_IF(CONDITION VAR VALUE1...VALUEN ) # This convenience macro appends the values VALUE1 up to VALUEN to the list # given in VAR, but only if the variable CONDITION is TRUE: # # usage example: # IF(SOMELIB_FOUND) # SET(my_sources ${my_sources} somefile.c someotherfile.c) # ENDIF(SOMELIB_FOUND) # # becomes: # MACRO_APPEND_IF(SOMELIB_FOUND my_sources somefile.c someotherfile.c) -# Copyright (c) 2006, Alexander Neundorf, +# SPDX-FileCopyrightText: 2006 Alexander Neundorf # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-License-Identifier: BSD-3-Clause macro(macro_append_if _cond _list) if(${_cond}) list(APPEND ${_list} ${ARGN}) endif() endmacro(macro_append_if _cond _list) diff --git a/attic/modules/MacroBoolTo01.cmake b/attic/modules/MacroBoolTo01.cmake index 63b9852..815f129 100644 --- a/attic/modules/MacroBoolTo01.cmake +++ b/attic/modules/MacroBoolTo01.cmake @@ -1,20 +1,18 @@ # MACRO_BOOL_TO_01( VAR RESULT0 ... RESULTN ) # This macro evaluates its first argument # and sets all the given vaiables either to 0 or 1 # depending on the value of the first one -# Copyright (c) 2006, Alexander Neundorf, +# SPDX-FileCopyrightText: 2006 Alexander Neundorf # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - +# SPDX-License-Identifier: BSD-3-Clause MACRO(MACRO_BOOL_TO_01 FOUND_VAR ) FOREACH (_current_VAR ${ARGN}) IF(${FOUND_VAR}) SET(${_current_VAR} 1) ELSE(${FOUND_VAR}) SET(${_current_VAR} 0) ENDIF(${FOUND_VAR}) ENDFOREACH(_current_VAR) ENDMACRO(MACRO_BOOL_TO_01) diff --git a/attic/modules/MacroEnsureOutOfSourceBuild.cmake b/attic/modules/MacroEnsureOutOfSourceBuild.cmake index cb26e0c..68d9275 100644 --- a/attic/modules/MacroEnsureOutOfSourceBuild.cmake +++ b/attic/modules/MacroEnsureOutOfSourceBuild.cmake @@ -1,20 +1,19 @@ # - MACRO_ENSURE_OUT_OF_SOURCE_BUILD() # MACRO_ENSURE_OUT_OF_SOURCE_BUILD() # Call this macro in your project if you want to enforce out-of-source builds. # If an in-source build is detected, it will abort with the given error message. # This macro works in any of the CMakeLists.txt of your project, but the recommended # location to call this is close to the beginning of the top level CMakeLists.txt -# Copyright (c) 2006, Alexander Neundorf, +# SPDX-FileCopyrightText: 2006 Alexander Neundorf # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-License-Identifier: BSD-3-Clause MACRO (MACRO_ENSURE_OUT_OF_SOURCE_BUILD _errorMessage) STRING(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" insource) IF(insource) MESSAGE(FATAL_ERROR "${_errorMessage}") ENDIF(insource) ENDMACRO (MACRO_ENSURE_OUT_OF_SOURCE_BUILD) diff --git a/attic/modules/MacroLibrary.cmake b/attic/modules/MacroLibrary.cmake index a467d84..92c83b5 100644 --- a/attic/modules/MacroLibrary.cmake +++ b/attic/modules/MacroLibrary.cmake @@ -1,19 +1,18 @@ # - include MacroLibrary offers a collection of macros which extend the built-in cmake commands -# Copyright (c) 2006, Alexander Neundorf, +# SPDX-FileCopyrightText: 2006 Alexander Neundorf # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-License-Identifier: BSD-3-Clause INCLUDE(MacroOptionalFindPackage) INCLUDE(MacroOptionalAddSubdirectory) INCLUDE(MacroAdditionalCleanFiles) INCLUDE(MacroAddFileDependencies) INCLUDE(MacroAddCompileFlags) INCLUDE(MacroAddLinkFlags) INCLUDE(MacroAppendIf) INCLUDE(MacroEnsureOutOfSourceBuild) INCLUDE(MacroBoolTo01) INCLUDE(MacroPushRequiredVars) INCLUDE(MacroLogFeature) INCLUDE(MacroWriteBasicCMakeVersionFile) diff --git a/attic/modules/PythonCompile.py b/attic/modules/PythonCompile.py index 156fea2..184a9cb 100644 --- a/attic/modules/PythonCompile.py +++ b/attic/modules/PythonCompile.py @@ -1,4 +1,5 @@ -# By Simon Edwards -# This file is in the public domain. +# SPDX-FileCopyrightText: Simon Edwards +# SPDX-License-Identifier: CC-PDDC + import py_compile, sys sys.exit(py_compile.main()) diff --git a/attic/modules/PythonMacros.cmake b/attic/modules/PythonMacros.cmake index 0abaccb..af55493 100644 --- a/attic/modules/PythonMacros.cmake +++ b/attic/modules/PythonMacros.cmake @@ -1,62 +1,61 @@ # Python macros # ~~~~~~~~~~~~~ -# Copyright (c) 2007, Simon Edwards +# SPDX-FileCopyrightText: 2007 Simon Edwards # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-License-Identifier: BSD-3-Clause # # This file defines the following macros: # # PYTHON_INSTALL (SOURCE_FILE DESINATION_DIR) # Install the SOURCE_FILE, which is a Python .py file, into the # destination directory during install. The file will be byte compiled # and both the .py file and .pyc file will be installed. GET_FILENAME_COMPONENT(PYTHON_MACROS_MODULE_PATH ${CMAKE_CURRENT_LIST_FILE} PATH) MACRO(PYTHON_INSTALL SOURCE_FILE DESINATION_DIR) FIND_FILE(_python_compile_py PythonCompile.py PATHS ${CMAKE_MODULE_PATH}) ADD_CUSTOM_TARGET(compile_python_files ALL) # Install the source file. INSTALL(FILES ${SOURCE_FILE} DESTINATION ${DESINATION_DIR}) - # Byte compile and install the .pyc file. + # Byte compile and install the .pyc file. GET_FILENAME_COMPONENT(_absfilename ${SOURCE_FILE} ABSOLUTE) GET_FILENAME_COMPONENT(_filename ${SOURCE_FILE} NAME) GET_FILENAME_COMPONENT(_filenamebase ${SOURCE_FILE} NAME_WE) GET_FILENAME_COMPONENT(_basepath ${SOURCE_FILE} PATH) if(WIN32) string(REGEX REPLACE ".:/" "/" _basepath "${_basepath}") endif() SET(_bin_py ${CMAKE_CURRENT_BINARY_DIR}/${_basepath}/${_filename}) SET(_bin_pyc ${CMAKE_CURRENT_BINARY_DIR}/${_basepath}/${_filenamebase}.pyc) FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_basepath}) SET(_message "-DMESSAGE=Byte-compiling ${_bin_py}") GET_FILENAME_COMPONENT(_abs_bin_py ${_bin_py} ABSOLUTE) IF(_abs_bin_py STREQUAL ${_absfilename}) # Don't copy the file onto itself. ADD_CUSTOM_COMMAND( TARGET compile_python_files COMMAND ${CMAKE_COMMAND} -E echo ${message} COMMAND ${PYTHON_EXECUTABLE} ${_python_compile_py} ${_bin_py} DEPENDS ${_absfilename} ) ELSE(_abs_bin_py STREQUAL ${_absfilename}) ADD_CUSTOM_COMMAND( TARGET compile_python_files - COMMAND ${CMAKE_COMMAND} -E echo ${message} + COMMAND ${CMAKE_COMMAND} -E echo ${message} COMMAND ${CMAKE_COMMAND} -E copy ${_absfilename} ${_bin_py} COMMAND ${PYTHON_EXECUTABLE} ${_python_compile_py} ${_bin_py} DEPENDS ${_absfilename} ) ENDIF(_abs_bin_py STREQUAL ${_absfilename}) INSTALL(FILES ${_bin_pyc} DESTINATION ${DESINATION_DIR}) ENDMACRO(PYTHON_INSTALL) diff --git a/attic/modules/Qt4ConfigDependentSettings.cmake b/attic/modules/Qt4ConfigDependentSettings.cmake index b5462e7..a064e28 100644 --- a/attic/modules/Qt4ConfigDependentSettings.cmake +++ b/attic/modules/Qt4ConfigDependentSettings.cmake @@ -1,384 +1,379 @@ # This file is included by FindQt4.cmake, don't include it directly. #============================================================================= -# Copyright 2005-2009 Kitware, Inc. +# SPDX-FileCopyrightText: 2005-2009 Kitware, Inc. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= # (To distributed this file outside of CMake, substitute the full # License text for the above reference.) ############################################### # -# configuration/system dependent settings +# configuration/system dependent settings # ############################################### -# this check for X11 and threads may not be necessary, since it is not +# this check for X11 and threads may not be necessary, since it is not # contained in the cmake version of FindQt4.cmake: # for unix add X11 stuff IF(UNIX) # on OS X X11 may not be required IF (Q_WS_X11) FIND_PACKAGE(X11 REQUIRED) ENDIF (Q_WS_X11) FIND_PACKAGE(Threads) SET(QT_QTCORE_LIBRARY ${QT_QTCORE_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) ENDIF(UNIX) # find dependencies for some Qt modules # when doing builds against a static Qt, they are required # when doing builds against a shared Qt, they are not required # if a user needs the dependencies, and they couldn't be found, they can set # the variables themselves. SET(QT_QTGUI_LIB_DEPENDENCIES "") SET(QT_QTCORE_LIB_DEPENDENCIES "") SET(QT_QTNETWORK_LIB_DEPENDENCIES "") SET(QT_QTOPENGL_LIB_DEPENDENCIES "") SET(QT_QTDBUS_LIB_DEPENDENCIES "") SET(QT_QTHELP_LIB_DEPENDENCIES ${QT_QTCLUCENE_LIBRARY}) IF(WIN32) # On Windows, qconfig.pri has "static" for static library builds IF(QT_CONFIG MATCHES "static") SET(QT_IS_STATIC 1) ENDIF(QT_CONFIG MATCHES "static") ELSE(WIN32) # On other platforms, check file extension to know if its static IF(QT_QTCORE_LIBRARY_RELEASE) GET_FILENAME_COMPONENT(qtcore_lib_ext "${QT_QTCORE_LIBRARY_RELEASE}" EXT) IF("${qtcore_lib_ext}" STREQUAL "${CMAKE_STATIC_LIBRARY_SUFFIX}") SET(QT_IS_STATIC 1) ENDIF("${qtcore_lib_ext}" STREQUAL "${CMAKE_STATIC_LIBRARY_SUFFIX}") ENDIF(QT_QTCORE_LIBRARY_RELEASE) IF(QT_QTCORE_LIBRARY_DEBUG) GET_FILENAME_COMPONENT(qtcore_lib_ext "${QT_QTCORE_LIBRARY_DEBUG}" EXT) IF(${qtcore_lib_ext} STREQUAL ${CMAKE_STATIC_LIBRARY_SUFFIX}) SET(QT_IS_STATIC 1) ENDIF(${qtcore_lib_ext} STREQUAL ${CMAKE_STATIC_LIBRARY_SUFFIX}) ENDIF(QT_QTCORE_LIBRARY_DEBUG) ENDIF(WIN32) # build using shared Qt needs -DQT_DLL on Windows IF(WIN32 AND NOT QT_IS_STATIC) SET(QT_DEFINITIONS ${QT_DEFINITIONS} -DQT_DLL) ENDIF(WIN32 AND NOT QT_IS_STATIC) # QtOpenGL dependencies QT_QUERY_QMAKE(QMAKE_LIBS_OPENGL "QMAKE_LIBS_OPENGL") IF(Q_WS_MAC) # On the Mac OpenGL is probably frameworks and QMAKE_LIBS_OPENGL can be e.g. "-framework OpenGL -framework AGL". -# The separate_arguments() call in the other branch makes "-framework;-OpenGL;-framework;-lAGL" appear in the +# The separate_arguments() call in the other branch makes "-framework;-OpenGL;-framework;-lAGL" appear in the # linker command. So we need to protect the "-framework foo" as non-separatable strings. # We do this by replacing the space after "-framework" with an underscore, then calling separate_arguments(), # and then we replace the underscores again with spaces. So we get proper linker commands. Alex STRING(REGEX REPLACE "-framework +" "-framework_" QMAKE_LIBS_OPENGL "${QMAKE_LIBS_OPENGL}") SEPARATE_ARGUMENTS(QMAKE_LIBS_OPENGL) STRING(REGEX REPLACE "-framework_" "-framework " QMAKE_LIBS_OPENGL "${QMAKE_LIBS_OPENGL}") ELSE(Q_WS_MAC) SEPARATE_ARGUMENTS(QMAKE_LIBS_OPENGL) ENDIF(Q_WS_MAC) SET (QT_QTOPENGL_LIB_DEPENDENCIES ${QT_QTOPENGL_LIB_DEPENDENCIES} ${QMAKE_LIBS_OPENGL}) ## system png IF(QT_QCONFIG MATCHES "system-png") FIND_LIBRARY(QT_PNG_LIBRARY NAMES png) MARK_AS_ADVANCED(QT_PNG_LIBRARY) IF(QT_PNG_LIBRARY) SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_PNG_LIBRARY}) ENDIF(QT_PNG_LIBRARY) ENDIF(QT_QCONFIG MATCHES "system-png") # for X11, get X11 library directory IF(Q_WS_X11) QT_QUERY_QMAKE(QMAKE_LIBDIR_X11 "QMAKE_LIBDIR_X11") ENDIF(Q_WS_X11) ## X11 SM IF(QT_QCONFIG MATCHES "x11sm") # ask qmake where the x11 libs are FIND_LIBRARY(QT_X11_SM_LIBRARY NAMES SM PATHS ${QMAKE_LIBDIR_X11}) FIND_LIBRARY(QT_X11_ICE_LIBRARY NAMES ICE PATHS ${QMAKE_LIBDIR_X11}) MARK_AS_ADVANCED(QT_X11_SM_LIBRARY) MARK_AS_ADVANCED(QT_X11_ICE_LIBRARY) IF(QT_X11_SM_LIBRARY AND QT_X11_ICE_LIBRARY) SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_X11_SM_LIBRARY} ${QT_X11_ICE_LIBRARY}) ENDIF(QT_X11_SM_LIBRARY AND QT_X11_ICE_LIBRARY) ENDIF(QT_QCONFIG MATCHES "x11sm") ## Xi IF(QT_QCONFIG MATCHES "tablet") FIND_LIBRARY(QT_XI_LIBRARY NAMES Xi PATHS ${QMAKE_LIBDIR_X11}) MARK_AS_ADVANCED(QT_XI_LIBRARY) IF(QT_XI_LIBRARY) SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XI_LIBRARY}) ENDIF(QT_XI_LIBRARY) ENDIF(QT_QCONFIG MATCHES "tablet") ## Xrender IF(QT_QCONFIG MATCHES "xrender") FIND_LIBRARY(QT_XRENDER_LIBRARY NAMES Xrender PATHS ${QMAKE_LIBDIR_X11}) MARK_AS_ADVANCED(QT_XRENDER_LIBRARY) IF(QT_XRENDER_LIBRARY) SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XRENDER_LIBRARY}) ENDIF(QT_XRENDER_LIBRARY) ENDIF(QT_QCONFIG MATCHES "xrender") ## Xrandr IF(QT_QCONFIG MATCHES "xrandr") FIND_LIBRARY(QT_XRANDR_LIBRARY NAMES Xrandr PATHS ${QMAKE_LIBDIR_X11}) MARK_AS_ADVANCED(QT_XRANDR_LIBRARY) IF(QT_XRANDR_LIBRARY) SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XRANDR_LIBRARY}) ENDIF(QT_XRANDR_LIBRARY) ENDIF(QT_QCONFIG MATCHES "xrandr") ## Xcursor IF(QT_QCONFIG MATCHES "xcursor") FIND_LIBRARY(QT_XCURSOR_LIBRARY NAMES Xcursor PATHS ${QMAKE_LIBDIR_X11}) MARK_AS_ADVANCED(QT_XCURSOR_LIBRARY) IF(QT_XCURSOR_LIBRARY) SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XCURSOR_LIBRARY}) ENDIF(QT_XCURSOR_LIBRARY) ENDIF(QT_QCONFIG MATCHES "xcursor") ## Xinerama IF(QT_QCONFIG MATCHES "xinerama") FIND_LIBRARY(QT_XINERAMA_LIBRARY NAMES Xinerama PATHS ${QMAKE_LIBDIR_X11}) MARK_AS_ADVANCED(QT_XINERAMA_LIBRARY) IF(QT_XINERAMA_LIBRARY) SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XINERAMA_LIBRARY}) ENDIF(QT_XINERAMA_LIBRARY) ENDIF(QT_QCONFIG MATCHES "xinerama") ## Xfixes IF(QT_QCONFIG MATCHES "xfixes") FIND_LIBRARY(QT_XFIXES_LIBRARY NAMES Xfixes PATHS ${QMAKE_LIBDIR_X11}) MARK_AS_ADVANCED(QT_XFIXES_LIBRARY) IF(QT_XFIXES_LIBRARY) SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XFIXES_LIBRARY}) ENDIF(QT_XFIXES_LIBRARY) ENDIF(QT_QCONFIG MATCHES "xfixes") ## system-freetype IF(QT_QCONFIG MATCHES "system-freetype") FIND_LIBRARY(QT_FREETYPE_LIBRARY NAMES freetype) MARK_AS_ADVANCED(QT_FREETYPE_LIBRARY) IF(QT_FREETYPE_LIBRARY) SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_FREETYPE_LIBRARY}) ENDIF(QT_FREETYPE_LIBRARY) ENDIF(QT_QCONFIG MATCHES "system-freetype") ## fontconfig IF(QT_QCONFIG MATCHES "fontconfig") FIND_LIBRARY(QT_FONTCONFIG_LIBRARY NAMES fontconfig) MARK_AS_ADVANCED(QT_FONTCONFIG_LIBRARY) IF(QT_FONTCONFIG_LIBRARY) SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_FONTCONFIG_LIBRARY}) ENDIF(QT_FONTCONFIG_LIBRARY) ENDIF(QT_QCONFIG MATCHES "fontconfig") ## system-zlib IF(QT_QCONFIG MATCHES "system-zlib") FIND_LIBRARY(QT_ZLIB_LIBRARY NAMES z) MARK_AS_ADVANCED(QT_ZLIB_LIBRARY) IF(QT_ZLIB_LIBRARY) SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_ZLIB_LIBRARY}) ENDIF(QT_ZLIB_LIBRARY) ENDIF(QT_QCONFIG MATCHES "system-zlib") ## openssl IF(NOT Q_WS_WIN) SET(_QT_NEED_OPENSSL 0) IF(QT_VERSION_MINOR LESS 4 AND QT_QCONFIG MATCHES "openssl") SET(_QT_NEED_OPENSSL 1) ENDIF(QT_VERSION_MINOR LESS 4 AND QT_QCONFIG MATCHES "openssl") IF(QT_VERSION_MINOR GREATER 3 AND QT_QCONFIG MATCHES "openssl-linked") SET(_QT_NEED_OPENSSL 1) ENDIF(QT_VERSION_MINOR GREATER 3 AND QT_QCONFIG MATCHES "openssl-linked") IF(_QT_NEED_OPENSSL) FIND_PACKAGE(OpenSSL) IF(OPENSSL_LIBRARIES) SET(QT_QTNETWORK_LIB_DEPENDENCIES ${QT_QTNETWORK_LIB_DEPENDENCIES} ${OPENSSL_LIBRARIES}) ENDIF(OPENSSL_LIBRARIES) ENDIF(_QT_NEED_OPENSSL) ENDIF(NOT Q_WS_WIN) ## dbus IF(QT_QCONFIG MATCHES "dbus") # if the dbus library isn't found, we'll assume its not required to build # shared Qt on Linux doesn't require it IF(NOT QT_DBUS_LIBRARY) EXECUTE_PROCESS(COMMAND pkg-config --libs-only-L dbus-1 OUTPUT_VARIABLE _dbus_query_output RESULT_VARIABLE _dbus_result ERROR_VARIABLE _dbus_query_output ) IF(_dbus_result MATCHES 0) STRING(REPLACE "-L" "" _dbus_query_output "${_dbus_query_output}") SEPARATE_ARGUMENTS(_dbus_query_output) ELSE(_dbus_result MATCHES 0) SET(_dbus_query_output) ENDIF(_dbus_result MATCHES 0) FIND_LIBRARY(QT_DBUS_LIBRARY NAMES dbus-1 PATHS ${_dbus_query_output} ) IF(QT_DBUS_LIBRARY) SET(QT_QTDBUS_LIB_DEPENDENCIES ${QT_QTDBUS_LIB_DEPENDENCIES} ${QT_DBUS_LIBRARY}) ENDIF(QT_DBUS_LIBRARY) MARK_AS_ADVANCED(QT_DBUS_LIBRARY) ENDIF(NOT QT_DBUS_LIBRARY) ENDIF(QT_QCONFIG MATCHES "dbus") ## glib IF(QT_QCONFIG MATCHES "glib") # if the glib libraries aren't found, we'll assume its not required to build # shared Qt on Linux doesn't require it # Qt 4.2.0+ uses glib-2.0 IF(NOT QT_GLIB_LIBRARY OR NOT QT_GTHREAD_LIBRARY) EXECUTE_PROCESS(COMMAND pkg-config --libs-only-L glib-2.0 gthread-2.0 OUTPUT_VARIABLE _glib_query_output RESULT_VARIABLE _glib_result ERROR_VARIABLE _glib_query_output ) IF(_glib_result MATCHES 0) STRING(REPLACE "-L" "" _glib_query_output "${_glib_query_output}") SEPARATE_ARGUMENTS(_glib_query_output) ELSE(_glib_result MATCHES 0) SET(_glib_query_output) ENDIF(_glib_result MATCHES 0) FIND_LIBRARY(QT_GLIB_LIBRARY NAMES glib-2.0 PATHS ${_glib_query_output} ) FIND_LIBRARY(QT_GTHREAD_LIBRARY NAMES gthread-2.0 PATHS ${_glib_query_output} ) MARK_AS_ADVANCED(QT_GLIB_LIBRARY) MARK_AS_ADVANCED(QT_GTHREAD_LIBRARY) ENDIF(NOT QT_GLIB_LIBRARY OR NOT QT_GTHREAD_LIBRARY) IF(QT_GLIB_LIBRARY AND QT_GTHREAD_LIBRARY) SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_GTHREAD_LIBRARY} ${QT_GLIB_LIBRARY}) ENDIF(QT_GLIB_LIBRARY AND QT_GTHREAD_LIBRARY) # Qt 4.5+ also links to gobject-2.0 IF(QT_VERSION_MINOR GREATER 4) IF(NOT QT_GOBJECT_LIBRARY) EXECUTE_PROCESS(COMMAND pkg-config --libs-only-L gobject-2.0 OUTPUT_VARIABLE _glib_query_output RESULT_VARIABLE _glib_result ERROR_VARIABLE _glib_query_output ) IF(_glib_result MATCHES 0) STRING(REPLACE "-L" "" _glib_query_output "${_glib_query_output}") SEPARATE_ARGUMENTS(_glib_query_output) ELSE(_glib_result MATCHES 0) SET(_glib_query_output) ENDIF(_glib_result MATCHES 0) FIND_LIBRARY(QT_GOBJECT_LIBRARY NAMES gobject-2.0 PATHS ${_glib_query_output} ) MARK_AS_ADVANCED(QT_GOBJECT_LIBRARY) ENDIF(NOT QT_GOBJECT_LIBRARY) IF(QT_GOBJECT_LIBRARY) SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_GOBJECT_LIBRARY}) ENDIF(QT_GOBJECT_LIBRARY) ENDIF(QT_VERSION_MINOR GREATER 4) ENDIF(QT_QCONFIG MATCHES "glib") ## clock-monotonic, just see if we need to link with rt IF(QT_QCONFIG MATCHES "clock-monotonic") SET(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES}) SET(CMAKE_REQUIRED_LIBRARIES rt) CHECK_SYMBOL_EXISTS(_POSIX_TIMERS "unistd.h;time.h" QT_POSIX_TIMERS) SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE}) IF(QT_POSIX_TIMERS) FIND_LIBRARY(QT_RT_LIBRARY NAMES rt) MARK_AS_ADVANCED(QT_RT_LIBRARY) IF(QT_RT_LIBRARY) SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_RT_LIBRARY}) ENDIF(QT_RT_LIBRARY) ENDIF(QT_POSIX_TIMERS) ENDIF(QT_QCONFIG MATCHES "clock-monotonic") IF(Q_WS_X11) # X11 libraries Qt absolutely depends on QT_QUERY_QMAKE(QT_LIBS_X11 "QMAKE_LIBS_X11") SEPARATE_ARGUMENTS(QT_LIBS_X11) FOREACH(QT_X11_LIB ${QT_LIBS_X11}) STRING(REGEX REPLACE "-l" "" QT_X11_LIB "${QT_X11_LIB}") SET(QT_TMP_STR "QT_X11_${QT_X11_LIB}_LIBRARY") FIND_LIBRARY(${QT_TMP_STR} NAMES "${QT_X11_LIB}" PATHS ${QMAKE_LIBDIR_X11}) MARK_AS_ADVANCED(${QT_TMP_STR}) IF(${QT_TMP_STR}) SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${${QT_TMP_STR}}) ENDIF(${QT_TMP_STR}) ENDFOREACH(QT_X11_LIB) QT_QUERY_QMAKE(QT_LIBS_THREAD "QMAKE_LIBS_THREAD") SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_LIBS_THREAD}) QT_QUERY_QMAKE(QMAKE_LIBS_DYNLOAD "QMAKE_LIBS_DYNLOAD") SET (QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QMAKE_LIBS_DYNLOAD}) ENDIF(Q_WS_X11) IF(Q_WS_WIN) SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} imm32 winmm) SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ws2_32) ENDIF(Q_WS_WIN) IF(Q_WS_MAC) SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} "-framework Carbon") # Qt 4.0, 4.1, 4.2 use QuickTime IF(QT_VERSION_MINOR LESS 3) SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} "-framework QuickTime") ENDIF(QT_VERSION_MINOR LESS 3) # Qt 4.2+ use AppKit IF(QT_VERSION_MINOR GREATER 1) SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} "-framework AppKit") ENDIF(QT_VERSION_MINOR GREATER 1) SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} "-framework ApplicationServices") ENDIF(Q_WS_MAC) diff --git a/attic/modules/Qt4Macros.cmake b/attic/modules/Qt4Macros.cmake index 24379a6..c2e4857 100644 --- a/attic/modules/Qt4Macros.cmake +++ b/attic/modules/Qt4Macros.cmake @@ -1,414 +1,409 @@ # This file is included by FindQt4.cmake, don't include it directly. #============================================================================= -# Copyright 2005-2009 Kitware, Inc. +# SPDX-FileCopyrightText: 2005-2009 Kitware, Inc. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= # (To distributed this file outside of CMake, substitute the full # License text for the above reference.) ###################################### # # Macros for building Qt files # ###################################### MACRO (QT4_EXTRACT_OPTIONS _qt4_files _qt4_options) SET(${_qt4_files}) SET(${_qt4_options}) SET(_QT4_DOING_OPTIONS FALSE) FOREACH(_currentArg ${ARGN}) IF ("${_currentArg}" STREQUAL "OPTIONS") SET(_QT4_DOING_OPTIONS TRUE) ELSE ("${_currentArg}" STREQUAL "OPTIONS") - IF(_QT4_DOING_OPTIONS) + IF(_QT4_DOING_OPTIONS) LIST(APPEND ${_qt4_options} "${_currentArg}") ELSE(_QT4_DOING_OPTIONS) LIST(APPEND ${_qt4_files} "${_currentArg}") ENDIF(_QT4_DOING_OPTIONS) ENDIF ("${_currentArg}" STREQUAL "OPTIONS") - ENDFOREACH(_currentArg) + ENDFOREACH(_currentArg) ENDMACRO (QT4_EXTRACT_OPTIONS) # macro used to create the names of output files preserving relative dirs MACRO (QT4_MAKE_OUTPUT_FILE infile prefix ext outfile ) STRING(LENGTH ${CMAKE_CURRENT_BINARY_DIR} _binlength) STRING(LENGTH ${infile} _infileLength) SET(_checkinfile ${CMAKE_CURRENT_SOURCE_DIR}) IF(_infileLength GREATER _binlength) STRING(SUBSTRING "${infile}" 0 ${_binlength} _checkinfile) IF(_checkinfile STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_BINARY_DIR} ${infile}) ELSE(_checkinfile STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile}) ENDIF(_checkinfile STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") ELSE(_infileLength GREATER _binlength) FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile}) ENDIF(_infileLength GREATER _binlength) - IF(WIN32 AND rel MATCHES "^[a-zA-Z]:") # absolute path + IF(WIN32 AND rel MATCHES "^[a-zA-Z]:") # absolute path STRING(REGEX REPLACE "^([a-zA-Z]):(.*)$" "\\1_\\2" rel "${rel}") - ENDIF(WIN32 AND rel MATCHES "^[a-zA-Z]:") + ENDIF(WIN32 AND rel MATCHES "^[a-zA-Z]:") SET(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${rel}") STRING(REPLACE ".." "__" _outfile ${_outfile}) GET_FILENAME_COMPONENT(outpath ${_outfile} PATH) GET_FILENAME_COMPONENT(_outfile ${_outfile} NAME_WE) FILE(MAKE_DIRECTORY ${outpath}) SET(${outfile} ${outpath}/${prefix}${_outfile}.${ext}) ENDMACRO (QT4_MAKE_OUTPUT_FILE ) MACRO (QT4_GET_MOC_FLAGS _moc_flags) SET(${_moc_flags}) GET_DIRECTORY_PROPERTY(_inc_DIRS INCLUDE_DIRECTORIES) FOREACH(_current ${_inc_DIRS}) IF("${_current}" MATCHES ".framework/?$") STRING(REGEX REPLACE "/[^/]+.framework" "" framework_path "${_current}") SET(${_moc_flags} ${${_moc_flags}} "-F${framework_path}") ELSE("${_current}" MATCHES ".framework/?$") SET(${_moc_flags} ${${_moc_flags}} "-I${_current}") ENDIF("${_current}" MATCHES ".framework/?$") ENDFOREACH(_current ${_inc_DIRS}) GET_DIRECTORY_PROPERTY(_defines COMPILE_DEFINITIONS) FOREACH(_current ${_defines}) SET(${_moc_flags} ${${_moc_flags}} "-D${_current}") ENDFOREACH(_current ${_defines}) IF(Q_WS_WIN) SET(${_moc_flags} ${${_moc_flags}} -DWIN32) ENDIF(Q_WS_WIN) ENDMACRO(QT4_GET_MOC_FLAGS) # helper macro to set up a moc rule MACRO (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options) # For Windows, create a parameters file to work around command line length limit IF (WIN32) # Pass the parameters in a file. Set the working directory to # be that containing the parameters file and reference it by # just the file name. This is necessary because the moc tool on # MinGW builds does not seem to handle spaces in the path to the # file given with the @ syntax. GET_FILENAME_COMPONENT(_moc_outfile_name "${outfile}" NAME) GET_FILENAME_COMPONENT(_moc_outfile_dir "${outfile}" PATH) IF(_moc_outfile_dir) SET(_moc_working_dir WORKING_DIRECTORY ${_moc_outfile_dir}) ENDIF(_moc_outfile_dir) SET (_moc_parameters_file ${outfile}_parameters) SET (_moc_parameters ${moc_flags} ${moc_options} -o "${outfile}" "${infile}") FILE (REMOVE ${_moc_parameters_file}) FOREACH(arg ${_moc_parameters}) FILE (APPEND ${_moc_parameters_file} "${arg}\n") ENDFOREACH(arg) ADD_CUSTOM_COMMAND(OUTPUT ${outfile} COMMAND ${QT_MOC_EXECUTABLE} @${_moc_outfile_name}_parameters DEPENDS ${infile} ${_moc_working_dir} VERBATIM) ELSE (WIN32) ADD_CUSTOM_COMMAND(OUTPUT ${outfile} COMMAND ${QT_MOC_EXECUTABLE} ARGS ${moc_flags} ${moc_options} -o ${outfile} ${infile} DEPENDS ${infile}) ENDIF (WIN32) ENDMACRO (QT4_CREATE_MOC_COMMAND) MACRO (QT4_GENERATE_MOC infile outfile ) # get include dirs and flags QT4_GET_MOC_FLAGS(moc_flags) GET_FILENAME_COMPONENT(abs_infile ${infile} ABSOLUTE) QT4_CREATE_MOC_COMMAND(${abs_infile} ${outfile} "${moc_flags}" "") SET_SOURCE_FILES_PROPERTIES(${outfile} PROPERTIES SKIP_AUTOMOC TRUE) # don't run automoc on this file MACRO_ADD_FILE_DEPENDENCIES(${abs_infile} ${outfile}) ENDMACRO (QT4_GENERATE_MOC) # QT4_WRAP_CPP(outfiles inputfile ... ) MACRO (QT4_WRAP_CPP outfiles ) # get include dirs QT4_GET_MOC_FLAGS(moc_flags) QT4_EXTRACT_OPTIONS(moc_files moc_options ${ARGN}) FOREACH (it ${moc_files}) GET_FILENAME_COMPONENT(it ${it} ABSOLUTE) QT4_MAKE_OUTPUT_FILE(${it} moc_ cxx outfile) QT4_CREATE_MOC_COMMAND(${it} ${outfile} "${moc_flags}" "${moc_options}") SET(${outfiles} ${${outfiles}} ${outfile}) ENDFOREACH(it) ENDMACRO (QT4_WRAP_CPP) # QT4_WRAP_UI(outfiles inputfile ... ) MACRO (QT4_WRAP_UI outfiles ) QT4_EXTRACT_OPTIONS(ui_files ui_options ${ARGN}) FOREACH (it ${ui_files}) GET_FILENAME_COMPONENT(outfile ${it} NAME_WE) GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE) SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h) ADD_CUSTOM_COMMAND(OUTPUT ${outfile} COMMAND ${QT_UIC_EXECUTABLE} ARGS ${ui_options} -o ${outfile} ${infile} MAIN_DEPENDENCY ${infile}) SET(${outfiles} ${${outfiles}} ${outfile}) ENDFOREACH (it) ENDMACRO (QT4_WRAP_UI) # QT4_ADD_RESOURCES(outfiles inputfile ... ) MACRO (QT4_ADD_RESOURCES outfiles ) QT4_EXTRACT_OPTIONS(rcc_files rcc_options ${ARGN}) FOREACH (it ${rcc_files}) GET_FILENAME_COMPONENT(outfilename ${it} NAME_WE) GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE) GET_FILENAME_COMPONENT(rc_path ${infile} PATH) SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}.cxx) - # parse file for dependencies + # parse file for dependencies # all files are absolute paths or relative to the location of the qrc file FILE(READ "${infile}" _RC_FILE_CONTENTS) STRING(REGEX MATCHALL "]*>" "" _RC_FILE "${_RC_FILE}") STRING(REGEX MATCH "^/|([A-Za-z]:/)" _ABS_PATH_INDICATOR "${_RC_FILE}") IF(NOT _ABS_PATH_INDICATOR) SET(_RC_FILE "${rc_path}/${_RC_FILE}") ENDIF(NOT _ABS_PATH_INDICATOR) SET(_RC_DEPENDS ${_RC_DEPENDS} "${_RC_FILE}") ENDFOREACH(_RC_FILE) ADD_CUSTOM_COMMAND(OUTPUT ${outfile} COMMAND ${QT_RCC_EXECUTABLE} ARGS ${rcc_options} -name ${outfilename} -o ${outfile} ${infile} MAIN_DEPENDENCY ${infile} DEPENDS ${_RC_DEPENDS}) SET(${outfiles} ${${outfiles}} ${outfile}) ENDFOREACH (it) ENDMACRO (QT4_ADD_RESOURCES) MACRO(QT4_ADD_DBUS_INTERFACE _sources _interface _basename) GET_FILENAME_COMPONENT(_infile ${_interface} ABSOLUTE) SET(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h) SET(_impl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp) SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc) GET_SOURCE_FILE_PROPERTY(_nonamespace ${_interface} NO_NAMESPACE) IF ( _nonamespace ) SET(_params -N -m) ELSE ( _nonamespace ) SET(_params -m) ENDIF ( _nonamespace ) GET_SOURCE_FILE_PROPERTY(_classname ${_interface} CLASSNAME) IF ( _classname ) SET(_params ${_params} -c ${_classname}) ENDIF ( _classname ) GET_SOURCE_FILE_PROPERTY(_include ${_interface} INCLUDE) IF ( _include ) SET(_params ${_params} -i ${_include}) ENDIF ( _include ) ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header} COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} ${_params} -p ${_basename} ${_infile} DEPENDS ${_infile}) SET_SOURCE_FILES_PROPERTIES(${_impl} PROPERTIES SKIP_AUTOMOC TRUE) QT4_GENERATE_MOC(${_header} ${_moc}) SET(${_sources} ${${_sources}} ${_impl} ${_header} ${_moc}) MACRO_ADD_FILE_DEPENDENCIES(${_impl} ${_moc}) ENDMACRO(QT4_ADD_DBUS_INTERFACE) MACRO(QT4_ADD_DBUS_INTERFACES _sources) FOREACH (_current_FILE ${ARGN}) GET_FILENAME_COMPONENT(_infile ${_current_FILE} ABSOLUTE) # get the part before the ".xml" suffix STRING(REGEX REPLACE "(.*[/\\.])?([^\\.]+)\\.xml" "\\2" _basename ${_current_FILE}) STRING(TOLOWER ${_basename} _basename) QT4_ADD_DBUS_INTERFACE(${_sources} ${_infile} ${_basename}interface) ENDFOREACH (_current_FILE) ENDMACRO(QT4_ADD_DBUS_INTERFACES) MACRO(QT4_GENERATE_DBUS_INTERFACE _header) # _customName OPTIONS -some -options ) QT4_EXTRACT_OPTIONS(_customName _qt4_dbus_options ${ARGN}) GET_FILENAME_COMPONENT(_in_file ${_header} ABSOLUTE) GET_FILENAME_COMPONENT(_basename ${_header} NAME_WE) IF (_customName) SET(_target ${CMAKE_CURRENT_BINARY_DIR}/${_customName}) ELSE (_customName) SET(_target ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.xml) ENDIF (_customName) ADD_CUSTOM_COMMAND(OUTPUT ${_target} COMMAND ${QT_DBUSCPP2XML_EXECUTABLE} ${_qt4_dbus_options} ${_in_file} -o ${_target} DEPENDS ${_in_file} ) ENDMACRO(QT4_GENERATE_DBUS_INTERFACE) MACRO(QT4_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass) # _optionalBasename _optionalClassName) GET_FILENAME_COMPONENT(_infile ${_xml_file} ABSOLUTE) SET(_optionalBasename "${ARGV4}") IF (_optionalBasename) SET(_basename ${_optionalBasename} ) ELSE (_optionalBasename) STRING(REGEX REPLACE "(.*[/\\.])?([^\\.]+)\\.xml" "\\2adaptor" _basename ${_infile}) STRING(TOLOWER ${_basename} _basename) ENDIF (_optionalBasename) SET(_optionalClassName "${ARGV5}") SET(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h) SET(_impl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp) SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc) IF(_optionalClassName) ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header} COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -c ${_optionalClassName} -i ${_include} -l ${_parentClass} ${_infile} DEPENDS ${_infile} ) ELSE(_optionalClassName) ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header} COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -i ${_include} -l ${_parentClass} ${_infile} DEPENDS ${_infile} ) ENDIF(_optionalClassName) QT4_GENERATE_MOC(${_header} ${_moc}) SET_SOURCE_FILES_PROPERTIES(${_impl} PROPERTIES SKIP_AUTOMOC TRUE) MACRO_ADD_FILE_DEPENDENCIES(${_impl} ${_moc}) SET(${_sources} ${${_sources}} ${_impl} ${_header} ${_moc}) ENDMACRO(QT4_ADD_DBUS_ADAPTOR) MACRO(QT4_AUTOMOC) QT4_GET_MOC_FLAGS(_moc_INCS) SET(_matching_FILES ) FOREACH (_current_FILE ${ARGN}) GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE) # if "SKIP_AUTOMOC" is set to true, we will not handle this file here. # This is required to make uic work correctly: # we need to add generated .cpp files to the sources (to compile them), # but we cannot let automoc handle them, as the .cpp files don't exist yet when # cmake is run for the very first time on them -> however the .cpp files might # exist at a later run. at that time we need to skip them, so that we don't add two # different rules for the same moc file GET_SOURCE_FILE_PROPERTY(_skip ${_abs_FILE} SKIP_AUTOMOC) IF ( NOT _skip AND EXISTS ${_abs_FILE} ) FILE(READ ${_abs_FILE} _contents) GET_FILENAME_COMPONENT(_abs_PATH ${_abs_FILE} PATH) STRING(REGEX MATCHALL "# *include +[^ ]+\\.moc[\">]" _match "${_contents}") IF(_match) FOREACH (_current_MOC_INC ${_match}) STRING(REGEX MATCH "[^ <\"]+\\.moc" _current_MOC "${_current_MOC_INC}") GET_FILENAME_COMPONENT(_basename ${_current_MOC} NAME_WE) IF(EXISTS ${_abs_PATH}/${_basename}.hpp) SET(_header ${_abs_PATH}/${_basename}.hpp) ELSE(EXISTS ${_abs_PATH}/${_basename}.hpp) SET(_header ${_abs_PATH}/${_basename}.h) ENDIF(EXISTS ${_abs_PATH}/${_basename}.hpp) SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC}) QT4_CREATE_MOC_COMMAND(${_header} ${_moc} "${_moc_INCS}" "") MACRO_ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc}) ENDFOREACH (_current_MOC_INC) ENDIF(_match) ENDIF ( NOT _skip AND EXISTS ${_abs_FILE} ) ENDFOREACH (_current_FILE) ENDMACRO(QT4_AUTOMOC) MACRO(QT4_CREATE_TRANSLATION _qm_files) QT4_EXTRACT_OPTIONS(_lupdate_files _lupdate_options ${ARGN}) SET(_my_sources) SET(_my_dirs) SET(_my_tsfiles) SET(_ts_pro) FOREACH (_file ${_lupdate_files}) GET_FILENAME_COMPONENT(_ext ${_file} EXT) GET_FILENAME_COMPONENT(_abs_FILE ${_file} ABSOLUTE) IF(_ext MATCHES "ts") LIST(APPEND _my_tsfiles ${_abs_FILE}) ELSE(_ext MATCHES "ts") IF(NOT _ext) LIST(APPEND _my_dirs ${_abs_FILE}) ELSE(NOT _ext) LIST(APPEND _my_sources ${_abs_FILE}) ENDIF(NOT _ext) ENDIF(_ext MATCHES "ts") ENDFOREACH(_file) FOREACH(_ts_file ${_my_tsfiles}) IF(_my_sources) # make a .pro file to call lupdate on, so we don't make our commands too # long for some systems GET_FILENAME_COMPONENT(_ts_name ${_ts_file} NAME_WE) SET(_ts_pro ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_ts_name}_lupdate.pro) SET(_pro_srcs) FOREACH(_pro_src ${_my_sources}) SET(_pro_srcs "${_pro_srcs} \"${_pro_src}\"") ENDFOREACH(_pro_src ${_my_sources}) FILE(WRITE ${_ts_pro} "SOURCES = ${_pro_srcs}") ENDIF(_my_sources) ADD_CUSTOM_COMMAND(OUTPUT ${_ts_file} COMMAND ${QT_LUPDATE_EXECUTABLE} ARGS ${_lupdate_options} ${_ts_pro} ${_my_dirs} -ts ${_ts_file} DEPENDS ${_my_sources} ${_ts_pro}) ENDFOREACH(_ts_file) QT4_ADD_TRANSLATION(${_qm_files} ${_my_tsfiles}) ENDMACRO(QT4_CREATE_TRANSLATION) MACRO(QT4_ADD_TRANSLATION _qm_files) FOREACH (_current_FILE ${ARGN}) GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE) GET_FILENAME_COMPONENT(qm ${_abs_FILE} NAME_WE) GET_SOURCE_FILE_PROPERTY(output_location ${_abs_FILE} OUTPUT_LOCATION) IF(output_location) FILE(MAKE_DIRECTORY "${output_location}") SET(qm "${output_location}/${qm}.qm") ELSE(output_location) SET(qm "${CMAKE_CURRENT_BINARY_DIR}/${qm}.qm") ENDIF(output_location) ADD_CUSTOM_COMMAND(OUTPUT ${qm} COMMAND ${QT_LRELEASE_EXECUTABLE} ARGS ${_abs_FILE} -qm ${qm} DEPENDS ${_abs_FILE} ) SET(${_qm_files} ${${_qm_files}} ${qm}) ENDFOREACH (_current_FILE) ENDMACRO(QT4_ADD_TRANSLATION) diff --git a/attic/modules/SIPMacros.cmake b/attic/modules/SIPMacros.cmake index 7c5476e..e5a5268 100644 --- a/attic/modules/SIPMacros.cmake +++ b/attic/modules/SIPMacros.cmake @@ -1,124 +1,124 @@ # Macros for SIP # ~~~~~~~~~~~~~~ -# Copyright (c) 2007, Simon Edwards -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# SPDX-FileCopyrightText: 2007 Simon Edwards +# +# SPDX-License-Identifier: BSD-3-Clause # # SIP website: http://www.riverbankcomputing.co.uk/sip/index.php # # This file defines the following macros: # # ADD_SIP_PYTHON_MODULE (MODULE_NAME MODULE_SIP [library1, libaray2, ...]) # Specifies a SIP file to be built into a Python module and installed. # MODULE_NAME is the name of Python module including any path name. (e.g. # os.sys, Foo.bar etc). MODULE_SIP the path and filename of the .sip file # to process and compile. libraryN are libraries that the Python module, # which is typically a shared library, should be linked to. The built # module will also be install into Python's site-packages directory. # # The behaviour of the ADD_SIP_PYTHON_MODULE macro can be controlled by a # number of variables: # # SIP_INCLUDES - List of directories which SIP will scan through when looking # for included .sip files. (Corresponds to the -I option for SIP.) # # SIP_TAGS - List of tags to define when running SIP. (Corresponds to the -t # option for SIP.) # # SIP_CONCAT_PARTS - An integer which defines the number of parts the C++ code # of each module should be split into. Defaults to 8. (Corresponds to the # -j option for SIP.) # # SIP_DISABLE_FEATURES - List of feature names which should be disabled # running SIP. (Corresponds to the -x option for SIP.) # # SIP_EXTRA_OPTIONS - Extra command line options which should be passed on to # SIP. SET(SIP_INCLUDES) SET(SIP_TAGS) SET(SIP_CONCAT_PARTS 8) SET(SIP_DISABLE_FEATURES) SET(SIP_EXTRA_OPTIONS) MACRO(ADD_SIP_PYTHON_MODULE MODULE_NAME MODULE_SIP) SET(EXTRA_LINK_LIBRARIES ${ARGN}) STRING(REPLACE "." "/" _x ${MODULE_NAME}) GET_FILENAME_COMPONENT(_parent_module_path ${_x} PATH) GET_FILENAME_COMPONENT(_child_module_name ${_x} NAME) GET_FILENAME_COMPONENT(_module_path ${MODULE_SIP} PATH) if(_module_path STREQUAL "") set(CMAKE_CURRENT_SIP_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}") else() set(CMAKE_CURRENT_SIP_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${_module_path}") endif() GET_FILENAME_COMPONENT(_abs_module_sip ${MODULE_SIP} ABSOLUTE) # We give this target a long logical target name. # (This is to avoid having the library name clash with any already # install library names. If that happens then cmake dependancy # tracking get confused.) STRING(REPLACE "." "_" _logical_name ${MODULE_NAME}) SET(_logical_name "python_module_${_logical_name}") FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_SIP_OUTPUT_DIR}) # Output goes in this dir. SET(_sip_includes) FOREACH (_inc ${SIP_INCLUDES}) GET_FILENAME_COMPONENT(_abs_inc ${_inc} ABSOLUTE) LIST(APPEND _sip_includes -I ${_abs_inc}) ENDFOREACH (_inc ) SET(_sip_tags) FOREACH (_tag ${SIP_TAGS}) LIST(APPEND _sip_tags -t ${_tag}) ENDFOREACH (_tag) SET(_sip_x) FOREACH (_x ${SIP_DISABLE_FEATURES}) LIST(APPEND _sip_x -x ${_x}) ENDFOREACH (_x ${SIP_DISABLE_FEATURES}) SET(_message "-DMESSAGE=Generating CPP code for module ${MODULE_NAME}") SET(_sip_output_files) FOREACH(CONCAT_NUM RANGE 0 ${SIP_CONCAT_PARTS} ) IF( ${CONCAT_NUM} LESS ${SIP_CONCAT_PARTS} ) SET(_sip_output_files ${_sip_output_files} ${CMAKE_CURRENT_SIP_OUTPUT_DIR}/sip${_child_module_name}part${CONCAT_NUM}.cpp ) ENDIF( ${CONCAT_NUM} LESS ${SIP_CONCAT_PARTS} ) ENDFOREACH(CONCAT_NUM RANGE 0 ${SIP_CONCAT_PARTS} ) IF(NOT WIN32) SET(TOUCH_COMMAND touch) ELSE(NOT WIN32) SET(TOUCH_COMMAND echo) # instead of a touch command, give out the name and append to the files # this is basically what the touch command does. FOREACH(filename ${_sip_output_files}) FILE(APPEND filename "") ENDFOREACH(filename ${_sip_output_files}) ENDIF(NOT WIN32) ADD_CUSTOM_COMMAND( - OUTPUT ${_sip_output_files} + OUTPUT ${_sip_output_files} COMMAND ${CMAKE_COMMAND} -E echo ${message} - COMMAND ${TOUCH_COMMAND} ${_sip_output_files} + COMMAND ${TOUCH_COMMAND} ${_sip_output_files} COMMAND ${SIP_EXECUTABLE} ${_sip_tags} ${_sip_x} ${SIP_EXTRA_OPTIONS} -j ${SIP_CONCAT_PARTS} -c ${CMAKE_CURRENT_SIP_OUTPUT_DIR} ${_sip_includes} ${_abs_module_sip} DEPENDS ${_abs_module_sip} ${SIP_EXTRA_FILES_DEPEND} ) # not sure if type MODULE could be uses anywhere, limit to cygwin for now IF (CYGWIN) ADD_LIBRARY(${_logical_name} MODULE ${_sip_output_files} ) ELSE (CYGWIN) ADD_LIBRARY(${_logical_name} SHARED ${_sip_output_files} ) ENDIF (CYGWIN) TARGET_LINK_LIBRARIES(${_logical_name} ${PYTHON_LIBRARY}) TARGET_LINK_LIBRARIES(${_logical_name} ${EXTRA_LINK_LIBRARIES}) SET_TARGET_PROPERTIES(${_logical_name} PROPERTIES PREFIX "" OUTPUT_NAME ${_child_module_name}) INSTALL(TARGETS ${_logical_name} DESTINATION "${PYTHON_SITE_PACKAGES_INSTALL_DIR}/${_parent_module_path}") ENDMACRO(ADD_SIP_PYTHON_MODULE) diff --git a/attic/modules/kde4_exec_via_sh.cmake b/attic/modules/kde4_exec_via_sh.cmake index 6b826ff..ffcdc3e 100644 --- a/attic/modules/kde4_exec_via_sh.cmake +++ b/attic/modules/kde4_exec_via_sh.cmake @@ -1,31 +1,29 @@ -# Copyright (c) 2006, Alexander Neundorf, +# SPDX-FileCopyrightText: 2006 Alexander Neundorf # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - +# SPDX-License-Identifier: BSD-3-Clause if (UNIX) -file(WRITE "${_filename}" +file(WRITE "${_filename}" "#!/bin/sh # created by cmake, don't edit, changes will be lost ${_library_path_variable}=${_ld_library_path}\${${_library_path_variable}:+:\$${_library_path_variable}} \"${_executable}\" \"$@\" ") # make it executable # since this is only executed on UNIX, it is safe to call chmod exec_program(chmod ARGS ug+x \"${_filename}\" OUTPUT_VARIABLE _dummy ) else (UNIX) file(TO_NATIVE_PATH "${_ld_library_path}" win_path) -file(WRITE "${_filename}" +file(WRITE "${_filename}" " set PATH=${win_path};$ENV{PATH} \"${_executable}\" %* ") endif (UNIX) diff --git a/cmake/FindQCollectionGenerator.cmake b/cmake/FindQCollectionGenerator.cmake index 315f5fa..b7ff0c8 100644 --- a/cmake/FindQCollectionGenerator.cmake +++ b/cmake/FindQCollectionGenerator.cmake @@ -1,94 +1,73 @@ #.rst: # FindQCollectionGenerator # ------------------------ # # Try to find the Qt help collection generator. # # This will define the following variables: # # ``QCollectionGenerator_FOUND`` # True if (the requested version of) Sphinx is available # ``QCollectionGenerator_VERSION`` # The version of the Qt help collection generator. Note that this not the # same as the version of Qt it is provided by. # ``QCollectionGenerator_QT_VERSION`` # The version of Qt that the Qt help collection generator is from. # ``QCollectionGenerator_EXECUTABLE`` # The path to the Qt help collection generator executable. # # If ``QCollectionGenerator_FOUND`` is TRUE, it will also define the following # imported target: # # ``QCollectionGenerator::Generator`` # The Qt help collection generator. # # In general we recommend using the imported target, as it is easier to use. # # Since 5.17.0. #============================================================================= -# Copyright 2015 Alex Merry +# SPDX-FileCopyrightText: 2015 Alex Merry # -# 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. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= find_program(QCollectionGenerator_EXECUTABLE NAMES qcollectiongenerator qcollectiongenerator-qt4 qcollectiongenerator-qt5 DOC "Qt help collection generator" ) if (QCollectionGenerator_EXECUTABLE) if(NOT TARGET QCollectionGenerator::Generator) add_executable(QCollectionGenerator::Generator IMPORTED) set_target_properties(QCollectionGenerator::Generator PROPERTIES IMPORTED_LOCATION "${QCollectionGenerator_EXECUTABLE}" ) endif() execute_process( COMMAND "${QCollectionGenerator_EXECUTABLE}" -v OUTPUT_VARIABLE _QCollectionGenerator_version_raw ERROR_VARIABLE _QCollectionGenerator_version_raw ) if (_QCollectionGenerator_version_raw MATCHES "^Qt Collection Generator version ([0-9]+(\\.[0-9]+)*) \\(Qt ([0-9]+(\\.[0-9]+)*)\\)") set(QCollectionGenerator_VERSION "${CMAKE_MATCH_1}") set(QCollectionGenerator_QT_VERSION "${CMAKE_MATCH_3}") endif() unset(_QCollectionGenerator_version_raw) endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(QCollectionGenerator FOUND_VAR QCollectionGenerator_FOUND REQUIRED_VARS QCollectionGenerator_EXECUTABLE VERSION_VAR QCollectionGenerator_VERSION ) mark_as_advanced(QCollectionGenerator_EXECUTABLE) diff --git a/cmake/FindSphinx.cmake b/cmake/FindSphinx.cmake index 7d489b6..dc83ec6 100644 --- a/cmake/FindSphinx.cmake +++ b/cmake/FindSphinx.cmake @@ -1,91 +1,70 @@ #.rst: # FindSphinx # ---------- # # Try to find the Sphinx documentation builder. # # This will define the following variables: # # ``Sphinx_FOUND`` # True if (the requested version of) Sphinx is available # ``Sphinx_VERSION`` # The version of the Sphinx documentation builder. # ``Sphinx_BUILD_EXECUTABLE`` # The path to the Sphinx documentation builder executable. # # If ``Sphinx_FOUND`` is TRUE, it will also define the following imported target: # # ``Sphinx::Build`` # The Sphinx documentation builder. # # In general we recommend using the imported target, as it is easier to use. # # Since 5.17.0. #============================================================================= -# Copyright 2015 Alex Merry +# SPDX-FileCopyrightText: 2015 Alex Merry # -# 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. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= # Distros sometimes rename Python executables to allow for parallel # installation of Python2 and Python3 versions find_program(Sphinx_BUILD_EXECUTABLE NAMES sphinx-build sphinx-build2 sphinx-build3 DOC "Sphinx Documentation Builder (https://www.sphinx-doc.org/)" ) if (Sphinx_BUILD_EXECUTABLE) if(NOT TARGET Sphinx::Build) add_executable(Sphinx::Build IMPORTED) set_target_properties(Sphinx::Build PROPERTIES IMPORTED_LOCATION "${Sphinx_BUILD_EXECUTABLE}" ) endif() execute_process( COMMAND "${Sphinx_BUILD_EXECUTABLE}" --version OUTPUT_VARIABLE _Sphinx_version_raw ERROR_VARIABLE _Sphinx_version_raw ) if (_Sphinx_version_raw MATCHES "^Sphinx \\([^)]*\\) ([0-9]+(\\.[0-9]+)*)") set(Sphinx_VERSION "${CMAKE_MATCH_1}") endif() unset(_Sphinx_version_raw) endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Sphinx FOUND_VAR Sphinx_FOUND REQUIRED_VARS Sphinx_BUILD_EXECUTABLE VERSION_VAR Sphinx_VERSION ) mark_as_advanced(Sphinx_BUILD_EXECUTABLE) diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 28a816a..3f84e4e 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -1,153 +1,132 @@ #============================================================================= -# Copyright 2000-2013 Kitware, Inc. -# Copyright 2014-2015 Alex Merry +# SPDX-FileCopyrightText: 2000-2013 Kitware, Inc. +# SPDX-FileCopyrightText: 2014-2015 Alex Merry # -# 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. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= include(CMakeDependentOption) find_package(Sphinx 1.2 MODULE) set_package_properties( Sphinx PROPERTIES URL "http://sphinx-doc.org/" DESCRIPTION "Tool to generate documentation." TYPE OPTIONAL PURPOSE "Required to build documentation for Extra CMake Modules." ) find_package(QCollectionGenerator MODULE) set_package_properties( QCollectionGenerator PROPERTIES URL "https://www.qt.io/" DESCRIPTION "Qt help collection generator." TYPE OPTIONAL PURPOSE "Required to build Extra CMake Modules documentation in Qt Help format." ) cmake_dependent_option( BUILD_HTML_DOCS "Build html help with Sphinx" ON "Sphinx_FOUND" OFF ) add_feature_info(BUILD_HTML_DOCS BUILD_HTML_DOCS "Generate HTML documentation for installed modules.") cmake_dependent_option( BUILD_MAN_DOCS "Build man pages with Sphinx" ON "Sphinx_FOUND" OFF ) add_feature_info(BUILD_MAN_DOCS BUILD_MAN_DOCS "Generate man page documentation for installed modules.") cmake_dependent_option( BUILD_QTHELP_DOCS "Build Qt help with Sphinx" OFF "Sphinx_FOUND;QCollectionGenerator_FOUND" OFF ) add_feature_info(BUILD_QTHELP_DOCS BUILD_QTHELP_DOCS "Generate QtHelp documentation for installed modules.") set(doc_formats "") if(BUILD_HTML_DOCS) list(APPEND doc_formats html) endif() if(BUILD_MAN_DOCS) list(APPEND doc_formats man) endif() if(BUILD_QTHELP_DOCS) list(APPEND doc_formats qthelp) set(qthelp_extra_commands COMMAND QCollectionGenerator::Generator ${CMAKE_CURRENT_BINARY_DIR}/qthelp/ExtraCMakeModules.qhcp ) endif() if(NOT doc_formats) return() endif() if (Sphinx_VERSION VERSION_LESS 1.3) set(sphinx_theme default) else() set(sphinx_theme classic) endif() configure_file(sphinx/conf.py.in conf.py @ONLY) configure_file(sphinx/ecm.css.in static/ecm.css) set(doc_format_outputs "") set(doc_format_last "") foreach(format ${doc_formats}) set(doc_format_output "doc_format_${format}") set(doc_format_log "build-${format}.log") add_custom_command( OUTPUT ${doc_format_output} COMMAND Sphinx::Build -c ${CMAKE_CURRENT_BINARY_DIR} -d ${CMAKE_CURRENT_BINARY_DIR}/doctrees -b ${format} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${format} > ${doc_format_log} # log stdout, pass stderr ${${format}_extra_commands} DEPENDS ${doc_format_last} COMMENT "sphinx-build ${format}: see ${CMAKE_CURRENT_BINARY_DIR}/${doc_format_log}" VERBATIM ) set_property(SOURCE ${doc_format_output} PROPERTY SYMBOLIC 1) list(APPEND doc_format_outputs ${doc_format_output}) set(doc_format_last ${doc_format_output}) endforeach() add_custom_target(documentation ALL DEPENDS ${doc_format_outputs}) if(BUILD_MAN_DOCS) file(GLOB man_rst RELATIVE ${ECM_SOURCE_DIR}/docs/manual ${ECM_SOURCE_DIR}/docs/manual/*.[1-9].rst) foreach(m ${man_rst}) if("x${m}" MATCHES "^x(.+)\\.([1-9])\\.rst$") set(name "${CMAKE_MATCH_1}") set(sec "${CMAKE_MATCH_2}") install( FILES ${CMAKE_CURRENT_BINARY_DIR}/man/${name}.${sec} DESTINATION ${MAN_INSTALL_DIR}/man${sec} ) endif() endforeach() endif() if(BUILD_HTML_DOCS) install( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION ${DOC_INSTALL_DIR} PATTERN .buildinfo EXCLUDE PATTERN objects.inv EXCLUDE ) endif() if(BUILD_QTHELP_DOCS) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/qthelp/ExtraCMakeModules.qch DESTINATION ${DOC_INSTALL_DIR} ) endif() diff --git a/docs/sphinx/conf.py.in b/docs/sphinx/conf.py.in index d32b53f..7fb2ab0 100644 --- a/docs/sphinx/conf.py.in +++ b/docs/sphinx/conf.py.in @@ -1,61 +1,56 @@ #============================================================================= # CMake - Cross Platform Makefile Generator -# Copyright 2000-2013 Kitware, Inc., Insight Software Consortium +# SPDX-FileCopyrightText: 2000-2013 Kitware Inc., Insight Software Consortium # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= import sys import os import re import glob sys.path.insert(0, r'@CMAKE_CURRENT_SOURCE_DIR@/sphinx/ext') source_suffix = '.rst' master_doc = 'index' project = 'Extra CMake Modules' copyright = 'KDE Developers' version = '@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@' # feature version release = '@PROJECT_VERSION@' # full version string primary_domain = 'ecm' exclude_patterns = [] extensions = ['ecm'] ecm_manuals = sorted(glob.glob(r'@CMAKE_CURRENT_SOURCE_DIR@/manual/*.rst')) ecm_manual_description = re.compile('^\.\. ecm-manual-description:(.*)$') man_pages = [] for fpath in ecm_manuals: try: name, sec, rst = os.path.basename(fpath).split('.') desc = None f = open(fpath, 'r') for l in f: m = ecm_manual_description.match(l) if m: desc = m.group(1).strip() break f.close() if desc: man_pages.append(('manual/%s.%s' % (name, sec), name, desc, [], int(sec))) else: sys.stderr.write("ERROR: No ecm-manual-description in '%s'\n" % fpath) except Exception as e: sys.stderr.write("ERROR: %s\n" % str(e)) man_show_urls = False html_show_sourcelink = True html_static_path = ['@CMAKE_CURRENT_BINARY_DIR@/static'] html_style = 'ecm.css' html_theme = '@sphinx_theme@' html_short_title = 'ECM %s documentation' % version html_favicon = '@CMAKE_CURRENT_SOURCE_DIR@/sphinx/kde-favicon.ico' diff --git a/docs/sphinx/ext/ecm.py b/docs/sphinx/ext/ecm.py index ed966bf..2bab34a 100644 --- a/docs/sphinx/ext/ecm.py +++ b/docs/sphinx/ext/ecm.py @@ -1,307 +1,287 @@ -# Copyright 2014 Alex Merry -# Based on cmake.py from CMake: -# Copyright 2000-2013 Kitware, Inc., Insight Software Consortium -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: +# SPDX-FileCopyrightText: 2014 Alex Merry # -# 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. +# Based on cmake.py from CMake: +# SPDX-FileCopyrightText: 2000-2013 Kitware Inc., Insight Software Consortium # -# 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. +# SPDX-License-Identifier: BSD-3-Clause import os import re # Monkey patch for pygments reporting an error when generator expressions are # used. # https://bitbucket.org/birkenfeld/pygments-main/issue/942/cmake-generator-expressions-not-handled from pygments.lexers import CMakeLexer from pygments.token import Name, Operator from pygments.lexer import bygroups CMakeLexer.tokens["args"].append(('(\\$<)(.+?)(>)', bygroups(Operator, Name.Variable, Operator))) # Monkey patch for sphinx generating invalid content for qcollectiongenerator # https://bitbucket.org/birkenfeld/sphinx/issue/1435/qthelp-builder-should-htmlescape-keywords from sphinx.util.pycompat import htmlescape from sphinx.builders.qthelp import QtHelpBuilder old_build_keywords = QtHelpBuilder.build_keywords def new_build_keywords(self, title, refs, subitems): old_items = old_build_keywords(self, title, refs, subitems) new_items = [] for item in old_items: before, rest = item.split("ref=\"", 1) ref, after = rest.split("\"") if ("<" in ref and ">" in ref): new_items.append(before + "ref=\"" + htmlescape(ref) + "\"" + after) else: new_items.append(item) return new_items QtHelpBuilder.build_keywords = new_build_keywords from docutils.parsers.rst import Directive, directives from docutils.transforms import Transform try: from docutils.utils.error_reporting import SafeString, ErrorString except ImportError: # error_reporting was not in utils before version 0.11: from docutils.error_reporting import SafeString, ErrorString from docutils import io, nodes from sphinx.directives import ObjectDescription from sphinx.domains import Domain, ObjType from sphinx.roles import XRefRole from sphinx.util.nodes import make_refnode from sphinx import addnodes class ECMModule(Directive): required_arguments = 1 optional_arguments = 0 final_argument_whitespace = True option_spec = {'encoding': directives.encoding} def __init__(self, *args, **keys): self.re_start = re.compile(r'^#\[(?P=*)\[\.rst:$') Directive.__init__(self, *args, **keys) def run(self): settings = self.state.document.settings if not settings.file_insertion_enabled: raise self.warning('"%s" directive disabled.' % self.name) env = self.state.document.settings.env rel_path, path = env.relfn2path(self.arguments[0]) path = os.path.normpath(path) encoding = self.options.get('encoding', settings.input_encoding) e_handler = settings.input_encoding_error_handler try: settings.record_dependencies.add(path) f = io.FileInput(source_path=path, encoding=encoding, error_handler=e_handler) except UnicodeEncodeError as error: raise self.severe('Problems with "%s" directive path:\n' 'Cannot encode input file path "%s" ' '(wrong locale?).' % (self.name, SafeString(path))) except IOError as error: raise self.severe('Problems with "%s" directive path:\n%s.' % (self.name, ErrorString(error))) raw_lines = f.read().splitlines() f.close() rst = None lines = [] for line in raw_lines: if rst is not None and rst != '#': # Bracket mode: check for end bracket pos = line.find(rst) if pos >= 0: if line[0] == '#': line = '' else: line = line[0:pos] rst = None else: # Line mode: check for .rst start (bracket or line) m = self.re_start.match(line) if m: rst = ']%s]' % m.group('eq') line = '' elif line == '#.rst:': rst = '#' line = '' elif rst == '#': if line == '#' or line[:2] == '# ': line = line[2:] else: rst = None line = '' elif rst is None: line = '' lines.append(line) if rst is not None and rst != '#': raise self.warning('"%s" found unclosed bracket "#[%s[.rst:" in %s' % (self.name, rst[1:-1], path)) self.state_machine.insert_input(lines, path) return [] class _ecm_index_entry: def __init__(self, desc): self.desc = desc def __call__(self, title, targetid): return ('pair', u'%s ; %s' % (self.desc, title), targetid, 'main') _ecm_index_objs = { 'manual': _ecm_index_entry('manual'), 'module': _ecm_index_entry('module'), 'find-module': _ecm_index_entry('find-module'), 'kde-module': _ecm_index_entry('kde-module'), 'toolchain': _ecm_index_entry('toolchain'), } def _ecm_object_inventory(env, document, line, objtype, targetid): inv = env.domaindata['ecm']['objects'] if targetid in inv: document.reporter.warning( 'ECM object "%s" also described in "%s".' % (targetid, env.doc2path(inv[targetid][0])), line=line) inv[targetid] = (env.docname, objtype) class ECMTransform(Transform): # Run this transform early since we insert nodes we want # treated as if they were written in the documents. default_priority = 210 def __init__(self, document, startnode): Transform.__init__(self, document, startnode) self.titles = {} def parse_title(self, docname): """Parse a document title as the first line starting in [A-Za-z0-9<] or fall back to the document basename if no such line exists. Return the title or False if the document file does not exist. """ env = self.document.settings.env title = self.titles.get(docname) if title is None: fname = os.path.join(env.srcdir, docname+'.rst') try: f = open(fname, 'r') except IOError: title = False else: for line in f: if len(line) > 0 and (line[0].isalnum() or line[0] == '<'): title = line.rstrip() break f.close() if title is None: title = os.path.basename(docname) self.titles[docname] = title return title def apply(self): env = self.document.settings.env # Treat some documents as ecm domain objects. objtype, sep, tail = env.docname.rpartition('/') make_index_entry = _ecm_index_objs.get(objtype) if make_index_entry: title = self.parse_title(env.docname) # Insert the object link target. targetid = '%s:%s' % (objtype, title) targetnode = nodes.target('', '', ids=[targetid]) self.document.insert(0, targetnode) # Insert the object index entry. indexnode = addnodes.index() indexnode['entries'] = [make_index_entry(title, targetid)] self.document.insert(0, indexnode) # Add to ecm domain object inventory _ecm_object_inventory(env, self.document, 1, objtype, targetid) class ECMObject(ObjectDescription): def handle_signature(self, sig, signode): # called from sphinx.directives.ObjectDescription.run() signode += addnodes.desc_name(sig, sig) return sig def add_target_and_index(self, name, sig, signode): targetid = '%s:%s' % (self.objtype, name) if targetid not in self.state.document.ids: signode['names'].append(targetid) signode['ids'].append(targetid) signode['first'] = (not self.names) self.state.document.note_explicit_target(signode) _ecm_object_inventory(self.env, self.state.document, self.lineno, self.objtype, targetid) make_index_entry = _ecm_index_objs.get(self.objtype) if make_index_entry: self.indexnode['entries'].append(make_index_entry(name, targetid)) class ECMXRefRole(XRefRole): # See sphinx.util.nodes.explicit_title_re; \x00 escapes '<'. _re = re.compile(r'^(.+?)(\s*)(?$', re.DOTALL) _re_sub = re.compile(r'^([^()\s]+)\s*\(([^()]*)\)$', re.DOTALL) def __call__(self, typ, rawtext, text, *args, **keys): # CMake cross-reference targets may contain '<' so escape # any explicit `` with '<' not preceded by whitespace. while True: m = ECMXRefRole._re.match(text) if m and len(m.group(2)) == 0: text = '%s\x00<%s>' % (m.group(1), m.group(3)) else: break return XRefRole.__call__(self, typ, rawtext, text, *args, **keys) class ECMDomain(Domain): """ECM domain.""" name = 'ecm' label = 'ECM' object_types = { 'module': ObjType('module', 'module'), 'kde-module': ObjType('kde-module', 'kde-module'), 'find-module': ObjType('find-module', 'find-module'), 'manual': ObjType('manual', 'manual'), 'toolchain': ObjType('toolchain', 'toolchain'), } directives = {} roles = { 'module': XRefRole(), 'kde-module': XRefRole(), 'find-module': XRefRole(), 'manual': XRefRole(), 'toolchain': XRefRole(), } initial_data = { 'objects': {}, # fullname -> docname, objtype } def clear_doc(self, docname): to_clear = [] for fullname, (fn, _) in self.data['objects'].items(): if fn == docname: to_clear.append(fullname) for fullname in to_clear: del self.data['objects'][fullname] def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode): targetid = '%s:%s' % (typ, target) obj = self.data['objects'].get(targetid) if obj is None: # TODO: warn somehow? return None return make_refnode(builder, fromdocname, obj[0], targetid, contnode, target) def get_objects(self): for refname, (docname, type) in self.data['objects'].items(): yield (refname, refname, type, docname, refname, 1) def setup(app): app.add_directive('ecm-module', ECMModule) app.add_transform(ECMTransform) app.add_domain(ECMDomain) diff --git a/find-modules/FindCanberra.cmake b/find-modules/FindCanberra.cmake index 20733e9..bda73ac 100644 --- a/find-modules/FindCanberra.cmake +++ b/find-modules/FindCanberra.cmake @@ -1,108 +1,87 @@ #.rst: # FindCanberra # ------------ # # Try to find Canberra event sound library. # # This will define the following variables: # # ``Canberra_FOUND`` # True if (the requested version of) Canberra is available # ``Canberra_VERSION`` # The version of Canberra # ``Canberra_LIBRARIES`` # The libraries of Canberra for use with target_link_libraries() # ``Canberra_INCLUDE_DIRS`` # The include dirs of Canberra for use with target_include_directories() # # If ``Canberra_FOUND`` is TRUE, it will also define the following imported # target: # # ``Canberra::Canberra`` # The Canberra library # # In general we recommend using the imported target, as it is easier to use. # Bear in mind, however, that if the target is in the link interface of an # exported library, it must be made available by the package config file. # # Since 5.56.0. #============================================================================= -# Copyright (c) 2012 Raphael Kubo da Costa -# Copyright (c) 2019 Harald Sitter +# SPDX-FileCopyrightText: 2012 Raphael Kubo da Costa +# SPDX-FileCopyrightText: 2019 Harald Sitter # -# 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. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= find_package(PkgConfig QUIET) pkg_check_modules(PC_Canberra libcanberra QUIET) find_library(Canberra_LIBRARIES NAMES canberra HINTS ${PC_Canberra_LIBRARY_DIRS} ) find_path(Canberra_INCLUDE_DIRS NAMES canberra.h HINTS ${PC_Canberra_INCLUDE_DIRS} ) set(Canberra_VERSION ${PC_Canberra_VERSION}) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Canberra FOUND_VAR Canberra_FOUND REQUIRED_VARS Canberra_LIBRARIES Canberra_INCLUDE_DIRS VERSION_VAR Canberra_VERSION ) if(Canberra_FOUND AND NOT TARGET Canberra::Canberra) add_library(Canberra::Canberra UNKNOWN IMPORTED) set_target_properties(Canberra::Canberra PROPERTIES IMPORTED_LOCATION "${Canberra_LIBRARIES}" INTERFACE_COMPILE_OPTIONS "${PC_Canberra_CFLAGS}" INTERFACE_INCLUDE_DIRECTORIES "${Canberra_INCLUDE_DIRS}" ) endif() mark_as_advanced(Canberra_LIBRARIES Canberra_INCLUDE_DIRS Canberra_VERSION) include(FeatureSummary) set_package_properties(Canberra PROPERTIES DESCRIPTION "Event sound library" URL "http://0pointer.de/lennart/projects/libcanberra" ) # Compatibility variables. In a previous life FindCanberra lived # in a number of different repos: don't break them if they use ECM but have not # been updated for this finder. set(CANBERRA_FOUND ${Canberra_FOUND}) set(CANBERRA_VERSION ${Canberra_VERSION}) set(CANBERRA_LIBRARIES ${Canberra_LIBRARIES}) set(CANBERRA_INCLUDE_DIRS ${Canberra_INCLUDE_DIRS}) mark_as_advanced(CANBERRA_VERSION CANBERRA_LIBRARIES CANBERRA_INCLUDE_DIRS) diff --git a/find-modules/FindEGL.cmake b/find-modules/FindEGL.cmake index 48e5172..1350f63 100644 --- a/find-modules/FindEGL.cmake +++ b/find-modules/FindEGL.cmake @@ -1,172 +1,151 @@ #.rst: # FindEGL # ------- # # Try to find EGL. # # This will define the following variables: # # ``EGL_FOUND`` # True if (the requested version of) EGL is available # ``EGL_VERSION`` # The version of EGL; note that this is the API version defined in the # headers, rather than the version of the implementation (eg: Mesa) # ``EGL_LIBRARIES`` # This can be passed to target_link_libraries() instead of the ``EGL::EGL`` # target # ``EGL_INCLUDE_DIRS`` # This should be passed to target_include_directories() if the target is not # used for linking # ``EGL_DEFINITIONS`` # This should be passed to target_compile_options() if the target is not # used for linking # # If ``EGL_FOUND`` is TRUE, it will also define the following imported target: # # ``EGL::EGL`` # The EGL library # # In general we recommend using the imported target, as it is easier to use. # Bear in mind, however, that if the target is in the link interface of an # exported library, it must be made available by the package config file. # # Since pre-1.0.0. #============================================================================= -# Copyright 2014 Alex Merry -# Copyright 2014 Martin Gräßlin +# SPDX-FileCopyrightText: 2014 Alex Merry +# SPDX-FileCopyrightText: 2014 Martin Gräßlin # -# 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. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake) include(CheckCXXSourceCompiles) include(CMakePushCheckState) ecm_find_package_version_check(EGL) # Use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) pkg_check_modules(PKG_EGL QUIET egl) set(EGL_DEFINITIONS ${PKG_EGL_CFLAGS_OTHER}) find_path(EGL_INCLUDE_DIR NAMES EGL/egl.h HINTS ${PKG_EGL_INCLUDE_DIRS} ) find_library(EGL_LIBRARY NAMES EGL HINTS ${PKG_EGL_LIBRARY_DIRS} ) # NB: We do *not* use the version information from pkg-config, as that # is the implementation version (eg: the Mesa version) if(EGL_INCLUDE_DIR) # egl.h has defines of the form EGL_VERSION_x_y for each supported # version; so the header for EGL 1.1 will define EGL_VERSION_1_0 and # EGL_VERSION_1_1. Finding the highest supported version involves # finding all these defines and selecting the highest numbered. file(READ "${EGL_INCLUDE_DIR}/EGL/egl.h" _EGL_header_contents) string(REGEX MATCHALL "[ \t]EGL_VERSION_[0-9_]+" _EGL_version_lines "${_EGL_header_contents}" ) unset(_EGL_header_contents) foreach(_EGL_version_line ${_EGL_version_lines}) string(REGEX REPLACE "[ \t]EGL_VERSION_([0-9_]+)" "\\1" _version_candidate "${_EGL_version_line}" ) string(REPLACE "_" "." _version_candidate "${_version_candidate}") if(NOT DEFINED EGL_VERSION OR EGL_VERSION VERSION_LESS _version_candidate) set(EGL_VERSION "${_version_candidate}") endif() endforeach() unset(_EGL_version_lines) endif() cmake_push_check_state(RESET) list(APPEND CMAKE_REQUIRED_LIBRARIES "${EGL_LIBRARY}") list(APPEND CMAKE_REQUIRED_INCLUDES "${EGL_INCLUDE_DIR}") check_cxx_source_compiles(" #include int main(int argc, char *argv[]) { EGLint x = 0; EGLDisplay dpy = 0; EGLContext ctx = 0; eglDestroyContext(dpy, ctx); }" HAVE_EGL) cmake_pop_check_state() set(required_vars EGL_INCLUDE_DIR HAVE_EGL) if(NOT EMSCRIPTEN) list(APPEND required_vars EGL_LIBRARY) endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(EGL FOUND_VAR EGL_FOUND REQUIRED_VARS ${required_vars} VERSION_VAR EGL_VERSION ) if(EGL_FOUND AND NOT TARGET EGL::EGL) if (EMSCRIPTEN) add_library(EGL::EGL INTERFACE IMPORTED) # Nothing further to be done, system include paths have headers and linkage is implicit. else() add_library(EGL::EGL UNKNOWN IMPORTED) set_target_properties(EGL::EGL PROPERTIES IMPORTED_LOCATION "${EGL_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${EGL_DEFINITIONS}" INTERFACE_INCLUDE_DIRECTORIES "${EGL_INCLUDE_DIR}" ) endif() endif() mark_as_advanced(EGL_LIBRARY EGL_INCLUDE_DIR HAVE_EGL) # compatibility variables set(EGL_LIBRARIES ${EGL_LIBRARY}) set(EGL_INCLUDE_DIRS ${EGL_INCLUDE_DIR}) set(EGL_VERSION_STRING ${EGL_VERSION}) include(FeatureSummary) set_package_properties(EGL PROPERTIES URL "https://www.khronos.org/egl/" DESCRIPTION "A platform-agnostic mechanism for creating rendering surfaces for use with other graphics libraries, such as OpenGL|ES and OpenVG." ) diff --git a/find-modules/FindFontconfig.cmake b/find-modules/FindFontconfig.cmake index 2981a9a..ee68b8f 100644 --- a/find-modules/FindFontconfig.cmake +++ b/find-modules/FindFontconfig.cmake @@ -1,118 +1,97 @@ #.rst: # FindFontconfig # -------------- # # Try to find Fontconfig. # Once done this will define the following variables: # # ``Fontconfig_FOUND`` # True if Fontconfig is available # ``Fontconfig_INCLUDE_DIRS`` # The include directory to use for the Fontconfig headers # ``Fontconfig_LIBRARIES`` # The Fontconfig libraries for linking # ``Fontconfig_DEFINITIONS`` # Compiler switches required for using Fontconfig # ``Fontconfig_VERSION`` # The version of Fontconfig that has been found # # If ``Fontconfig_FOUND`` is TRUE, it will also define the following # imported target: # # ``Fontconfig::Fontconfig`` # # Since 5.57.0. #============================================================================= -# Copyright (c) 2006,2007 Laurent Montel, -# Copyright (c) 2018 Volker Krause +# SPDX-FileCopyrightText: 2006, 2007 Laurent Montel +# SPDX-FileCopyrightText: 2018 Volker Krause # -# 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. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig QUIET) pkg_check_modules(PC_FONTCONFIG QUIET fontconfig) set(Fontconfig_DEFINITIONS ${PC_FONTCONFIG_CFLAGS_OTHER}) find_path(Fontconfig_INCLUDE_DIRS fontconfig/fontconfig.h PATHS ${PC_FONTCONFIG_INCLUDE_DIRS} /usr/X11/include ) find_library(Fontconfig_LIBRARIES NAMES fontconfig PATHS ${PC_FONTCONFIG_LIBRARY_DIRS} ) set(Fontconfig_VERSION ${PC_FONTCONFIG_VERSION}) if (NOT Fontconfig_VERSION) find_file(Fontconfig_VERSION_HEADER NAMES "fontconfig/fontconfig.h" HINTS ${Fontconfig_INCLUDE_DIRS} ) mark_as_advanced(Fontconfig_VERSION_HEADER) if (Fontconfig_VERSION_HEADER) file(READ ${Fontconfig_VERSION_HEADER} _fontconfig_version_header_content) string(REGEX MATCH "#define FC_MAJOR[ \t]+[0-9]+" Fontconfig_MAJOR_VERSION_MATCH ${_fontconfig_version_header_content}) string(REGEX MATCH "#define FC_MINOR[ \t]+[0-9]+" Fontconfig_MINOR_VERSION_MATCH ${_fontconfig_version_header_content}) string(REGEX MATCH "#define FC_REVISION[ \t]+[0-9]+" Fontconfig_PATCH_VERSION_MATCH ${_fontconfig_version_header_content}) string(REGEX REPLACE ".*FC_MAJOR[ \t]+(.*)" "\\1" Fontconfig_MAJOR_VERSION ${Fontconfig_MAJOR_VERSION_MATCH}) string(REGEX REPLACE ".*FC_MINOR[ \t]+(.*)" "\\1" Fontconfig_MINOR_VERSION ${Fontconfig_MINOR_VERSION_MATCH}) string(REGEX REPLACE ".*FC_REVISION[ \t]+(.*)" "\\1" Fontconfig_PATCH_VERSION ${Fontconfig_PATCH_VERSION_MATCH}) set(Fontconfig_VERSION "${Fontconfig_MAJOR_VERSION}.${Fontconfig_MINOR_VERSION}.${Fontconfig_PATCH_VERSION}") endif() endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Fontconfig FOUND_VAR Fontconfig_FOUND REQUIRED_VARS Fontconfig_LIBRARIES Fontconfig_INCLUDE_DIRS VERSION_VAR Fontconfig_VERSION ) mark_as_advanced(Fontconfig_LIBRARIES Fontconfig_INCLUDE_DIRS) if(Fontconfig_FOUND AND NOT TARGET Fontconfig::Fontconfig) add_library(Fontconfig::Fontconfig UNKNOWN IMPORTED) set_target_properties(Fontconfig::Fontconfig PROPERTIES IMPORTED_LOCATION "${Fontconfig_LIBRARIES}" INTERFACE_INCLUDE_DIRECTORIES "${Fontconfig_INCLUDE_DIRS}" INTERFACE_COMPILER_DEFINITIONS "${Fontconfig_DEFINITIONS}" ) endif() # backward compatibility, remove in kf6 set(FONTCONFIG_INCLUDE_DIR "${Fontconfig_INCLUDE_DIRS}") set(FONTCONFIG_LIBRARIES "${Fontconfig_LIBRARIES}") set(FONTCONFIG_DEFINITIONS "${Fontconfig_DEFINITIONS}") mark_as_advanced(FONTCONFIG_INCLUDE_DIR FONTCONFIG_LIBRARIES FONTCONFIG_DEFINITIONS) include(FeatureSummary) set_package_properties(Fontconfig PROPERTIES URL "https://www.fontconfig.org/" DESCRIPTION "Fontconfig is a library for configuring and customizing font access" ) diff --git a/find-modules/FindGLIB2.cmake b/find-modules/FindGLIB2.cmake index 2049522..454da9b 100644 --- a/find-modules/FindGLIB2.cmake +++ b/find-modules/FindGLIB2.cmake @@ -1,100 +1,79 @@ #.rst: # FindGLIB2 # --------- # # Try to locate the GLib2 library. # If found, this will define the following variables: # # ``GLIB2_FOUND`` # True if the GLib2 library is available # ``GLIB2_INCLUDE_DIRS`` # The GLib2 include directories # ``GLIB2_LIBRARIES`` # The GLib2 libraries for linking # ``GLIB2_INCLUDE_DIR`` # Deprecated, use ``GLIB2_INCLUDE_DIRS`` # ``GLIB2_LIBRARY`` # Deprecated, use ``GLIB2_LIBRARIES`` # # If ``GLIB2_FOUND`` is TRUE, it will also define the following # imported target: # # ``GLIB2::GLIB2`` # The GLIB2 library # # Since 5.41.0. #============================================================================= -# Copyright (c) 2008 Laurent Montel, +# SPDX-FileCopyrightText: 2008 Laurent Montel # -# 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. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= find_package(PkgConfig) pkg_check_modules(PC_GLIB2 QUIET glib-2.0) find_path(GLIB2_INCLUDE_DIRS NAMES glib.h HINTS ${PC_GLIB2_INCLUDEDIR} PATH_SUFFIXES glib-2.0) find_library(GLIB2_LIBRARIES NAMES glib-2.0 HINTS ${PC_GLIB2_LIBDIR} ) # search the glibconfig.h include dir under the same root where the library is found get_filename_component(glib2LibDir "${GLIB2_LIBRARIES}" PATH) find_path(GLIB2_INTERNAL_INCLUDE_DIR glibconfig.h PATH_SUFFIXES glib-2.0/include HINTS ${PC_GLIB2_INCLUDEDIR} "${glib2LibDir}" ${CMAKE_SYSTEM_LIBRARY_PATH}) # not sure if this include dir is optional or required # for now it is optional if(GLIB2_INTERNAL_INCLUDE_DIR) list(APPEND GLIB2_INCLUDE_DIRS "${GLIB2_INTERNAL_INCLUDE_DIR}") endif() # Deprecated synonyms set(GLIB2_INCLUDE_DIR "${GLIB2_INCLUDE_DIRS}") set(GLIB2_LIBRARY "${GLIB2_LIBRARIES}") include(FindPackageHandleStandardArgs) find_package_handle_standard_args(GLIB2 DEFAULT_MSG GLIB2_LIBRARIES GLIB2_INCLUDE_DIRS) if(GLIB2_FOUND AND NOT TARGET GLIB2::GLIB2) add_library(GLIB2::GLIB2 UNKNOWN IMPORTED) set_target_properties(GLIB2::GLIB2 PROPERTIES IMPORTED_LOCATION "${GLIB2_LIBRARIES}" INTERFACE_INCLUDE_DIRECTORIES "${GLIB2_INCLUDE_DIRS}") endif() mark_as_advanced(GLIB2_INCLUDE_DIRS GLIB2_INCLUDE_DIR GLIB2_LIBRARIES GLIB2_LIBRARY) include(FeatureSummary) set_package_properties(GLIB2 PROPERTIES URL "https://wiki.gnome.org/Projects/GLib" DESCRIPTION "Event loop and utility library") diff --git a/find-modules/FindGperf.cmake b/find-modules/FindGperf.cmake index d8c4d89..10bb9cd 100644 --- a/find-modules/FindGperf.cmake +++ b/find-modules/FindGperf.cmake @@ -1,128 +1,107 @@ #.rst: # FindGperf # ----------- # # Try to find GNU gperf. # # If the gperf executable is not in your PATH, you can provide # an alternative name or full path location with the ``Gperf_EXECUTABLE`` # variable. # # This will define the following variables: # # ``Gperf_FOUND`` # True if gperf is available. # # ``Gperf_EXECUTABLE`` # The gperf executable. # # If ``Gperf_FOUND`` is TRUE, it will also define the following imported # target: # # ``GPerf::Gperf`` # The gperf executable. # # and the following public function: # # ecm_gperf_generate( # [GENERATION_FLAGS ]) # # Run ``gperf`` on ```` to generate ````, adding it to # the ```` variable which contains the source for the target # where ```` is going to be built. The optional # ``GENERATION_FLAGS`` argument is needed to pass extra parameters to # ``gperf`` (note you cannot override that way the output file). # # A simple invocation would be: # # .. code-block:: cmake # # ecm_gperf_generate(simple.gperf ${CMAKE_CURRENT_BINARY_DIR}/simple.h MySources) # # Since 5.35.0. #============================================================================= -# Copyright 2016-2017 Pino Toscano +# SPDX-FileCopyrightText: 2016-2017 Pino Toscano # -# 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. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake) ecm_find_package_version_check(Gperf) # Find gperf find_program(Gperf_EXECUTABLE NAMES gperf) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Gperf FOUND_VAR Gperf_FOUND REQUIRED_VARS Gperf_EXECUTABLE ) mark_as_advanced(Gperf_EXECUTABLE) if (Gperf_FOUND) if (NOT TARGET GPerf::Gperf) add_executable(GPerf::Gperf IMPORTED) set_target_properties(GPerf::Gperf PROPERTIES IMPORTED_LOCATION "${Gperf_EXECUTABLE}" ) endif() endif() include(FeatureSummary) set_package_properties(Gperf PROPERTIES URL "https://www.gnu.org/software/gperf/" DESCRIPTION "Perfect hash function generator" ) include(CMakeParseArguments) function(ecm_gperf_generate input_file output_file out_var) # Parse arguments set(oneValueArgs GENERATION_FLAGS) cmake_parse_arguments(ARGS "" "${oneValueArgs}" "" ${ARGN}) if(ARGS_UNPARSED_ARGUMENTS) message(FATAL_ERROR "Unknown keywords given to ecm_gperf_generate(): \"${ARGS_UNPARSED_ARGUMENTS}\"") endif() get_filename_component(_infile ${input_file} ABSOLUTE) set(_extraopts "${ARGS_GENERATION_FLAGS}") separate_arguments(_extraopts) add_custom_command(OUTPUT ${output_file} COMMAND ${Gperf_EXECUTABLE} ${_extraopts} --output-file=${output_file} ${_infile} DEPENDS ${_infile} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} VERBATIM ) set_property(SOURCE ${output_file} PROPERTY SKIP_AUTOMOC ON) list(APPEND ${out_var} "${output_file}") set(${out_var} ${${out_var}} PARENT_SCOPE) endfunction() diff --git a/find-modules/FindIcoTool.cmake b/find-modules/FindIcoTool.cmake index a934d4c..40a4591 100644 --- a/find-modules/FindIcoTool.cmake +++ b/find-modules/FindIcoTool.cmake @@ -1,80 +1,59 @@ #.rst: # FindIcoTool # ----------- # # Try to find icotool. # # If the icotool executable is not in your PATH, you can provide # an alternative name or full path location with the ``IcoTool_EXECUTABLE`` # variable. # # This will define the following variables: # # ``IcoTool_FOUND`` # True if icotool is available. # # ``IcoTool_EXECUTABLE`` # The icotool executable. # # If ``IcoTool_FOUND`` is TRUE, it will also define the following imported # target: # # ``IcoTool::IcoTool`` # The icotool executable. # # Since 5.49. #============================================================================= -# Copyright 2017 Vincent Pinon -# Copyright 2014 Alex Merry +# SPDX-FileCopyrightText: 2017 Vincent Pinon +# SPDX-FileCopyrightText: 2014 Alex Merry # -# 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. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake) ecm_find_package_version_check(IcoTool) find_program(IcoTool_EXECUTABLE NAMES icotool) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(IcoTool FOUND_VAR IcoTool_FOUND REQUIRED_VARS IcoTool_EXECUTABLE ) mark_as_advanced(IcoTool_EXECUTABLE) if (IcoTool_FOUND) if (NOT TARGET IcoTool::IcoTool) add_executable(IcoTool::IcoTool IMPORTED) set_target_properties(IcoTool::IcoTool PROPERTIES IMPORTED_LOCATION "${IcoTool_EXECUTABLE}" ) endif() endif() include(FeatureSummary) set_package_properties(IcoTool PROPERTIES URL "https://www.nongnu.org/icoutils/" DESCRIPTION "Executable that converts a collection of PNG files into a Windows icon file" ) diff --git a/find-modules/FindInotify.cmake b/find-modules/FindInotify.cmake index cc4aa29..8b0f851 100644 --- a/find-modules/FindInotify.cmake +++ b/find-modules/FindInotify.cmake @@ -1,81 +1,62 @@ #.rst: # FindInotify # -------------- # # Try to find inotify on this system. This finds: # - libinotify on Unix like systems, or # - the kernel's inotify on Linux systems. # # This will define the following variables: # # ``Inotify_FOUND`` # True if inotify is available # ``Inotify_LIBRARIES`` # This has to be passed to target_link_libraries() # ``Inotify_INCLUDE_DIRS`` # This has to be passed to target_include_directories() # # On Linux, the libraries and include directories are empty, # even though ``Inotify_FOUND`` may be set to TRUE. This is because # no special includes or libraries are needed. On other systems # these may be needed to use inotify. # # Since 5.32.0. #============================================================================= -# Copyright 2016 Tobias C. Berner -# Copyright 2017 Adriaan de Groot +# SPDX-FileCopyrightText: 2016 Tobias C. Berner +# SPDX-FileCopyrightText: 2017 Adriaan de Groot # -# 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. -# -# 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. +# SPDX-License-Identifier: BSD-2-Clause #============================================================================= find_path(Inotify_INCLUDE_DIRS sys/inotify.h) if(Inotify_INCLUDE_DIRS) # On Linux there is no library to link against, on the BSDs there is. # On the BSD's, inotify is implemented through a library, libinotify. if( CMAKE_SYSTEM_NAME MATCHES "Linux") set(Inotify_FOUND TRUE) set(Inotify_LIBRARIES "") set(Inotify_INCLUDE_DIRS "") else() find_library(Inotify_LIBRARIES NAMES inotify) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Inotify FOUND_VAR Inotify_FOUND REQUIRED_VARS Inotify_LIBRARIES Inotify_INCLUDE_DIRS ) mark_as_advanced(Inotify_LIBRARIES Inotify_INCLUDE_DIRS) include(FeatureSummary) set_package_properties(Inotify PROPERTIES URL "https://github.com/libinotify-kqueue/" DESCRIPTION "inotify API on the *BSD family of operating systems." ) endif() else() set(Inotify_FOUND FALSE) endif() -mark_as_advanced(Inotify_LIBRARIES Inotify_INCLUDE_DIRS) +mark_as_advanced(Inotify_LIBRARIES Inotify_INCLUDE_DIRS) diff --git a/find-modules/FindKF5.cmake b/find-modules/FindKF5.cmake index 9be73a9..129cf2c 100644 --- a/find-modules/FindKF5.cmake +++ b/find-modules/FindKF5.cmake @@ -1,124 +1,103 @@ #.rst: # FindKF5 # ------- # # Find KDE Frameworks 5 with a single find_package() call. # # This will use the package config files provided by the individual frameworks. # For example, if you wish to find KArchive, which presents itself to CMake as # KF5Archive (ie: you would do ``find_package(KF5Archive)`` to find it # directly), you can do # # .. code-block:: cmake # # find_package(KF5 COMPONENTS Archive) # # If all the required components (those given in the COMPONENTS argument, but # not those given in the OPTIONAL_COMPONENTS argument) are found, ``KF5_FOUND`` # will be set to true. Otherwise, it will be set to false. # # Since pre-1.0.0. #============================================================================= -# Copyright 2014 Alex Merry -# Copyright 2013 Stephen Kelly +# SPDX-FileCopyrightText: 2014 Alex Merry +# SPDX-FileCopyrightText: 2013 Stephen Kelly # -# 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. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake) ecm_find_package_version_check(KF5) if (NOT KF5_FIND_COMPONENTS) set(KF5_NOT_FOUND_MESSAGE "The KF5 package requires at least one component") set(KF5_FOUND False) return() endif() set(_quiet_arg) if (KF5_FIND_QUIETLY) set(_quiet_arg QUIET) endif() set(_exact_arg) if (KF5_FIND_EXACT) set(_exact_arg EXACT) endif() include(FindPackageHandleStandardArgs) include(FeatureSummary) set(KF5_VERSION) foreach(_module ${KF5_FIND_COMPONENTS}) find_package(KF5${_module} ${KF5_FIND_VERSION} ${_exact_arg} ${_quiet_arg} CONFIG ) # CMake >= 3.17 wants to be explictly told we are fine with name mismatch here set(_name_mismatched_arg) if(NOT CMAKE_VERSION VERSION_LESS 3.17) set(_name_mismatched_arg NAME_MISMATCHED) endif() find_package_handle_standard_args(KF5${_module} CONFIG_MODE ${_name_mismatched_arg}) if (KF5_FIND_REQUIRED AND KF5_FIND_REQUIRED_${_module}) # If the component was required, we tell FeatureSummary so that it # will be displayed in the correct list. We do not use the REQUIRED # argument of find_package() to allow all the missing frameworks # to be listed at once (fphsa will error out at the end of this file # anyway). set_package_properties(KF5${_module} PROPERTIES TYPE REQUIRED) endif() # Component-based find modules are expected to set # __FOUND and __VERSION variables, # but the find_package calls above will have set KF5_* # variables. set(KF5_${_module}_FOUND ${KF5${_module}_FOUND}) if(KF5${_module}_FOUND) set(KF5_${_module}_VERSION ${KF5${_module}_VERSION}) # make KF5_VERSION the minimum found version if(NOT KF5_VERSION OR KF5_VERSION VERSION_GREATER KF5${_module}_VERSION) set(KF5_VERSION ${KF5${_module}_VERSION}) endif() endif() endforeach() # Annoyingly, find_package_handle_standard_args requires you to provide # REQUIRED_VARS even when using HANDLE_COMPONENTS, but all we actually # care about is whether the required components were found. So we provide # a dummy variable that is just set to something that will be printed # on success. set(_dummy_req_var "success") find_package_handle_standard_args(KF5 FOUND_VAR KF5_FOUND REQUIRED_VARS _dummy_req_var VERSION_VAR KF5_VERSION HANDLE_COMPONENTS ) diff --git a/find-modules/FindLibExiv2.cmake b/find-modules/FindLibExiv2.cmake index eee84a6..93f77ff 100644 --- a/find-modules/FindLibExiv2.cmake +++ b/find-modules/FindLibExiv2.cmake @@ -1,118 +1,96 @@ #.rst: # FindLibExiv2 # ------------ # # Try to find the Exiv2 library. # # This will define the following variables: # # ``LibExiv2_FOUND`` # True if (the requested version of) Exiv2 is available # # ``LibExiv2_VERSION`` # The version of Exiv2 # # ``LibExiv2_INCLUDE_DIRS`` # The include dirs of Exiv2 for use with target_include_directories() # # ``LibExiv2_LIBRARIES`` # The Exiv2 library for use with target_link_libraries(). # This can be passed to target_link_libraries() instead of # the ``LibExiv2::LibExiv2`` target # # If ``LibExiv2_FOUND`` is TRUE, it will also define the following imported # target: # # ``LibExiv2::LibExiv2`` # The Exiv2 library # # In general we recommend using the imported target, as it is easier to use. # Bear in mind, however, that if the target is in the link interface of an # exported library, it must be made available by the package config file. # # Since 5.53.0. # #============================================================================= -# Copyright (c) 2018, Christophe Giboudeaux, -# Copyright (c) 2010, Alexander Neundorf, -# Copyright (c) 2008, Gilles Caulier, +# SPDX-FileCopyrightText: 2018 Christophe Giboudeaux +# SPDX-FileCopyrightText: 2010 Alexander Neundorf +# SPDX-FileCopyrightText: 2008 Gilles Caulier # -# -# 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. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= find_package(PkgConfig QUIET) pkg_check_modules(PC_EXIV2 QUIET exiv2) find_path(LibExiv2_INCLUDE_DIRS NAMES exiv2/exif.hpp HINTS ${PC_EXIV2_INCLUDEDIR} ) find_library(LibExiv2_LIBRARIES NAMES exiv2 libexiv2 HINTS ${PC_EXIV2_LIBRARY_DIRS} ) set(LibExiv2_VERSION ${PC_EXIV2_VERSION}) if(NOT LibExiv2_VERSION AND DEFINED LibExiv2_INCLUDE_DIRS) # With exiv >= 0.27, the version #defines are in exv_conf.h instead of version.hpp foreach(_exiv2_version_file "version.hpp" "exv_conf.h") if(EXISTS "${LibExiv2_INCLUDE_DIRS}/exiv2/${_exiv2_version_file}") file(READ "${LibExiv2_INCLUDE_DIRS}/exiv2/${_exiv2_version_file}" _exiv_version_file_content) string(REGEX MATCH "#define EXIV2_MAJOR_VERSION[ ]+\\([0-9]+\\)" EXIV2_MAJOR_VERSION_MATCH ${_exiv_version_file_content}) string(REGEX MATCH "#define EXIV2_MINOR_VERSION[ ]+\\([0-9]+\\)" EXIV2_MINOR_VERSION_MATCH ${_exiv_version_file_content}) string(REGEX MATCH "#define EXIV2_PATCH_VERSION[ ]+\\([0-9]+\\)" EXIV2_PATCH_VERSION_MATCH ${_exiv_version_file_content}) if(EXIV2_MAJOR_VERSION_MATCH) string(REGEX REPLACE ".*_MAJOR_VERSION[ ]+\\((.*)\\)" "\\1" EXIV2_MAJOR_VERSION ${EXIV2_MAJOR_VERSION_MATCH}) string(REGEX REPLACE ".*_MINOR_VERSION[ ]+\\((.*)\\)" "\\1" EXIV2_MINOR_VERSION ${EXIV2_MINOR_VERSION_MATCH}) string(REGEX REPLACE ".*_PATCH_VERSION[ ]+\\((.*)\\)" "\\1" EXIV2_PATCH_VERSION ${EXIV2_PATCH_VERSION_MATCH}) endif() endif() endforeach() set(LibExiv2_VERSION "${EXIV2_MAJOR_VERSION}.${EXIV2_MINOR_VERSION}.${EXIV2_PATCH_VERSION}") endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(LibExiv2 FOUND_VAR LibExiv2_FOUND REQUIRED_VARS LibExiv2_LIBRARIES LibExiv2_INCLUDE_DIRS VERSION_VAR LibExiv2_VERSION ) mark_as_advanced(LibExiv2_INCLUDE_DIRS LibExiv2_LIBRARIES) if(LibExiv2_FOUND AND NOT TARGET LibExiv2::LibExiv2) add_library(LibExiv2::LibExiv2 UNKNOWN IMPORTED) set_target_properties(LibExiv2::LibExiv2 PROPERTIES IMPORTED_LOCATION "${LibExiv2_LIBRARIES}" INTERFACE_INCLUDE_DIRECTORIES "${LibExiv2_INCLUDE_DIRS}" ) endif() include(FeatureSummary) set_package_properties(LibExiv2 PROPERTIES URL "https://www.exiv2.org" DESCRIPTION "Image metadata support" ) diff --git a/find-modules/FindLibGit2.cmake b/find-modules/FindLibGit2.cmake index eaf227f..4f82301 100644 --- a/find-modules/FindLibGit2.cmake +++ b/find-modules/FindLibGit2.cmake @@ -1,132 +1,111 @@ #.rst: # FindLibGit2 # ----------- # # Try to find libgit2 on a Unix system. # # This will define the following variables: # # ``LIBGIT2_FOUND`` # True if (the requested version of) libgit2 is available # ``LIBGIT2_VERSION`` # The version of libgit2 # ``LIBGIT2_LIBRARIES`` # This can be passed to target_link_libraries() instead of the ``LibGit2::LibGit2`` # target # ``LIBGIT2_INCLUDE_DIRS`` # This should be passed to target_include_directories() if the target is not # used for linking # ``LIBGIT2_DEFINITIONS`` # This should be passed to target_compile_options() if the target is not # used for linking # # If ``LIBGIT2_FOUND`` is TRUE, it will also define the following imported target: # # ``LibGit2::LibGit2`` # The libgit2 library # # In general we recommend using the imported target, as it is easier to use. # Bear in mind, however, that if the target is in the link interface of an # exported library, it must be made available by the package config file. # # Since 1.3.0. #============================================================================= -# Copyright 2014 Alex Merry -# Copyright 2014 Martin Gräßlin -# Copyright 2014 Christoph Cullmann +# SPDX-FileCopyrightText: 2014 Alex Merry +# SPDX-FileCopyrightText: 2014 Martin Gräßlin +# SPDX-FileCopyrightText: 2014 Christoph Cullmann # -# 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. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake) ecm_find_package_version_check(LibGit2) # Use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) pkg_check_modules(PKG_GIT2 QUIET git2) set(LIBGIT2_DEFINITIONS ${PKG_GIT2_CFLAGS_OTHER}) find_path(LIBGIT2_INCLUDE_DIR NAMES git2.h HINTS ${PKG_GIT2_INCLUDE_DIRS} ) find_library(LIBGIT2_LIBRARY NAMES git2 HINTS ${PKG_GIT2_LIBRARY_DIRS} ) # get version from header, should work on windows, too if(LIBGIT2_INCLUDE_DIR) file(STRINGS "${LIBGIT2_INCLUDE_DIR}/git2/version.h" LIBGIT2_H REGEX "^#define LIBGIT2_VERSION \"[^\"]*\"$") string(REGEX REPLACE "^.*LIBGIT2_VERSION \"([0-9]+).*$" "\\1" LIBGIT2_VERSION_MAJOR "${LIBGIT2_H}") string(REGEX REPLACE "^.*LIBGIT2_VERSION \"[0-9]+\\.([0-9]+).*$" "\\1" LIBGIT2_VERSION_MINOR "${LIBGIT2_H}") string(REGEX REPLACE "^.*LIBGIT2_VERSION \"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" LIBGIT2_VERSION_PATCH "${LIBGIT2_H}") set(LIBGIT2_VERSION "${LIBGIT2_VERSION_MAJOR}.${LIBGIT2_VERSION_MINOR}.${LIBGIT2_VERSION_PATCH}") set(LIBGIT2_MAJOR_VERSION "${LIBGIT2_VERSION_MAJOR}") set(LIBGIT2_MINOR_VERSION "${LIBGIT2_VERSION_MINOR}") set(LIBGIT2_PATCH_VERSION "${LIBGIT2_VERSION_PATCH}") unset(LIBGIT2_H) endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(LibGit2 FOUND_VAR LIBGIT2_FOUND REQUIRED_VARS LIBGIT2_LIBRARY LIBGIT2_INCLUDE_DIR VERSION_VAR LIBGIT2_VERSION ) if(LIBGIT2_FOUND AND NOT TARGET LibGit2::LibGit2) add_library(LibGit2::LibGit2 UNKNOWN IMPORTED) set_target_properties(LibGit2::LibGit2 PROPERTIES IMPORTED_LOCATION "${LIBGIT2_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${LIBGIT2_DEFINITIONS}" INTERFACE_INCLUDE_DIRECTORIES "${LIBGIT2_INCLUDE_DIR}" ) endif() mark_as_advanced(LIBGIT2_LIBRARY LIBGIT2_INCLUDE_DIR) set(LIBGIT2_LIBRARIES ${LIBGIT2_LIBRARY}) set(LIBGIT2_INCLUDE_DIRS ${LIBGIT2_INCLUDE_DIR}) include(FeatureSummary) set_package_properties(LibGit2 PROPERTIES URL "https://libgit2.github.com/" DESCRIPTION "A plain C library to interface with the git version control system." ) diff --git a/find-modules/FindOpenEXR.cmake b/find-modules/FindOpenEXR.cmake index a8e3ea7..6245b42 100644 --- a/find-modules/FindOpenEXR.cmake +++ b/find-modules/FindOpenEXR.cmake @@ -1,161 +1,140 @@ #.rst: # FindOpenEXR # ----------- # # Try to find the OpenEXR libraries. # # This will define the following variables: # # ``OpenEXR_FOUND`` # True if OpenEXR is available # ``OpenEXR_LIBRARIES`` # Link to these to use OpenEXR # ``OpenEXR_INCLUDE_DIRS`` # Include directory for OpenEXR # ``OpenEXR_DEFINITIONS`` # Compiler flags required to link against OpenEXR # # and the following imported targets: # # ``OpenEXR::IlmImf`` # The OpenEXR core library # # In general we recommend using the imported target, as it is easier to use. # Bear in mind, however, that if the target is in the link interface of an # exported library, it must be made available by the package config file. # # Since pre-1.0.0. #============================================================================= -# Copyright 2013-2014 Alex Merry -# Copyright 2006 Alexander Neundorf +# SPDX-FileCopyrightText: 2013-2014 Alex Merry +# SPDX-FileCopyrightText: 2006 Alexander Neundorf # -# 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. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake) ecm_find_package_version_check(OpenEXR) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) pkg_check_modules(PC_OpenEXR QUIET OpenEXR) set(OpenEXR_DEFINITIONS ${PC_OpenEXR_CFLAGS_OTHER}) find_path(OpenEXR_INCLUDE_DIR ImfRgbaFile.h PATHS ${PC_OpenEXR_INCLUDEDIR} ${PC_OpenEXR_INCLUDE_DIRS} PATH_SUFFIXES OpenEXR ) # Required libraries for OpenEXR find_library(OpenEXR_HALF_LIBRARY NAMES Half PATHS ${PC_OpenEXR_LIBDIR} ${PC_OpenEXR_LIBRARY_DIRS} ) find_library(OpenEXR_IEX_LIBRARY NAMES Iex PATHS ${PC_OpenEXR_LIBDIR} ${PC_OpenEXR_LIBRARY_DIRS} ) find_library(OpenEXR_IMATH_LIBRARY NAMES Imath PATHS ${PC_OpenEXR_LIBDIR} ${PC_OpenEXR_LIBRARY_DIRS} ) find_library(OpenEXR_ILMTHREAD_LIBRARY NAMES IlmThread PATHS ${PC_OpenEXR_LIBDIR} ${PC_OpenEXR_LIBRARY_DIRS} ) # This is the actual OpenEXR library find_library(OpenEXR_ILMIMF_LIBRARY NAMES IlmImf PATHS ${PC_OpenEXR_LIBDIR} ${PC_OpenEXR_LIBRARY_DIRS} ) set(_OpenEXR_deps ${OpenEXR_HALF_LIBRARY} ${OpenEXR_IEX_LIBRARY} ${OpenEXR_IMATH_LIBRARY} ${OpenEXR_ILMTHREAD_LIBRARY}) set(OpenEXR_LIBRARIES ${_OpenEXR_deps} ${OpenEXR_ILMIMF_LIBRARY}) if (OpenEXR_INCLUDE_DIR AND EXISTS "${OpenEXR_INCLUDE_DIR}/OpenEXRConfig.h") file(STRINGS "${OpenEXR_INCLUDE_DIR}/OpenEXRConfig.h" openexr_version_str REGEX "^#define[\t ]+OPENEXR_VERSION_STRING[\t ]+\"[^\"]*\"") string(REGEX REPLACE "^#define[\t ]+OPENEXR_VERSION_STRING[\t ]+\"([^\"]*).*" "\\1" OpenEXR_VERSION_STRING "${openexr_version_str}") unset(openexr_version_str) endif () include(FindPackageHandleStandardArgs) # find_package_handle_standard_args reports the value of the first variable # on success, so make sure this is the actual OpenEXR library find_package_handle_standard_args(OpenEXR FOUND_VAR OpenEXR_FOUND REQUIRED_VARS OpenEXR_ILMIMF_LIBRARY OpenEXR_HALF_LIBRARY OpenEXR_IEX_LIBRARY OpenEXR_IMATH_LIBRARY OpenEXR_ILMTHREAD_LIBRARY OpenEXR_INCLUDE_DIR VERSION_VAR OpenEXR_VERSION_STRING) set(OpenEXR_INCLUDE_DIRS ${OpenEXR_INCLUDE_DIR}) include(FeatureSummary) set_package_properties(OpenEXR PROPERTIES URL https://www.openexr.com/ DESCRIPTION "A library for handling OpenEXR high dynamic-range image files") mark_as_advanced( OpenEXR_INCLUDE_DIR OpenEXR_LIBRARIES OpenEXR_DEFINITIONS OpenEXR_ILMIMF_LIBRARY OpenEXR_ILMTHREAD_LIBRARY OpenEXR_IMATH_LIBRARY OpenEXR_IEX_LIBRARY OpenEXR_HALF_LIBRARY ) if(OpenEXR_FOUND AND NOT TARGET OpenEXR::IlmImf) add_library(OpenEXR::IlmImf UNKNOWN IMPORTED) set_target_properties(OpenEXR::IlmImf PROPERTIES IMPORTED_LOCATION "${OpenEXR_ILMIMF_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${OpenEXR_DEFINITIONS}" INTERFACE_INCLUDE_DIRECTORIES "${OpenEXR_INCLUDE_DIR}" INTERFACE_LINK_LIBRARIES "${_OpenEXR_deps}" ) endif() diff --git a/find-modules/FindPhoneNumber.cmake b/find-modules/FindPhoneNumber.cmake index 0c62800..76e1039 100644 --- a/find-modules/FindPhoneNumber.cmake +++ b/find-modules/FindPhoneNumber.cmake @@ -1,94 +1,73 @@ #.rst: # FindPhoneNumber # --------------- # # Try to find PhoneNumber. # # This is a component-based find module, which makes use of the COMPONENTS and # OPTIONAL_COMPONENTS arguments to find_module. The following components are # available:: # # PhoneNumber GeoCoding # # If no components are specified, this module will act as though all components # were passed to OPTIONAL_COMPONENTS. # # This module will define the following variables, independently of the # components searched for or found: # # ``PhoneNumber_FOUND`` # True if (the requestion version of) PhoneNumber is available # # For each searched-for components, ``PhoneNumber__FOUND`` will be set to # TRUE if the corresponding library was found, and FALSE otherwise. If # ``PhoneNumber__FOUND`` is TRUE, the imported target ``PhoneNumber::`` # will be defined. # # Since 5.54.0. #============================================================================= -# Copyright (c) 2017 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com -# Copyright (c) 2018 Volker Krause +# SPDX-FileCopyrightText: 2017 Klaralvdalens Datakonsult AB, a KDAB Group company +# SPDX-FileCopyrightText: 2018 Volker Krause # -# 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. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= include(ECMFindModuleHelpersStub) ecm_find_package_version_check(PhoneNumber) set(PhoneNumber_known_components PhoneNumber GeoCoding ) set(PhoneNumber_default_components ${PhoneNumber_known_components}) set(PhoneNumber_PhoneNumber_lib phonenumber) set(PhoneNumber_PhoneNumber_header phonenumbers/phonenumberutil.h) set(PhoneNumber_GeoCoding_lib geocoding) set(PhoneNumber_GeoCoding_header phonenumbers/geocoding/phonenumber_offline_geocoder.h) ecm_find_package_parse_components(PhoneNumber RESULT_VAR PhoneNumber_components KNOWN_COMPONENTS ${PhoneNumber_known_components} DEFAULT_COMPONENTS ${PhoneNumber_default_components} ) ecm_find_package_handle_library_components(PhoneNumber COMPONENTS ${PhoneNumber_components} ) find_package_handle_standard_args(PhoneNumber FOUND_VAR PhoneNumber_FOUND REQUIRED_VARS PhoneNumber_LIBRARIES VERSION_VAR PhoneNumber_VERSION HANDLE_COMPONENTS ) set(PhoneNumber_VERSION 0) # there is no observable version number in the installed files include(FeatureSummary) set_package_properties(PhoneNumber PROPERTIES URL "https://github.com/googlei18n/libphonenumber" DESCRIPTION "Library for parsing, formatting, and validating international phone numbers") diff --git a/find-modules/FindPng2Ico.cmake b/find-modules/FindPng2Ico.cmake index 01ad8c4..52e845e 100644 --- a/find-modules/FindPng2Ico.cmake +++ b/find-modules/FindPng2Ico.cmake @@ -1,117 +1,96 @@ #.rst: # FindPng2Ico # ----------- # # Try to find png2ico. # # If the png2ico executable is not in your PATH, you can provide # an alternative name or full path location with the ``Png2Ico_EXECUTABLE`` # variable. # # This will define the following variables: # # ``Png2Ico_FOUND`` # True if png2ico is available. # # ``Png2Ico_EXECUTABLE`` # The png2ico executable. # # If ``Png2Ico_FOUND`` is TRUE, it will also define the following imported # target: # # ``Png2Ico::Png2Ico`` # The png2ico executable. # # and the following variables: # # ``Png2Ico_HAS_COLORS_ARGUMENT`` # Whether png2ico accepts a ``--colors`` argument. `Matthias Benkmann's # tool `_ does, while the # version of png2ico from the `"KDE On Windows" (kdewin) # `_ project does not. # # ``Png2Ico_HAS_RCFILE_ARGUMENT`` # Whether png2ico accepts an ``--rcfile`` argument. The version of png2ico # from the `"KDE On Windows" (kdewin) # `_ project does, # while `Matthias Benkmann's tool # `_ does not. # # Since 1.7.0. #============================================================================= -# Copyright 2014 Alex Merry +# SPDX-FileCopyrightText: 2014 Alex Merry # -# 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. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake) ecm_find_package_version_check(Png2Ico) # Find png2ico find_program(Png2Ico_EXECUTABLE NAMES png2ico) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Png2Ico FOUND_VAR Png2Ico_FOUND REQUIRED_VARS Png2Ico_EXECUTABLE ) mark_as_advanced(Png2Ico_EXECUTABLE) if (Png2Ico_FOUND) execute_process( COMMAND "${Png2Ico_EXECUTABLE}" --help OUTPUT_VARIABLE _png2ico_help_text ERROR_VARIABLE _png2ico_help_text ) if (_png2ico_help_text MATCHES ".*--rcfile .*") set(Png2Ico_HAS_RCFILE_ARGUMENT TRUE) else() set(Png2Ico_HAS_RCFILE_ARGUMENT FALSE) endif() if (_png2ico_help_text MATCHES ".*--colors .*") set(Png2Ico_HAS_COLORS_ARGUMENT TRUE) else() set(Png2Ico_HAS_COLORS_ARGUMENT FALSE) endif() unset(_png2ico_help_text) if (NOT TARGET Png2Ico::Png2Ico) add_executable(Png2Ico::Png2Ico IMPORTED) set_target_properties(Png2Ico::Png2Ico PROPERTIES IMPORTED_LOCATION "${Png2Ico_EXECUTABLE}" ) endif() endif() include(FeatureSummary) set_package_properties(Png2Ico PROPERTIES URL "https://www.winterdrache.de/freeware/png2ico/ or https://commits.kde.org/kdewin" DESCRIPTION "Executable that converts a collection of PNG files into a Windows icon file" ) diff --git a/find-modules/FindPoppler.cmake b/find-modules/FindPoppler.cmake index db99c69..35cfdb4 100644 --- a/find-modules/FindPoppler.cmake +++ b/find-modules/FindPoppler.cmake @@ -1,151 +1,130 @@ #.rst: # FindPoppler # ----------- # # Try to find Poppler. # # This is a component-based find module, which makes use of the COMPONENTS # and OPTIONAL_COMPONENTS arguments to find_module. The following components # are available:: # # Core Cpp Qt5 Qt4 Glib # # If no components are specified, this module will act as though all components # were passed to OPTIONAL_COMPONENTS. # # This module will define the following variables, independently of the # components searched for or found: # # ``Poppler_FOUND`` # TRUE if (the requested version of) Poppler is available # ``Poppler_VERSION`` # Found Poppler version # ``Poppler_TARGETS`` # A list of all targets imported by this module (note that there may be more # than the components that were requested) # ``Poppler_LIBRARIES`` # This can be passed to target_link_libraries() instead of the imported # targets # ``Poppler_INCLUDE_DIRS`` # This should be passed to target_include_directories() if the targets are # not used for linking # ``Poppler_DEFINITIONS`` # This should be passed to target_compile_options() if the targets are not # used for linking # # For each searched-for components, ``Poppler__FOUND`` will be set to # TRUE if the corresponding Poppler library was found, and FALSE otherwise. If # ``Poppler__FOUND`` is TRUE, the imported target # ``Poppler::`` will be defined. This module will also attempt to # determine ``Poppler_*_VERSION`` variables for each imported target, although # ``Poppler_VERSION`` should normally be sufficient. # # In general we recommend using the imported targets, as they are easier to use # and provide more control. Bear in mind, however, that if any target is in the # link interface of an exported library, it must be made available by the # package config file. # # Since 5.19 #============================================================================= -# Copyright 2015 Alex Richardson +# SPDX-FileCopyrightText: 2015 Alex Richardson # -# 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. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake) ecm_find_package_version_check(Poppler) set(Poppler_known_components Cpp Qt4 Qt5 Glib ) foreach(_comp ${Poppler_known_components}) string(TOLOWER "${_comp}" _lc_comp) set(Poppler_${_comp}_component_deps "Core") set(Poppler_${_comp}_pkg_config "poppler-${_lc_comp}") set(Poppler_${_comp}_lib "poppler-${_lc_comp}") set(Poppler_${_comp}_header_subdir "poppler/${_lc_comp}") endforeach() set(Poppler_known_components Core ${Poppler_known_components}) set(Poppler_Core_component_deps "") set(Poppler_Core_pkg_config "poppler") # poppler-config.h header is only installed with --enable-xpdf-headers # fall back to using any header from a submodule with a path to make it work in that case too set(Poppler_Core_header "poppler-config.h" "cpp/poppler-version.h" "qt5/poppler-qt5.h" "qt4/poppler-qt4.h" "glib/poppler.h") set(Poppler_Core_header_subdir "poppler") set(Poppler_Core_lib "poppler") set(Poppler_Cpp_header "poppler-version.h") set(Poppler_Qt5_header "poppler-qt5.h") set(Poppler_Qt4_header "poppler-qt4.h") set(Poppler_Glib_header "poppler.h") ecm_find_package_parse_components(Poppler RESULT_VAR Poppler_components KNOWN_COMPONENTS ${Poppler_known_components} ) ecm_find_package_handle_library_components(Poppler COMPONENTS ${Poppler_components} ) # If pkg-config didn't provide us with version information, # try to extract it from poppler-version.h or poppler-config.h if(NOT Poppler_VERSION) find_file(Poppler_VERSION_HEADER NAMES "poppler-config.h" "cpp/poppler-version.h" HINTS ${Poppler_INCLUDE_DIRS} PATH_SUFFIXES ${Poppler_Core_header_subdir} ) mark_as_advanced(Poppler_VERSION_HEADER) if(Poppler_VERSION_HEADER) file(READ ${Poppler_VERSION_HEADER} _poppler_version_header_contents) string(REGEX REPLACE "^.*[ \t]+POPPLER_VERSION[ \t]+\"([0-9d.]*)\".*$" "\\1" Poppler_VERSION "${_poppler_version_header_contents}" ) unset(_poppler_version_header_contents) endif() endif() find_package_handle_standard_args(Poppler FOUND_VAR Poppler_FOUND REQUIRED_VARS Poppler_LIBRARIES VERSION_VAR Poppler_VERSION HANDLE_COMPONENTS ) include(FeatureSummary) set_package_properties(Poppler PROPERTIES DESCRIPTION "A PDF rendering library" URL "https://poppler.freedesktop.org/" ) diff --git a/find-modules/FindPulseAudio.cmake b/find-modules/FindPulseAudio.cmake index b0d6333..f8dc1a1 100644 --- a/find-modules/FindPulseAudio.cmake +++ b/find-modules/FindPulseAudio.cmake @@ -1,130 +1,109 @@ #.rst: # FindPulseAudio # -------------- # # Try to locate the PulseAudio library. # If found, this will define the following variables: # # ``PulseAudio_FOUND`` # True if the system has the PulseAudio library of at least # the minimum version specified by either the version parameter # to find_package() or the variable PulseAudio_MINIMUM_VERSION # ``PulseAudio_INCLUDE_DIRS`` # The PulseAudio include directory # ``PulseAudio_LIBRARIES`` # The PulseAudio libraries for linking # ``PulseAudio_MAINLOOP_LIBRARY`` # The libraries needed to use PulseAudio Mainloop # ``PulseAudio_VERSION`` # The version of PulseAudio that was found # ``PulseAudio_INCLUDE_DIR`` # Deprecated, use ``PulseAudio_INCLUDE_DIRS`` # ``PulseAudio_LIBRARY`` # Deprecated, use ``PulseAudio_LIBRARIES`` # # If ``PulseAudio_FOUND`` is TRUE, it will also define the following # imported target: # # ``PulseAudio::PulseAudio`` # The PulseAudio library # # Since 5.41.0. #============================================================================= -# Copyright (c) 2008, Matthias Kretz, -# Copyright (c) 2009, Marcus Hufgard, +# SPDX-FileCopyrightText: 2008 Matthias Kretz +# SPDX-FileCopyrightText: 2009 Marcus Hufgard # -# 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. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= # Support PulseAudio_MINIMUM_VERSION for compatibility: if(NOT PulseAudio_FIND_VERSION) set(PulseAudio_FIND_VERSION "${PulseAudio_MINIMUM_VERSION}") endif() # the minimum version of PulseAudio we require if(NOT PulseAudio_FIND_VERSION) set(PulseAudio_FIND_VERSION "0.9.9") endif() find_package(PkgConfig) pkg_check_modules(PC_PulseAudio QUIET libpulse>=${PulseAudio_FIND_VERSION}) pkg_check_modules(PC_PulseAudio_MAINLOOP QUIET libpulse-mainloop-glib) find_path(PulseAudio_INCLUDE_DIRS pulse/pulseaudio.h HINTS ${PC_PulseAudio_INCLUDEDIR} ${PC_PulseAudio_INCLUDE_DIRS} ) find_library(PulseAudio_LIBRARIES NAMES pulse libpulse HINTS ${PC_PulseAudio_LIBDIR} ${PC_PulseAudio_LIBRARY_DIRS} ) find_library(PulseAudio_MAINLOOP_LIBRARY NAMES pulse-mainloop pulse-mainloop-glib libpulse-mainloop-glib HINTS ${PC_PulseAudio_LIBDIR} ${PC_PulseAudio_LIBRARY_DIRS} ) # Store the version number in the cache, so we don't have to search every time again: if (PulseAudio_INCLUDE_DIRS AND NOT PulseAudio_VERSION) # get PulseAudio's version from its version.h file(STRINGS "${PulseAudio_INCLUDE_DIRS}/pulse/version.h" pulse_version_h REGEX ".*pa_get_headers_version\\(\\).*") string(REGEX REPLACE ".*pa_get_headers_version\\(\\)\ \\(\"([0-9]+\\.[0-9]+\\.[0-9]+)[^\"]*\"\\).*" "\\1" _PulseAudio_VERSION "${pulse_version_h}") set(PulseAudio_VERSION "${_PulseAudio_VERSION}" CACHE STRING "Version number of PulseAudio" FORCE) endif() # Use the new extended syntax of find_package_handle_standard_args(), which also handles version checking: include(FindPackageHandleStandardArgs) find_package_handle_standard_args(PulseAudio REQUIRED_VARS PulseAudio_LIBRARIES PulseAudio_INCLUDE_DIRS VERSION_VAR PulseAudio_VERSION) # Deprecated synonyms set(PULSEAUDIO_INCLUDE_DIR "${PulseAudio_INCLUDE_DIRS}") set(PULSEAUDIO_LIBRARY "${PulseAudio_LIBRARIES}") set(PULSEAUDIO_MAINLOOP_LIBRARY "${PulseAudio_MAINLOOP_LIBRARY}") set(PULSEAUDIO_FOUND "${PulseAudio_FOUND}") if(PulseAudio_FOUND AND NOT TARGET PulseAudio::PulseAudio) add_library(PulseAudio::PulseAudio UNKNOWN IMPORTED) set_target_properties(PulseAudio::PulseAudio PROPERTIES IMPORTED_LOCATION "${PulseAudio_LIBRARIES}" INTERFACE_INCLUDE_DIRECTORIES "${PulseAudio_INCLUDE_DIRS}") endif() mark_as_advanced(PulseAudio_INCLUDE_DIRS PULSEAUDIO_INCLUDE_DIR PulseAudio_LIBRARIES PULSEAUDIO_LIBRARY PulseAudio_MAINLOOP_LIBRARY PULSEAUDIO_MAINLOOP_LIBRARY) include(FeatureSummary) set_package_properties(PulseAudio PROPERTIES URL "https://www.freedesktop.org/wiki/Software/PulseAudio" DESCRIPTION "Sound server, for sound stream routing and mixing") diff --git a/find-modules/FindPythonModuleGeneration.cmake b/find-modules/FindPythonModuleGeneration.cmake index 6d4f97e..083b767 100644 --- a/find-modules/FindPythonModuleGeneration.cmake +++ b/find-modules/FindPythonModuleGeneration.cmake @@ -1,524 +1,503 @@ #.rst: # FindPythonModuleGeneration # -------------------------- # # This module is experimental and internal. The interface will likely # change in the coming releases. # # Tools and macros for generating python bindings # # This will define the following public function: # # ecm_generate_python_binding(TARGET # PYTHONNAMESPACE # MODULENAME # RULES_FILE # SIP_DEPENDS # SIP_INCLUDES # HEADERS ) # # Invoking the function will create bindings for the for python 2 and 3, # if available. The bindings will be put in the namespace in python, # and will be available from the module . # # The optional rules file specifies the rules for creating the bindings # # A simple invocation would be: # # ecm_generate_python_binding(TARGET KMyTarget # PYTHONNAMESPACE PyKF5 # MODULENAME MyTarget # SIP_DEPENDS QtCore/QtCoremod.sip # HEADERS ${myTargetHeaders} # ) # # which can then be used from python as # # import PyKF5.MyTarget # # Inclusion of this module defines the following variables: # # ``KDE_INSTALL_PYTHON2DIR``, ``KDE_INSTALL_PYTHON3DIR`` # destination for generated bindings # ``KDE_INSTALL_FULL_PYTHON2DIR``, ``KDE_INSTALL_FULL_PYTHON3DIR`` # corresponding absolute path # # If ``KDE_INSTALL_USE_PYTHON2_SYS_PATHS`` is set to TRUE before including this # module, the default value for ``KDE_INSTALL_PYTHON2DIR`` is instead queried from # pythons distutil.sysconfig.get_python_lib(). # If not set, it will default to TRUE if pythons ``sysconfig.PREFIX`` is the same # as ``CMAKE_INSTALL_PREFIX``, otherwise it defaults to FALSE. # This variable should NOT be set from within CMakeLists.txt files, instead it # is intended to be set manually when configuring a project which uses this # module (e.g. by packagers). # # Likewise for ``KDE_INSTALL_USE_PYTHON3_SYS_PATHS`` and ``KDE_INSTALL_PYTHON3DIR``. # #============================================================================= -# Copyright 2016 Stephen Kelly +# SPDX-FileCopyrightText: 2016 Stephen Kelly # -# 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. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= macro(_find_python version minor_version) set(_CURRENT_VERSION ${version}.${minor_version}) find_library(GPB_PYTHON${version}_LIBRARY NAMES python${_CURRENT_VERSION}mu python${_CURRENT_VERSION}m python${_CURRENT_VERSION}u python${_CURRENT_VERSION} PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs # Avoid finding the .dll in the PATH. We want the .lib. NO_SYSTEM_ENVIRONMENT_PATH ) if(GPB_PYTHON${version}_LIBRARY) # Use the library's install prefix as a hint set(_Python_INCLUDE_PATH_HINT) get_filename_component(_Python_PREFIX ${GPB_PYTHON${version}_LIBRARY} PATH) get_filename_component(_Python_PREFIX ${_Python_PREFIX} PATH) if(_Python_PREFIX) set(_Python_INCLUDE_PATH_HINT ${_Python_PREFIX}/include) endif() unset(_Python_PREFIX) find_path(GPB_PYTHON${version}_INCLUDE_DIR NAMES Python.h HINTS ${_Python_INCLUDE_PATH_HINT} PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include PATH_SUFFIXES python${_CURRENT_VERSION}mu python${_CURRENT_VERSION}m python${_CURRENT_VERSION}u python${_CURRENT_VERSION} ) # sip.h is version agnostic, it may be located in the version specific path # or one of the default locations find_path(GPB_PYTHON${version}_SIP_DIR NAMES sip.h PATHS ${GPB_PYTHON${version}_INCLUDE_DIR} ) endif() find_program(GPB_PYTHON${version}_COMMAND python${version}) endmacro() macro(_create_imported_python_target version) if(GPB_PYTHON${version}_LIBRARY AND GPB_PYTHON${version}_INCLUDE_DIR AND EXISTS "${GPB_PYTHON${version}_INCLUDE_DIR}/patchlevel.h" AND EXISTS "${GPB_PYTHON${version}_SIP_DIR}/sip.h") list(APPEND _pyversions ${version}) file(STRINGS "${GPB_PYTHON${version}_INCLUDE_DIR}/patchlevel.h" python_version_define REGEX "^#define[ \t]+PY_MINOR_VERSION[ \t]+[0-9]+") string(REGEX REPLACE "^#define[ \t]+PY_MINOR_VERSION[ \t]+([0-9]+)" "\\1" min_ver "${python_version_define}") unset(python_version_define) set(pyversion${version}_maj_min ${version}.${min_ver}) add_library(Python::Libs${version} UNKNOWN IMPORTED) set_property(TARGET Python::Libs${version} PROPERTY IMPORTED_LOCATION ${GPB_PYTHON${version}_LIBRARY}) set_property(TARGET Python::Libs${version} PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${GPB_PYTHON${version}_INCLUDE_DIR}) set(_default_KDE_INSTALL_USE_PYTHON${version}_SYS_PATHS OFF) if(NOT DEFINED KDE_INSTALL_USE_PYTHON${version}_SYS_PATHS) execute_process ( COMMAND "${GPB_PYTHON${version}_COMMAND}" -c "import sys; from distutils import sysconfig;sys.stdout.write(sysconfig.PREFIX)" OUTPUT_VARIABLE gpb_python${version}_prefix ) if(gpb_python${version}_prefix STREQUAL "${CMAKE_INSTALL_PREFIX}") message(STATUS "Installing in the same prefix as Python${version}, adopting their path scheme.") set(_default_KDE_INSTALL_USE_PYTHON${version}_SYS_PATHS ON) else() message(STATUS "NOT installing in the same prefix as Python${version}.") endif() endif() endif() endmacro() macro(_report_NOT_FOUND message) if(NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) set(_GPB_MESSAGE_TYPE STATUS) if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) set(_GPB_MESSAGE_TYPE FATAL_ERROR) endif() message(${_GPB_MESSAGE_TYPE} ${message}) endif() set(PythonModuleGeneration_FOUND FALSE) return() endmacro() if (NOT Qt5Core_FOUND) _report_NOT_FOUND("Qt 5 must be found before finding ${CMAKE_FIND_PACKAGE_NAME}.") endif() if (NOT GPB_PYTHON3_LIBRARY) set(_PYTHON3_MIN_VERSION 4) set(_PYTHON3_MAX_VERSION 10) _find_python(3 ${_PYTHON3_MAX_VERSION}) # Canary check if (GPB_PYTHON3_LIBRARY) message(FATAL_ERROR "The max python version in ${CMAKE_FIND_PACKAGE_NAME} must be updated.") endif() set(_PYTHON3_FIND_VERSION ${_PYTHON3_MAX_VERSION}) while(NOT GPB_PYTHON3_LIBRARY AND NOT GPB_PYTHON3_INCLUDE_DIR AND NOT EXISTS "${GPB_PYTHON3_INCLUDE_DIR}/patchlevel.h" AND NOT _PYTHON3_FIND_VERSION EQUAL ${_PYTHON3_MIN_VERSION}) math(EXPR _PYTHON3_FIND_VERSION "${_PYTHON3_FIND_VERSION} - 1") _find_python(3 ${_PYTHON3_FIND_VERSION}) endwhile() endif() _create_imported_python_target(3) _find_python(2 7) _create_imported_python_target(2) option (KDE_INSTALL_USE_PYTHON3_SYS_PATHS "Install Python3 bindings to the Python3 install dir" "${_default_KDE_INSTALL_USE_PYTHON3_SYS_PATHS}") option (KDE_INSTALL_USE_PYTHON2_SYS_PATHS "Install Python2 bindings to the Python2 install dir" "${_default_KDE_INSTALL_USE_PYTHON2_SYS_PATHS}") if (NOT _pyversions) _report_NOT_FOUND("At least one python version must be available to use ${CMAKE_FIND_PACKAGE_NAME}.") endif() foreach(pyversion ${_pyversions}) if(KDE_INSTALL_PYTHON${pyversion}DIR) # Use dir from command line elseif(KDE_INSTALL_USE_PYTHON${pyversion}_SYS_PATHS) execute_process ( COMMAND "${GPB_PYTHON${pyversion}_COMMAND}" -c "import sys; from distutils import sysconfig;sys.stdout.write(sysconfig.get_python_lib(plat_specific=True,standard_lib=False))" OUTPUT_VARIABLE KDE_INSTALL_PYTHON${pyversion}DIR ) else() set(KDE_INSTALL_PYTHON${pyversion}DIR lib/python${pyversion${pyversion}_maj_min}/site-packages) endif() if(NOT IS_ABSOLUTE ${KDE_INSTALL_PYTHON${pyversion}DIR}) set(KDE_INSTALL_FULL_PYTHON${pyversion}DIR "${CMAKE_INSTALL_PREFIX}/${KDE_INSTALL_PYTHON${pyversion}DIR}") else() set(KDE_INSTALL_FULL_PYTHON${pyversion}DIR "${KDE_INSTALL_PYTHON${pyversion}DIR}") endif() endforeach() find_program(GBP_SIP_COMMAND sip) if (NOT GBP_SIP_COMMAND) _report_NOT_FOUND("The sip executable must be available to use ${CMAKE_FIND_PACKAGE_NAME}.") endif() if (NOT libclang_LIBRARY) set(_LIBCLANG_MAX_MAJOR_VERSION 7) set(_LIBCLANG_MIN_MAJOR_VERSION 5) find_library(libclang_LIBRARY clang-${_LIBCLANG_MAX_MAJOR_VERSION}.0) if (libclang_LIBRARY) message(FATAL_ERROR "The max libclang version in ${CMAKE_FIND_PACKAGE_NAME} must be updated.") endif() set(_LIBCLANG_FIND_VERSION ${_LIBCLANG_MAX_MAJOR_VERSION}) while(NOT libclang_LIBRARY AND NOT _LIBCLANG_FIND_VERSION EQUAL _LIBCLANG_MIN_MAJOR_VERSION) math(EXPR _LIBCLANG_FIND_VERSION "${_LIBCLANG_FIND_VERSION} - 1") set(_GPB_CLANG_SUFFIX ${_LIBCLANG_FIND_VERSION}.0) find_library(libclang_LIBRARY clang-${_LIBCLANG_FIND_VERSION}.0) endwhile() if (NOT libclang_LIBRARY) find_library(libclang_LIBRARY clang) endif() else() string(REGEX MATCH ".*clang-([0-9]+\\.[0-9]+).*" _GPB_CLANG_SUFFIX ${libclang_LIBRARY}) set(_GPB_CLANG_SUFFIX ${CMAKE_MATCH_1}) endif() if (NOT libclang_LIBRARY) _report_NOT_FOUND("Could not find libclang version 5.0 or greater.") else() message(STATUS "Found ${libclang_LIBRARY}") endif() foreach (pyversion "2" "3") set(GPB_PYTHON_COMMAND ${GPB_PYTHON${pyversion}_COMMAND}) if (NOT GPB_PYTHON_COMMAND) continue() endif() message(STATUS "Testing if ${GPB_PYTHON_COMMAND} can be used to run sip_generator") execute_process( COMMAND ${GPB_PYTHON_COMMAND} ${CMAKE_CURRENT_LIST_DIR}/sip_generator.py --self-check ${libclang_LIBRARY} RESULT_VARIABLE selfCheckErrors ERROR_QUIET ) if (selfCheckErrors) message(STATUS "sip_generator self-check for ${GPB_PYTHON_COMMAND} failed") unset(GPB_PYTHON_COMMAND) else() message(STATUS "Self-check passed, Using ${GPB_PYTHON_COMMAND} to generate bindings") break() endif() endforeach() if (NOT GPB_PYTHON_COMMAND) _report_NOT_FOUND("No usable python version found to run sip_generator for the ${CMAKE_FIND_PACKAGE_NAME} Module.") endif() get_filename_component(libclang_file "${libclang_file}" REALPATH) find_file(SIP_Qt5Core_Mod_FILE NAMES QtCoremod.sip HINTS ${KDE_INSTALL_PYTHON3DIR}/PyQt5/bindings/QtCore PATH_SUFFIXES share/sip/PyQt5/QtCore ) if(NOT SIP_Qt5Core_Mod_FILE) _report_NOT_FOUND("PyQt module files not found for the ${CMAKE_FIND_PACKAGE_NAME} Module.") endif() set(PythonModuleGeneration_FOUND TRUE) include(CMakeParseArguments) set(GPB_MODULE_DIR ${CMAKE_CURRENT_LIST_DIR}) function(_compute_implicit_include_dirs) find_program(_GBP_CLANG_CXX_DRIVER_PATH NAMES clang++-${_GPB_CLANG_SUFFIX} clang++) if (NOT _GBP_CLANG_CXX_DRIVER_PATH) message(FATAL_ERROR "Failed to find clang driver corresponding to ${libclang_LIBRARY}") endif() execute_process(COMMAND ${_GBP_CLANG_CXX_DRIVER_PATH} -v -E -x c++ - ERROR_VARIABLE _compilerOutput OUTPUT_VARIABLE _compilerStdout INPUT_FILE /dev/null) if( "${_compilerOutput}" MATCHES "> search starts here[^\n]+\n *(.+ *\n) *End of (search) list" ) # split the output into lines and then remove leading and trailing spaces from each of them: string(REGEX MATCHALL "[^\n]+\n" _includeLines "${CMAKE_MATCH_1}") foreach(nextLine ${_includeLines}) # on OSX, gcc says things like this: "/System/Library/Frameworks (framework directory)", strip the last part string(REGEX REPLACE "\\(framework directory\\)" "" nextLineNoFramework "${nextLine}") # strip spaces at the beginning and the end string(STRIP "${nextLineNoFramework}" _includePath) list(APPEND _resultIncludeDirs "${_includePath}") endforeach() endif() set(_GPB_IMPLICIT_INCLUDE_DIRS ${_resultIncludeDirs} PARENT_SCOPE) endfunction() function(ecm_generate_python_binding) set(oneValueArgs TARGET PYTHONNAMESPACE MODULENAME RULES_FILE) set(multiValueArgs SIP_DEPENDS SIP_INCLUDES HEADERS) cmake_parse_arguments(GPB "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/sip/${GPB_PYTHONNAMESPACE}/${GPB_MODULENAME}/${GPB_MODULENAME}mod.sip" " %Module ${GPB_PYTHONNAMESPACE}.${GPB_MODULENAME} %ModuleHeaderCode #pragma GCC visibility push(default) %End\n\n") set(generator_depends "${GPB_MODULE_DIR}/sip_generator.py" "${GPB_MODULE_DIR}/rules_engine.py" "${GPB_MODULE_DIR}/FindPythonModuleGeneration.cmake" ) if (NOT _GPB_IMPLICIT_INCLUDE_DIRS) _compute_implicit_include_dirs() endif() foreach(dep ${GPB_SIP_DEPENDS}) if (IS_ABSOLUTE ${dep}) list(APPEND generator_depends "${dep}") endif() file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/sip/${GPB_PYTHONNAMESPACE}/${GPB_MODULENAME}/${GPB_MODULENAME}mod.sip" "%Import ${dep}\n\n") endforeach() set(sip_files) set(commands) if (NOT GPB_RULES_FILE) set(GPB_RULES_FILE "${GPB_MODULE_DIR}/Qt5Ruleset.py") endif() list(APPEND generator_depends ${GPB_RULES_FILE}) foreach(hdr ${GPB_HEADERS}) get_filename_component(hdr_file ${hdr} ABSOLUTE) get_filename_component(hdr ${hdr} NAME_WE) string(TOLOWER ${hdr}.h hdr_filename) if (NOT EXISTS "${hdr_file}") message(FATAL_ERROR "File not found: ${hdr_file}") endif() set(sip_file "${CMAKE_CURRENT_BINARY_DIR}/sip/${GPB_PYTHONNAMESPACE}/${GPB_MODULENAME}/${hdr}.sip") list(APPEND sip_files ${sip_file}) set(inc_dirs "-I$,;-I>") set(sys_inc_dirs) foreach(d ${_GPB_IMPLICIT_INCLUDE_DIRS}) list(APPEND sys_inc_dirs "-isystem" "${d}") endforeach() set(comp_defs "-D$,;-D>") # We might like to use $, but # unfortunately CMake does not populate that property as a side-effect of evaluating # COMPILE_FEATURES (Qt specifies feature requirements in its INTERFACE_COMPILE_FEATURES, and # those are consumed to set the CXX_STANDARD internally in CMake, but evidently too late) set(stdFlag "-std=gnu++14") set(comp_flags "$;${stdFlag},;>") add_custom_command(OUTPUT ${sip_file} COMMAND ${GPB_PYTHON_COMMAND} ${GPB_MODULE_DIR}/sip_generator.py --flags " ${inc_dirs};${sys_inc_dirs};${comp_defs};${comp_flags}" --include_filename "${hdr_filename}" ${libclang_LIBRARY} ${GPB_RULES_FILE} "${hdr_file}" "${sip_file}" DEPENDS ${hdr_file} ${generator_depends} VERBATIM ) file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/sip/${GPB_PYTHONNAMESPACE}/${GPB_MODULENAME}/${GPB_MODULENAME}mod.sip" "%Include ${hdr}.sip\n") endforeach() file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pybuild/${GPB_PYTHONNAMESPACE}/${GPB_MODULENAME}/module.sbf" " target = ${GPB_MODULENAME} sources = sip${GPB_MODULENAME}cmodule.cpp headers = sipAPI${GPB_MODULENAME} " ) get_filename_component(SIP_PYQT5_DIR ${SIP_Qt5Core_Mod_FILE} PATH) get_filename_component(SIP_PYQT5_DIR ${SIP_PYQT5_DIR} PATH) set(sip_includes -I "${SIP_PYQT5_DIR}") if (GPB_SIP_INCLUDES) list(APPEND sip_includes -I "$") endif() foreach(path ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX}) if (EXISTS ${path}/share/sip) list(APPEND sip_includes -I "${path}/share/sip") endif() endforeach() add_custom_target(generate_${GPB_MODULENAME}_sip_files ALL DEPENDS ${sip_files}) add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/pybuild/${GPB_PYTHONNAMESPACE}/${GPB_MODULENAME}/unified${GPB_MODULENAME}.cpp" COMMAND ${GPB_PYTHON_COMMAND} "${GPB_MODULE_DIR}/run-sip.py" --sip ${GBP_SIP_COMMAND} --unify "${CMAKE_CURRENT_BINARY_DIR}/pybuild/${GPB_PYTHONNAMESPACE}/${GPB_MODULENAME}/unified${GPB_MODULENAME}.cpp" --module-name "${GPB_MODULENAME}" -c "${CMAKE_CURRENT_BINARY_DIR}/pybuild/${GPB_PYTHONNAMESPACE}/${GPB_MODULENAME}" -b "${CMAKE_CURRENT_BINARY_DIR}/pybuild/${GPB_PYTHONNAMESPACE}/${GPB_MODULENAME}/module.sbf" -x VendorID -x Py_v3 -I "${CMAKE_CURRENT_BINARY_DIR}/sip/${GPB_PYTHONNAMESPACE}/${GPB_MODULENAME}" ${sip_includes} "${CMAKE_CURRENT_BINARY_DIR}/sip/${GPB_PYTHONNAMESPACE}/${GPB_MODULENAME}/${GPB_MODULENAME}mod.sip" DEPENDS generate_${GPB_MODULENAME}_sip_files "${GPB_MODULE_DIR}/run-sip.py" ${generator_depends} ) add_custom_target(sip_generated_${GPB_MODULENAME}_files ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pybuild/${GPB_PYTHONNAMESPACE}/${GPB_MODULENAME}/unified${GPB_MODULENAME}.cpp") file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/sip/${GPB_PYTHONNAMESPACE}/${GPB_MODULENAME}" "${CMAKE_CURRENT_BINARY_DIR}/pybuild/${GPB_PYTHONNAMESPACE}/${GPB_MODULENAME}") foreach(pyversion ${_pyversions}) message(STATUS "Found dependencies for python${pyversion}, generating bindings") message(STATUS "Python${pyversion} install dir: ${KDE_INSTALL_FULL_PYTHON${pyversion}DIR}") execute_process(COMMAND "${CMAKE_COMMAND}" "-DPYTHON_UMBRELLA_MODULE_FILE=${CMAKE_BINARY_DIR}/py${pyversion}/${GPB_PYTHONNAMESPACE}/__init__.py" -P "${GPB_MODULE_DIR}/GeneratePythonBindingUmbrellaModule.cmake" ) add_library(Py${pyversion}KF5${GPB_MODULENAME} MODULE "${CMAKE_CURRENT_BINARY_DIR}/pybuild/${GPB_PYTHONNAMESPACE}/${GPB_MODULENAME}/unified${GPB_MODULENAME}.cpp" ) add_dependencies(Py${pyversion}KF5${GPB_MODULENAME} sip_generated_${GPB_MODULENAME}_files) target_link_libraries(Py${pyversion}KF5${GPB_MODULENAME} PRIVATE ${GPB_TARGET} Python::Libs${pyversion}) target_compile_options(Py${pyversion}KF5${GPB_MODULENAME} PRIVATE -fstack-protector-strong -Wno-deprecated-declarations -Wno-overloaded-virtual) target_include_directories(Py${pyversion}KF5${GPB_MODULENAME} PRIVATE ${GPB_SIP_INCLUDES}) target_link_libraries(Py${pyversion}KF5${GPB_MODULENAME} PRIVATE -Wl,-Bsymbolic-functions -Wl,-z,relro) set_property(TARGET Py${pyversion}KF5${GPB_MODULENAME} PROPERTY AUTOMOC OFF) set_property(TARGET Py${pyversion}KF5${GPB_MODULENAME} PROPERTY PREFIX "") set_property(TARGET Py${pyversion}KF5${GPB_MODULENAME} PROPERTY LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/py${pyversion}/${GPB_PYTHONNAMESPACE}") set_property(TARGET Py${pyversion}KF5${GPB_MODULENAME} PROPERTY OUTPUT_NAME "${GPB_MODULENAME}") if (GPB_SIP_DEPENDS MATCHES PyKF5) set(_kf5_python_prefix ${KDE_INSTALL_FULL_PYTHON${pyversion}DIR}) else() set(_kf5_python_prefix ${CMAKE_BINARY_DIR}/py${pyversion}) endif() add_test(NAME Py${pyversion}Test${GPB_MODULENAME} COMMAND ${GPB_PYTHON${pyversion}_COMMAND} "${CMAKE_SOURCE_DIR}/autotests/pythontest.py" ${_kf5_python_prefix} ) install(DIRECTORY ${CMAKE_BINARY_DIR}/py${pyversion}/${GPB_PYTHONNAMESPACE} DESTINATION ${KDE_INSTALL_PYTHON${pyversion}DIR}) install(FILES ${sip_files} "${CMAKE_CURRENT_BINARY_DIR}/sip/${GPB_PYTHONNAMESPACE}/${GPB_MODULENAME}/${GPB_MODULENAME}mod.sip" DESTINATION share/sip/${GPB_PYTHONNAMESPACE}/${GPB_MODULENAME} ) endforeach() endfunction() diff --git a/find-modules/FindQHelpGenerator.cmake b/find-modules/FindQHelpGenerator.cmake index 272e587..e3cae71 100644 --- a/find-modules/FindQHelpGenerator.cmake +++ b/find-modules/FindQHelpGenerator.cmake @@ -1,75 +1,54 @@ # WARNING: FOR ECM-INTERNAL USE ONLY, DO NOT USE IN OWN PROJECTS # THIS FILE MIGHT DISAPPEAR IN FUTURE VERSIONS OF ECM. # Finds the Qt5 QHelpGenerator # # QHelpGenerator_FOUND - True if QHelpGenerator found. # QHelpGenerator_EXECUTABLE - Path to executable #============================================================================= -# Copyright 2016 Friedrich W. H. Kossebau +# SPDX-FileCopyrightText: 2016 Friedrich W. H. Kossebau # -# 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. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= find_package(Qt5Help QUIET) if (TARGET Qt5::qhelpgenerator) get_target_property(QHelpGenerator_EXECUTABLE Qt5::qhelpgenerator LOCATION) else() # assume same folder as qmake executable if (TARGET Qt5::qmake) get_target_property(_qmake_EXECUTABLE Qt5::qmake LOCATION) get_filename_component(_path ${_qmake_EXECUTABLE} DIRECTORY) else() set(_path) endif() find_program(QHelpGenerator_EXECUTABLE NAMES qhelpgenerator-qt5 qhelpgenerator PATHS ${_path} NO_DEFAULT_PATH ) endif() mark_as_advanced(QHelpGenerator_EXECUTABLE) if(QHelpGenerator_EXECUTABLE) set(QHelpGenerator_FOUND TRUE) else() set(QHelpGenerator_FOUND FALSE) endif() if(QHelpGenerator_FOUND) if(NOT QHelpGenerator_FIND_QUIETLY ) message( STATUS "Found QHelpGenerator executable: ${QHelpGenerator_EXECUTABLE}") endif() else() if(QHelpGenerator_FIND_REQUIRED) message( FATAL_ERROR "Could not find QHelpGenerator executable" ) else() message( STATUS "Optional QHelpGenerator executable was not found" ) endif() endif() diff --git a/find-modules/FindQtWaylandScanner.cmake b/find-modules/FindQtWaylandScanner.cmake index 25c55cc..65da5d2 100644 --- a/find-modules/FindQtWaylandScanner.cmake +++ b/find-modules/FindQtWaylandScanner.cmake @@ -1,197 +1,176 @@ #.rst: # FindQtWaylandScanner # -------------------- # # Try to find qtwaylandscanner. # # If the qtwaylandscanner executable is not in your PATH, you can provide # an alternative name or full path location with the ``QtWaylandScanner_EXECUTABLE`` # variable. # # This will define the following variables: # # ``QtWaylandScanner_FOUND`` # True if qtwaylandscanner is available # # ``QtWaylandScanner_EXECUTABLE`` # The qtwaylandscanner executable. # # If ``QtWaylandScanner_FOUND`` is TRUE, it will also define the following imported # target: # # ``Wayland::QtScanner`` # The qtwaylandscanner executable. # # This module provides the following functions to generate C++ protocol # implementations: # # - ``ecm_add_qtwayland_client_protocol`` # - ``ecm_add_qtwayland_server_protocol`` # # :: # # ecm_add_qtwayland_client_protocol( # PROTOCOL # BASENAME # [PREFIX ]) # # Generate C++ wrapper to Wayland client protocol files from ```` # XML definition for the ```` interface and append those files # to ````. Pass the ```` argument if the interface # names don't start with ``qt_`` or ``wl_``. # # WaylandScanner is required and will be searched for. # # :: # # ecm_add_qtwayland_server_protocol( # PROTOCOL # BASENAME # [PREFIX ]) # # Generate C++ wrapper to Wayland server protocol files from ```` # XML definition for the ```` interface and append those files # to ````. Pass the ```` argument if the interface # names don't start with ``qt_`` or ``wl_``. # # WaylandScanner is required and will be searched for. # # Since 1.4.0. #============================================================================= -# Copyright 2012-2014 Pier Luigi Fiorini -# -# 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. +# SPDX-FileCopyrightText: 2012-2014 Pier Luigi Fiorini +# +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake) include("${ECM_MODULE_DIR}/ECMQueryQmake.cmake") ecm_find_package_version_check(QtWaylandScanner) query_qmake(qt_binaries_dir QT_INSTALL_BINS) # Find qtwaylandscanner find_program(QtWaylandScanner_EXECUTABLE NAMES qtwaylandscanner HINTS ${qt_binaries_dir}) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(QtWaylandScanner FOUND_VAR QtWaylandScanner_FOUND REQUIRED_VARS QtWaylandScanner_EXECUTABLE ) mark_as_advanced(QtWaylandScanner_EXECUTABLE) if(NOT TARGET Wayland::QtScanner AND QtWaylandScanner_FOUND) add_executable(Wayland::QtScanner IMPORTED) set_target_properties(Wayland::QtScanner PROPERTIES IMPORTED_LOCATION "${QtWaylandScanner_EXECUTABLE}" ) endif() include(FeatureSummary) set_package_properties(QtWaylandScanner PROPERTIES URL "https://qt.io/" DESCRIPTION "Executable that converts XML protocol files to C++ code" ) include(CMakeParseArguments) function(ecm_add_qtwayland_client_protocol out_var) # Parse arguments set(oneValueArgs PROTOCOL BASENAME PREFIX) cmake_parse_arguments(ARGS "" "${oneValueArgs}" "" ${ARGN}) if(ARGS_UNPARSED_ARGUMENTS) message(FATAL_ERROR "Unknown keywords given to ecm_add_qtwayland_client_protocol(): \"${ARGS_UNPARSED_ARGUMENTS}\"") endif() set(_prefix "${ARGS_PREFIX}") find_package(WaylandScanner REQUIRED QUIET) ecm_add_wayland_client_protocol(${out_var} PROTOCOL ${ARGS_PROTOCOL} BASENAME ${ARGS_BASENAME}) get_filename_component(_infile ${ARGS_PROTOCOL} ABSOLUTE) set(_ccode "${CMAKE_CURRENT_BINARY_DIR}/wayland-${ARGS_BASENAME}-client-protocol.c") set(_cheader "${CMAKE_CURRENT_BINARY_DIR}/wayland-${ARGS_BASENAME}-client-protocol.h") set(_header "${CMAKE_CURRENT_BINARY_DIR}/qwayland-${ARGS_BASENAME}.h") set(_code "${CMAKE_CURRENT_BINARY_DIR}/qwayland-${ARGS_BASENAME}.cpp") set_source_files_properties(${_header} ${_code} GENERATED) add_custom_command(OUTPUT "${_header}" COMMAND ${QtWaylandScanner_EXECUTABLE} client-header ${_infile} "" ${_prefix} > ${_header} DEPENDS ${_infile} ${_cheader} VERBATIM) add_custom_command(OUTPUT "${_code}" COMMAND ${QtWaylandScanner_EXECUTABLE} client-code ${_infile} "" ${_prefix} > ${_code} DEPENDS ${_infile} ${_header} VERBATIM) set_property(SOURCE ${_header} ${_code} ${_cheader} ${_ccode} PROPERTY SKIP_AUTOMOC ON) list(APPEND ${out_var} "${_code}") set(${out_var} ${${out_var}} PARENT_SCOPE) endfunction() function(ecm_add_qtwayland_server_protocol out_var) # Parse arguments set(oneValueArgs PROTOCOL BASENAME PREFIX) cmake_parse_arguments(ARGS "" "${oneValueArgs}" "" ${ARGN}) if(ARGS_UNPARSED_ARGUMENTS) message(FATAL_ERROR "Unknown keywords given to ecm_add_qtwayland_server_protocol(): \"${ARGS_UNPARSED_ARGUMENTS}\"") endif() set(_prefix "${ARGS_PREFIX}") find_package(WaylandScanner REQUIRED QUIET) ecm_add_wayland_server_protocol(${out_var} PROTOCOL ${ARGS_PROTOCOL} BASENAME ${ARGS_BASENAME}) get_filename_component(_infile ${ARGS_PROTOCOL} ABSOLUTE) set(_header "${CMAKE_CURRENT_BINARY_DIR}/qwayland-server-${ARGS_BASENAME}.h") set(_code "${CMAKE_CURRENT_BINARY_DIR}/qwayland-server-${ARGS_BASENAME}.cpp") set_source_files_properties(${_header} ${_code} GENERATED) add_custom_command(OUTPUT "${_header}" COMMAND ${QtWaylandScanner_EXECUTABLE} server-header ${_infile} "" ${_prefix} > ${_header} DEPENDS ${_infile} VERBATIM) add_custom_command(OUTPUT "${_code}" COMMAND ${QtWaylandScanner_EXECUTABLE} server-code ${_infile} "" ${_prefix} > ${_code} DEPENDS ${_infile} ${_header} VERBATIM) set_property(SOURCE ${_header} ${_code} PROPERTY SKIP_AUTOMOC ON) list(APPEND ${out_var} "${_code}") set(${out_var} ${${out_var}} PARENT_SCOPE) endfunction() diff --git a/find-modules/FindSasl2.cmake b/find-modules/FindSasl2.cmake index 95dd8f6..b89b088 100644 --- a/find-modules/FindSasl2.cmake +++ b/find-modules/FindSasl2.cmake @@ -1,114 +1,93 @@ #.rst: # FindSasl2 # --------- # # Try to find the SASL2 library. # # This will define the following variables: # # ``Sasl2_FOUND`` # System has SASL2. # # ``Sasl2_VERSION`` # The version of SASL2. # # ``Sasl2_INCLUDE_DIRS`` # This should be passed to target_include_directories() if # the target is not used for linking. # # ``Sasl2_LIBRARIES`` # The SASL2 library. # This can be passed to target_link_libraries() instead of # the ``Sasl2::Sasl2`` target # # If ``Sasl2_FOUND`` is TRUE, the following imported target # will be available: # # ``Sasl2::Sasl2`` # The SASL2 library # # Since 5.41.0. # #============================================================================= -# Copyright 2006, 2007 Laurent Montel +# SPDX-FileCopyrightText: 2006, 2007 Laurent Montel # # -# 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. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= # NOTE: libsasl2.pc doesn't export the include dir. find_package(PkgConfig QUIET) pkg_check_modules(PC_Sasl2 libsasl2) find_path(Sasl2_INCLUDE_DIRS NAMES sasl/sasl.h) # libsasl2 add for windows, because the windows package of cyrus-sasl2 # contains a libsasl2 also for msvc which is not standard conform find_library(Sasl2_LIBRARIES NAMES sasl2 libsasl2 HINTS ${PC_Sasl2_LIBRARY_DIRS} ) set(Sasl2_VERSION "${PC_Sasl2_VERSION}") if(NOT Sasl2_VERSION) if(EXISTS "${Sasl2_INCLUDE_DIRS}/sasl/sasl.h") file(READ "${Sasl2_INCLUDE_DIRS}/sasl/sasl.h" SASL2_H_CONTENT) string(REGEX MATCH "#define SASL_VERSION_MAJOR[ ]+[0-9]+" SASL2_VERSION_MAJOR_MATCH ${SASL2_H_CONTENT}) string(REGEX MATCH "#define SASL_VERSION_MINOR[ ]+[0-9]+" SASL2_VERSION_MINOR_MATCH ${SASL2_H_CONTENT}) string(REGEX MATCH "#define SASL_VERSION_STEP[ ]+[0-9]+" SASL2_VERSION_STEP_MATCH ${SASL2_H_CONTENT}) string(REGEX REPLACE ".*_MAJOR[ ]+(.*)" "\\1" SASL2_VERSION_MAJOR ${SASL2_VERSION_MAJOR_MATCH}) string(REGEX REPLACE ".*_MINOR[ ]+(.*)" "\\1" SASL2_VERSION_MINOR ${SASL2_VERSION_MINOR_MATCH}) string(REGEX REPLACE ".*_STEP[ ]+(.*)" "\\1" SASL2_VERSION_STEP ${SASL2_VERSION_STEP_MATCH}) set(Sasl2_VERSION "${SASL2_VERSION_MAJOR}.${SASL2_VERSION_MINOR}.${SASL2_VERSION_STEP}") else() # Could not find the version set(Sasl2_VERSION "0.0.0") endif() endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Sasl2 FOUND_VAR Sasl2_FOUND REQUIRED_VARS Sasl2_LIBRARIES Sasl2_INCLUDE_DIRS VERSION_VAR Sasl2_VERSION ) if(Sasl2_FOUND AND NOT TARGET Sasl2::Sasl2) add_library(Sasl2::Sasl2 UNKNOWN IMPORTED) set_target_properties(Sasl2::Sasl2 PROPERTIES IMPORTED_LOCATION "${Sasl2_LIBRARIES}" INTERFACE_INCLUDE_DIRECTORIES "${Sasl2_INCLUDE_DIRS}") endif() mark_as_advanced(Sasl2_LIBRARIES Sasl2_INCLUDE_DIRS Sasl2_VERSION) include(FeatureSummary) set_package_properties(Sasl2 PROPERTIES URL "https://www.cyrusimap.org/sasl/" DESCRIPTION "The Cyrus-sasl library." ) diff --git a/find-modules/FindSeccomp.cmake b/find-modules/FindSeccomp.cmake index 76c83e8..fe9dca8 100644 --- a/find-modules/FindSeccomp.cmake +++ b/find-modules/FindSeccomp.cmake @@ -1,91 +1,70 @@ #.rst: # FindSeccomp # ----------- # # Try to locate the libseccomp library. # # This will define the following variables: # # ``Seccomp_FOUND`` # True if the seccomp library is available # ``Seccomp_INCLUDE_DIRS`` # The seccomp include directories # ``Seccomp_LIBRARIES`` # The seccomp libraries for linking # # If ``Seccomp_FOUND`` is TRUE, it will also define the following # imported target: # # ``Seccomp::Seccomp`` # The Seccomp library # # Since 5.44.0. #============================================================================= -# Copyright (c) 2017 Martin Flöser -# Copyright (c) 2017 David Kahles +# SPDX-FileCopyrightText: 2017 Martin Flöser +# SPDX-FileCopyrightText: 2017 David Kahles # -# 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. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= find_package(PkgConfig QUIET) pkg_check_modules(PKG_Libseccomp QUIET libseccomp) find_path(Seccomp_INCLUDE_DIRS NAMES seccomp.h HINTS ${PKG_Libseccomp_INCLUDE_DIRS} ) find_library(Seccomp_LIBRARIES NAMES seccomp HINTS ${PKG_Libseccomp_LIBRARY_DIRS} ) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Seccomp FOUND_VAR Seccomp_FOUND REQUIRED_VARS Seccomp_LIBRARIES Seccomp_INCLUDE_DIRS ) if (Seccomp_FOUND AND NOT TARGET Seccomp::Seccomp) add_library(Seccomp::Seccomp UNKNOWN IMPORTED) set_target_properties(Seccomp::Seccomp PROPERTIES IMPORTED_LOCATION "${Seccomp_LIBRARIES}" INTERFACE_INCLUDE_DIRECTORIES "${Seccomp_INCLUDE_DIRS}" ) endif() mark_as_advanced(Seccomp_LIBRARIES Seccomp_INCLUDE_DIRS) include(FeatureSummary) set_package_properties(Seccomp PROPERTIES URL "https://github.com/seccomp/libseccomp" DESCRIPTION "The enhanced seccomp library." ) diff --git a/find-modules/FindSharedMimeInfo.cmake b/find-modules/FindSharedMimeInfo.cmake index 06a3b2c..0969b72 100644 --- a/find-modules/FindSharedMimeInfo.cmake +++ b/find-modules/FindSharedMimeInfo.cmake @@ -1,114 +1,93 @@ #.rst: # FindSharedMimeInfo # ------------------ # # Try to find the shared-mime-info package. # # This will define the following variables: # # ``SharedMimeInfo_FOUND`` # True if system has the shared-mime-info package # ``UPDATE_MIME_DATABASE_EXECUTABLE`` # The update-mime-database executable # # and the following imported targets: # # ``SharedMimeInfo::UpdateMimeDatabase`` # The update-mime-database executable # # The follow macro is available:: # # update_xdg_mimetypes() # # Updates the XDG mime database at install time (unless the ``$DESTDIR`` # environment variable is set, in which case it is up to package managers to # perform this task). # # Since pre-1.0.0. #============================================================================= -# Copyright 2013-2014 Alex Merry -# Copyright 2007 Pino Toscano +# SPDX-FileCopyrightText: 2013-2014 Alex Merry +# SPDX-FileCopyrightText: 2007 Pino Toscano # -# 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. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake) ecm_find_package_version_check(SharedMimeInfo) find_program (UPDATE_MIME_DATABASE_EXECUTABLE NAMES update-mime-database) if (UPDATE_MIME_DATABASE_EXECUTABLE) execute_process( COMMAND "${UPDATE_MIME_DATABASE_EXECUTABLE}" -v OUTPUT_VARIABLE _smiVersionRaw ERROR_VARIABLE _smiVersionRaw) string(REGEX REPLACE "update-mime-database \\([a-zA-Z\\-]+\\) ([0-9]\\.[0-9]+).*" "\\1" SharedMimeInfo_VERSION_STRING "${_smiVersionRaw}") endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(SharedMimeInfo FOUND_VAR SharedMimeInfo_FOUND REQUIRED_VARS UPDATE_MIME_DATABASE_EXECUTABLE VERSION_VAR SharedMimeInfo_VERSION_STRING) if(SharedMimeInfo_FOUND AND NOT TARGET SharedMimeInfo::UpdateMimeDatabase) add_executable(SharedMimeInfo::UpdateMimeDatabase IMPORTED) set_target_properties(SharedMimeInfo::UpdateMimeDatabase PROPERTIES IMPORTED_LOCATION "${UPDATE_MIME_DATABASE_EXECUTABLE}" ) endif() mark_as_advanced(UPDATE_MIME_DATABASE_EXECUTABLE) function(UPDATE_XDG_MIMETYPES _path) get_filename_component(_xdgmimeDir "${_path}" NAME) if("${_xdgmimeDir}" STREQUAL packages ) get_filename_component(_xdgmimeDir "${_path}" PATH) else() set(_xdgmimeDir "${_path}") endif() # Note that targets and most variables are not available to install code install(CODE " set(DESTDIR_VALUE \"\$ENV{DESTDIR}\") if (NOT DESTDIR_VALUE) # under Windows relative paths are used, that's why it runs from CMAKE_INSTALL_PREFIX message(STATUS \"Updating MIME database at \${CMAKE_INSTALL_PREFIX}/${_xdgmimeDir}\") execute_process(COMMAND \"${UPDATE_MIME_DATABASE_EXECUTABLE}\" \"${_xdgmimeDir}\" WORKING_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}\") endif (NOT DESTDIR_VALUE) ") endfunction() include(FeatureSummary) set_package_properties(SharedMimeInfo PROPERTIES URL https://freedesktop.org/wiki/Software/shared-mime-info/ DESCRIPTION "A database of common MIME types") diff --git a/find-modules/FindUDev.cmake b/find-modules/FindUDev.cmake index 20d3f11..e3d584c 100644 --- a/find-modules/FindUDev.cmake +++ b/find-modules/FindUDev.cmake @@ -1,94 +1,72 @@ #.rst: # FindUDev # -------- # # Try to find the UDev library. # # This will define the following variables: # # ``UDev_FOUND`` # System has UDev. # # ``UDev_INCLUDE_DIRS`` # The libudev include directory. # # ``UDev_LIBRARIES`` # The libudev libraries. # # ``UDev_VERSION`` # The libudev version. # # If ``UDev_FOUND`` is TRUE, it will also define the following imported # target: # # ``UDev::UDev`` # The UDev library # # Since 5.57.0. #============================================================================= -# Copyright (c) 2010, Rafael Fernández López, -# Copyright (c) 2019, Volker Krause, +# SPDX-FileCopyrightText: 2010 Rafael Fernández López +# SPDX-FileCopyrightText: 2019 Volker Krause # -# 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 above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. Neither the name of the University nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= find_package(PkgConfig QUIET) pkg_check_modules(PC_UDEV QUIET libudev) find_path(UDev_INCLUDE_DIRS NAMES libudev.h HINTS ${PC_UDEV_INCLUDE_DIRS}) find_library(UDev_LIBRARIES NAMES udev HINTS ${PC_UDEV_LIBRARY_DIRS}) set(UDev_VERSION ${PC_UDEV_VERSION}) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(UDev FOUND_VAR UDev_FOUND REQUIRED_VARS UDev_INCLUDE_DIRS UDev_LIBRARIES VERSION_VAR UDev_VERSION ) mark_as_advanced(UDev_INCLUDE_DIRS UDev_LIBRARIES) if(UDev_FOUND AND NOT TARGET UDev::UDev) add_library(UDev::UDev UNKNOWN IMPORTED) set_target_properties(UDev::UDev PROPERTIES IMPORTED_LOCATION "${UDev_LIBRARIES}" INTERFACE_INCLUDE_DIRECTORIES "${UDev_INCLUDE_DIRS}" INTERFACE_COMPILE_DEFINITIONS "${PC_UDEV_CFLAGS_OTHER}" ) endif() # backward compat variables, remove for KF6 set(UDEV_FOUND ${UDev_FOUND}) set(UDEV_LIBS ${UDev_LIBRARIES}) set(UDEV_INCLUDE_DIR ${UDev_INCLUDE_DIRS}) mark_as_advanced(UDEV_FOUND UDEV_LIBS UDEV_INCLUDE_DIR) include(FeatureSummary) set_package_properties(UDev PROPERTIES DESCRIPTION "API for enumerating and introspecting local devices (part of systemd)" URL "https://freedesktop.org/wiki/Software/systemd/" ) diff --git a/find-modules/FindWayland.cmake b/find-modules/FindWayland.cmake index 3c0059a..871fd91 100644 --- a/find-modules/FindWayland.cmake +++ b/find-modules/FindWayland.cmake @@ -1,143 +1,122 @@ #.rst: # FindWayland # ----------- # # Try to find Wayland. # # This is a component-based find module, which makes use of the COMPONENTS # and OPTIONAL_COMPONENTS arguments to find_module. The following components # are available:: # # Client Server Cursor Egl # # If no components are specified, this module will act as though all components # were passed to OPTIONAL_COMPONENTS. # # This module will define the following variables, independently of the # components searched for or found: # # ``Wayland_FOUND`` # TRUE if (the requested version of) Wayland is available # ``Wayland_VERSION`` # Found Wayland version # ``Wayland_TARGETS`` # A list of all targets imported by this module (note that there may be more # than the components that were requested) # ``Wayland_LIBRARIES`` # This can be passed to target_link_libraries() instead of the imported # targets # ``Wayland_INCLUDE_DIRS`` # This should be passed to target_include_directories() if the targets are # not used for linking # ``Wayland_DEFINITIONS`` # This should be passed to target_compile_options() if the targets are not # used for linking # # For each searched-for components, ``Wayland__FOUND`` will be set to # TRUE if the corresponding Wayland library was found, and FALSE otherwise. If # ``Wayland__FOUND`` is TRUE, the imported target # ``Wayland::`` will be defined. This module will also attempt to # determine ``Wayland_*_VERSION`` variables for each imported target, although # ``Wayland_VERSION`` should normally be sufficient. # # In general we recommend using the imported targets, as they are easier to use # and provide more control. Bear in mind, however, that if any target is in the # link interface of an exported library, it must be made available by the # package config file. # # Since pre-1.0.0. #============================================================================= -# Copyright 2014 Alex Merry -# Copyright 2014 Martin Gräßlin +# SPDX-FileCopyrightText: 2014 Alex Merry +# SPDX-FileCopyrightText: 2014 Martin Gräßlin # -# 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. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake) ecm_find_package_version_check(Wayland) set(Wayland_known_components Client Server Cursor Egl ) foreach(_comp ${Wayland_known_components}) string(TOLOWER "${_comp}" _lc_comp) set(Wayland_${_comp}_component_deps) set(Wayland_${_comp}_pkg_config "wayland-${_lc_comp}") set(Wayland_${_comp}_lib "wayland-${_lc_comp}") set(Wayland_${_comp}_header "wayland-${_lc_comp}.h") endforeach() set(Wayland_Egl_component_deps Client) ecm_find_package_parse_components(Wayland RESULT_VAR Wayland_components KNOWN_COMPONENTS ${Wayland_known_components} ) ecm_find_package_handle_library_components(Wayland COMPONENTS ${Wayland_components} ) # If pkg-config didn't provide us with version information, # try to extract it from wayland-version.h # (Note that the version from wayland-egl.pc will probably be # the Mesa version, rather than the Wayland version, but that # version will be ignored as we always find wayland-client.pc # first). if(NOT Wayland_VERSION) find_file(Wayland_VERSION_HEADER NAMES wayland-version.h HINTS ${Wayland_INCLUDE_DIRS} ) mark_as_advanced(Wayland_VERSION_HEADER) if(Wayland_VERSION_HEADER) file(READ ${Wayland_VERSION_HEADER} _wayland_version_header_contents) string(REGEX REPLACE "^.*[ \t]+WAYLAND_VERSION[ \t]+\"([0-9.]*)\".*$" "\\1" Wayland_VERSION "${_wayland_version_header_contents}" ) unset(_wayland_version_header_contents) endif() endif() find_package_handle_standard_args(Wayland FOUND_VAR Wayland_FOUND REQUIRED_VARS Wayland_LIBRARIES VERSION_VAR Wayland_VERSION HANDLE_COMPONENTS ) include(FeatureSummary) set_package_properties(Wayland PROPERTIES URL "https://wayland.freedesktop.org/" DESCRIPTION "C library implementation of the Wayland protocol: a protocol for a compositor to talk to its clients" ) diff --git a/find-modules/FindWaylandScanner.cmake b/find-modules/FindWaylandScanner.cmake index 0f08f59..61b4875 100644 --- a/find-modules/FindWaylandScanner.cmake +++ b/find-modules/FindWaylandScanner.cmake @@ -1,167 +1,146 @@ #.rst: # FindWaylandScanner # ------------------ # # Try to find wayland-scanner. # # If the wayland-scanner executable is not in your PATH, you can provide # an alternative name or full path location with the ``WaylandScanner_EXECUTABLE`` # variable. # # This will define the following variables: # # ``WaylandScanner_FOUND`` # True if wayland-scanner is available. # # ``WaylandScanner_EXECUTABLE`` # The wayland-scanner executable. # # If ``WaylandScanner_FOUND`` is TRUE, it will also define the following imported # target: # # ``Wayland::Scanner`` # The wayland-scanner executable. # # This module provides the following functions to generate C protocol # implementations: # # - ``ecm_add_wayland_client_protocol`` # - ``ecm_add_wayland_server_protocol`` # # :: # # ecm_add_wayland_client_protocol( # PROTOCOL # BASENAME ) # # Generate Wayland client protocol files from ```` XML # definition for the ```` interface and append those files # to ````. # # :: # # ecm_add_wayland_server_protocol( # PROTOCOL # BASENAME ) # # Generate Wayland server protocol files from ```` XML # definition for the ```` interface and append those files # to ````. # # Since 1.4.0. #============================================================================= -# Copyright 2012-2014 Pier Luigi Fiorini -# -# 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. +# SPDX-FileCopyrightText: 2012-2014 Pier Luigi Fiorini +# +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake) ecm_find_package_version_check(WaylandScanner) # Find wayland-scanner find_program(WaylandScanner_EXECUTABLE NAMES wayland-scanner) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(WaylandScanner FOUND_VAR WaylandScanner_FOUND REQUIRED_VARS WaylandScanner_EXECUTABLE ) mark_as_advanced(WaylandScanner_EXECUTABLE) if(NOT TARGET Wayland::Scanner AND WaylandScanner_FOUND) add_executable(Wayland::Scanner IMPORTED) set_target_properties(Wayland::Scanner PROPERTIES IMPORTED_LOCATION "${WaylandScanner_EXECUTABLE}" ) endif() include(FeatureSummary) set_package_properties(WaylandScanner PROPERTIES URL "https://wayland.freedesktop.org/" DESCRIPTION "Executable that converts XML protocol files to C code" ) include(CMakeParseArguments) function(ecm_add_wayland_client_protocol out_var) # Parse arguments set(oneValueArgs PROTOCOL BASENAME) cmake_parse_arguments(ARGS "" "${oneValueArgs}" "" ${ARGN}) if(ARGS_UNPARSED_ARGUMENTS) message(FATAL_ERROR "Unknown keywords given to ecm_add_wayland_client_protocol(): \"${ARGS_UNPARSED_ARGUMENTS}\"") endif() get_filename_component(_infile ${ARGS_PROTOCOL} ABSOLUTE) set(_client_header "${CMAKE_CURRENT_BINARY_DIR}/wayland-${ARGS_BASENAME}-client-protocol.h") set(_code "${CMAKE_CURRENT_BINARY_DIR}/wayland-${ARGS_BASENAME}-protocol.c") set_source_files_properties(${_client_header} GENERATED) set_source_files_properties(${_code} GENERATED) set_property(SOURCE ${_client_header} ${_code} PROPERTY SKIP_AUTOMOC ON) add_custom_command(OUTPUT "${_client_header}" COMMAND ${WaylandScanner_EXECUTABLE} client-header ${_infile} ${_client_header} DEPENDS ${_infile} VERBATIM) add_custom_command(OUTPUT "${_code}" COMMAND ${WaylandScanner_EXECUTABLE} code ${_infile} ${_code} DEPENDS ${_infile} ${_client_header} VERBATIM) list(APPEND ${out_var} "${_client_header}" "${_code}") set(${out_var} ${${out_var}} PARENT_SCOPE) endfunction() function(ecm_add_wayland_server_protocol out_var) # Parse arguments set(oneValueArgs PROTOCOL BASENAME) cmake_parse_arguments(ARGS "" "${oneValueArgs}" "" ${ARGN}) if(ARGS_UNPARSED_ARGUMENTS) message(FATAL_ERROR "Unknown keywords given to ecm_add_wayland_server_protocol(): \"${ARGS_UNPARSED_ARGUMENTS}\"") endif() ecm_add_wayland_client_protocol(${out_var} PROTOCOL ${ARGS_PROTOCOL} BASENAME ${ARGS_BASENAME}) get_filename_component(_infile ${ARGS_PROTOCOL} ABSOLUTE) set(_server_header "${CMAKE_CURRENT_BINARY_DIR}/wayland-${ARGS_BASENAME}-server-protocol.h") set_property(SOURCE ${_server_header} PROPERTY SKIP_AUTOMOC ON) set_source_files_properties(${_server_header} GENERATED) add_custom_command(OUTPUT "${_server_header}" COMMAND ${WaylandScanner_EXECUTABLE} server-header ${_infile} ${_server_header} DEPENDS ${_infile} VERBATIM) list(APPEND ${out_var} "${_server_header}") set(${out_var} ${${out_var}} PARENT_SCOPE) endfunction() diff --git a/find-modules/FindX11_XCB.cmake b/find-modules/FindX11_XCB.cmake index a5aae2c..589e256 100644 --- a/find-modules/FindX11_XCB.cmake +++ b/find-modules/FindX11_XCB.cmake @@ -1,118 +1,97 @@ #.rst: # FindX11_XCB # ----------- # # Try to find the X11 XCB compatibility library. # # This will define the following variables: # # ``X11_XCB_FOUND`` # True if (the requested version of) libX11-xcb is available # ``X11_XCB_VERSION`` # The version of libX11-xcb (this is not guaranteed to be set even when # X11_XCB_FOUND is true) # ``X11_XCB_LIBRARIES`` # This can be passed to target_link_libraries() instead of the ``EGL::EGL`` # target # ``X11_XCB_INCLUDE_DIR`` # This should be passed to target_include_directories() if the target is not # used for linking # ``X11_XCB_DEFINITIONS`` # This should be passed to target_compile_options() if the target is not # used for linking # # If ``X11_XCB_FOUND`` is TRUE, it will also define the following imported # target: # # ``X11::XCB`` # The X11 XCB compatibility library # # In general we recommend using the imported target, as it is easier to use. # Bear in mind, however, that if the target is in the link interface of an # exported library, it must be made available by the package config file. # # Since pre-1.0.0. #============================================================================= -# Copyright 2014 Alex Merry -# Copyright 2011 Fredrik Höglund -# Copyright 2008 Helio Chissini de Castro -# Copyright 2007 Matthias Kretz +# SPDX-FileCopyrightText: 2014 Alex Merry +# SPDX-FileCopyrightText: 2011 Fredrik Höglund +# SPDX-FileCopyrightText: 2008 Helio Chissini de Castro +# SPDX-FileCopyrightText: 2007 Matthias Kretz # -# 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. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake) ecm_find_package_version_check(X11_XCB) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) pkg_check_modules(PKG_X11_XCB QUIET x11-xcb) set(X11_XCB_DEFINITIONS ${PKG_X11_XCB_CFLAGS_OTHER}) set(X11_XCB_VERSION ${PKG_X11_XCB_VERSION}) find_path(X11_XCB_INCLUDE_DIR NAMES X11/Xlib-xcb.h HINTS ${PKG_X11_XCB_INCLUDE_DIRS} ) find_library(X11_XCB_LIBRARY NAMES X11-xcb HINTS ${PKG_X11_XCB_LIBRARY_DIRS} ) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(X11_XCB FOUND_VAR X11_XCB_FOUND REQUIRED_VARS X11_XCB_LIBRARY X11_XCB_INCLUDE_DIR VERSION_VAR X11_XCB_VERSION ) if(X11_XCB_FOUND AND NOT TARGET X11::XCB) add_library(X11::XCB UNKNOWN IMPORTED) set_target_properties(X11::XCB PROPERTIES IMPORTED_LOCATION "${X11_XCB_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${X11_XCB_DEFINITIONS}" INTERFACE_INCLUDE_DIRECTORIES "${X11_XCB_INCLUDE_DIR}" ) endif() mark_as_advanced(X11_XCB_INCLUDE_DIR X11_XCB_LIBRARY) # compatibility variables set(X11_XCB_LIBRARIES ${X11_XCB_LIBRARY}) set(X11_XCB_INCLUDE_DIRS ${X11_XCB_INCLUDE_DIR}) set(X11_XCB_VERSION_STRING ${X11_XCB_VERSION}) include(FeatureSummary) set_package_properties(X11_XCB PROPERTIES URL "https://xorg.freedesktop.org/" DESCRIPTION "A compatibility library for code that translates Xlib API calls into XCB calls" ) diff --git a/find-modules/FindXCB.cmake b/find-modules/FindXCB.cmake index c545b39..101605c 100644 --- a/find-modules/FindXCB.cmake +++ b/find-modules/FindXCB.cmake @@ -1,201 +1,180 @@ #.rst: # FindXCB # ------- # # Try to find XCB. # # This is a component-based find module, which makes use of the COMPONENTS and # OPTIONAL_COMPONENTS arguments to find_module. The following components are # available:: # # XCB # ATOM AUX COMPOSITE CURSOR DAMAGE # DPMS DRI2 DRI3 EVENT EWMH # GLX ICCCM IMAGE KEYSYMS PRESENT # RANDR RECORD RENDER RENDERUTIL RES # SCREENSAVER SHAPE SHM SYNC UTIL # XEVIE XF86DRI XFIXES XINERAMA XINPUT # XKB XPRINT XTEST XV XVMC # # If no components are specified, this module will act as though all components # except XINPUT (which is considered unstable) were passed to # OPTIONAL_COMPONENTS. # # This module will define the following variables, independently of the # components searched for or found: # # ``XCB_FOUND`` # True if (the requestion version of) xcb is available # ``XCB_VERSION`` # Found xcb version # ``XCB_TARGETS`` # A list of all targets imported by this module (note that there may be more # than the components that were requested) # ``XCB_LIBRARIES`` # This can be passed to target_link_libraries() instead of the imported # targets # ``XCB_INCLUDE_DIRS`` # This should be passed to target_include_directories() if the targets are # not used for linking # ``XCB_DEFINITIONS`` # This should be passed to target_compile_options() if the targets are not # used for linking # # For each searched-for components, ``XCB__FOUND`` will be set to # true if the corresponding xcb library was found, and false otherwise. If # ``XCB__FOUND`` is true, the imported target ``XCB::`` # will be defined. This module will also attempt to determine # ``XCB_*_VERSION`` variables for each imported target, although # ``XCB_VERSION`` should normally be sufficient. # # In general we recommend using the imported targets, as they are easier to use # and provide more control. Bear in mind, however, that if any target is in the # link interface of an exported library, it must be made available by the # package config file. # # Since pre-1.0.0. #============================================================================= -# Copyright 2011 Fredrik Höglund -# Copyright 2013 Martin Gräßlin -# Copyright 2014-2015 Alex Merry +# SPDX-FileCopyrightText: 2011 Fredrik Höglund +# SPDX-FileCopyrightText: 2013 Martin Gräßlin +# SPDX-FileCopyrightText: 2014-2015 Alex Merry # -# 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. +# SPDX-License-Identifier: BSD-3-Clause #============================================================================= include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake) ecm_find_package_version_check(XCB) # Note that this list needs to be ordered such that any component # appears after its dependencies set(XCB_known_components XCB RENDER SHAPE XFIXES SHM ATOM AUX COMPOSITE CURSOR DAMAGE DPMS DRI2 DRI3 EVENT EWMH GLX ICCCM IMAGE KEYSYMS PRESENT RANDR RECORD RENDERUTIL RES SCREENSAVER SYNC UTIL XEVIE XF86DRI XINERAMA XINPUT XKB XPRINT XTEST XV XVMC ) # XINPUT is unstable; do not include it by default set(XCB_default_components ${XCB_known_components}) list(REMOVE_ITEM XCB_default_components "XINPUT") # default component info: xcb components have fairly predictable # header files, library names and pkg-config names foreach(_comp ${XCB_known_components}) string(TOLOWER "${_comp}" _lc_comp) set(XCB_${_comp}_component_deps XCB) set(XCB_${_comp}_pkg_config "xcb-${_lc_comp}") set(XCB_${_comp}_lib "xcb-${_lc_comp}") set(XCB_${_comp}_header "xcb/${_lc_comp}.h") endforeach() # exceptions set(XCB_XCB_component_deps) set(XCB_COMPOSITE_component_deps XCB XFIXES) set(XCB_DAMAGE_component_deps XCB XFIXES) set(XCB_IMAGE_component_deps XCB SHM) set(XCB_RENDERUTIL_component_deps XCB RENDER) set(XCB_XFIXES_component_deps XCB RENDER SHAPE) set(XCB_XVMC_component_deps XCB XV) set(XCB_XV_component_deps XCB SHM) set(XCB_XCB_pkg_config "xcb") set(XCB_XCB_lib "xcb") set(XCB_ATOM_header "xcb/xcb_atom.h") set(XCB_ATOM_lib "xcb-util") set(XCB_AUX_header "xcb/xcb_aux.h") set(XCB_AUX_lib "xcb-util") set(XCB_CURSOR_header "xcb/xcb_cursor.h") set(XCB_EVENT_header "xcb/xcb_event.h") set(XCB_EVENT_lib "xcb-util") set(XCB_EWMH_header "xcb/xcb_ewmh.h") set(XCB_ICCCM_header "xcb/xcb_icccm.h") set(XCB_IMAGE_header "xcb/xcb_image.h") set(XCB_KEYSYMS_header "xcb/xcb_keysyms.h") set(XCB_PIXEL_header "xcb/xcb_pixel.h") set(XCB_RENDERUTIL_header "xcb/xcb_renderutil.h") set(XCB_RENDERUTIL_lib "xcb-render-util") set(XCB_UTIL_header "xcb/xcb_util.h") ecm_find_package_parse_components(XCB RESULT_VAR XCB_components KNOWN_COMPONENTS ${XCB_known_components} DEFAULT_COMPONENTS ${XCB_default_components} ) list(FIND XCB_components "XINPUT" _XCB_XINPUT_index) if (NOT _XCB_XINPUT_index EQUAL -1) message(AUTHOR_WARNING "XINPUT from XCB was requested: this is EXPERIMENTAL and is likely to unavailable on many systems!") endif() ecm_find_package_handle_library_components(XCB COMPONENTS ${XCB_components} ) find_package_handle_standard_args(XCB FOUND_VAR XCB_FOUND REQUIRED_VARS XCB_LIBRARIES VERSION_VAR XCB_VERSION HANDLE_COMPONENTS ) include(FeatureSummary) set_package_properties(XCB PROPERTIES URL "https://xcb.freedesktop.org/" DESCRIPTION "X protocol C-language Binding" ) diff --git a/find-modules/Qt5Ruleset.py b/find-modules/Qt5Ruleset.py index 8ab8b39..1b4defb 100644 --- a/find-modules/Qt5Ruleset.py +++ b/find-modules/Qt5Ruleset.py @@ -1,156 +1,134 @@ #!/usr/bin/env python # -# Copyright 2016 Shaheed Haque -# Copyright 2016 Stephen Kelly -# -# 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. +# SPDX-FileCopyrightText: 2016 Shaheed Haque +# SPDX-FileCopyrightText: 2016 Stephen Kelly # +# SPDX-License-Identifier: BSD-3-Clause from __future__ import print_function import rules_engine def container_rules(): return [ # # SIP does not seem to be able to handle these. # [".*", "(QMetaTypeId|QTypeInfo)<.*>", ".*", ".*", ".*", rules_engine.container_discard], # # SIP does not seem to be able to handle templated containers. # [".*", ".*<.*", ".*", ".*", ".*", rules_engine.container_discard], ] def function_rules(): return [ # # Discard functions emitted by QOBJECT. # [".*", "metaObject|qt_metacast|tr|trUtf8|qt_metacall|qt_check_for_QOBJECT_macro|qt_check_for_QGADGET_macro", ".*", ".*", ".*", rules_engine.function_discard], # # SIP does not support operator=. # [".*", "operator=", ".*", ".*", ".*", rules_engine.function_discard], [".*", ".*", ".*", ".*", ".*::QPrivateSignal.*", rules_engine.function_discard], # # TODO: Temporarily remove any functions which require templates. SIP seems to support, e.g. QPairs, # but we have not made them work yet. # [".*", ".*", ".+", ".*", ".*", rules_engine.function_discard], [".*", ".*<.*>.*", ".*", ".*", ".*", rules_engine.function_discard], [".*", ".*", ".*", ".*", ".*std::function.*", rules_engine.function_discard], [".*", ".*", ".*", ".*", ".*std::numeric_limits.*", rules_engine.function_discard], [".*", ".*", ".*", ".*", ".*QPair.*", rules_engine.function_discard], [".*", ".*", ".*", ".*QPair.*", ".*", rules_engine.function_discard], [".*", ".*", ".*", ".*", ".*QDebug.*", rules_engine.function_discard], [".*", ".*", ".*", ".*QDebug.*", ".*", rules_engine.function_discard], [".*", ".*", ".*", ".*", ".*QExplicitlySharedDataPointer.*", rules_engine.function_discard], [".*", ".*", ".*", ".*QExplicitlySharedDataPointer.*", ".*", rules_engine.function_discard], [".*", ".*", ".*", ".*", ".*Private.*", rules_engine.function_discard], [".*", ".*", ".*", "mode_t", ".*", rules_engine.return_rewrite_mode_t_as_int], [".*", "d_func", ".*", ".*", ".*", rules_engine.function_discard], [".*", "operator\|", ".*", ".*", ".*", rules_engine.function_discard], ] def parameter_rules(): return [ # # Annotate with Transfer or TransferThis when we see a parent object. # [".*", ".*", ".*", r"[KQ][A-Za-z_0-9]+\W*\*\W*parent", ".*", rules_engine.parameter_transfer_to_parent], [".*", ".*", ".*", "mode_t.*", ".*", rules_engine.param_rewrite_mode_t_as_int], [".*", ".*", ".*", ".*enum .*", ".*", rules_engine.parameter_strip_class_enum], ] def variable_rules(): return [ # # Discard variable emitted by QOBJECT. # [".*", "staticMetaObject", ".*", rules_engine.variable_discard], # # Discard "private" variables. # [".*", "d_ptr", ".*", rules_engine.variable_discard], [".*", "d", ".*Private.*", rules_engine.variable_discard], ] def typedef_rules(): return [] def forward_declaration_rules(): return [] class RuleSet(rules_engine.RuleSet): """ SIP file generator rules. This is a set of (short, non-public) functions and regular expression-based matching rules. """ def __init__(self): self._container_db = rules_engine.ContainerRuleDb(container_rules) self._forward_declaration_db = rules_engine.ForwardDeclarationRuleDb(forward_declaration_rules) self._fn_db = rules_engine.FunctionRuleDb(function_rules) self._param_db = rules_engine.ParameterRuleDb(parameter_rules) self._typedef_db = rules_engine.TypedefRuleDb(typedef_rules) self._var_db = rules_engine.VariableRuleDb(variable_rules) self._methodcode = rules_engine.MethodCodeDb({}) self._modulecode = rules_engine.ModuleCodeDb({}) def container_rules(self): return self._container_db def forward_declaration_rules(self): return self._forward_declaration_db def function_rules(self): return self._fn_db def parameter_rules(self): return self._param_db def typedef_rules(self): return self._typedef_db def variable_rules(self): return self._var_db def methodcode_rules(self): return self._methodcode def modulecode_rules(self): return self._modulecode def methodcode(self, function, sip): return self._methodcode.apply(function, sip) def modulecode(self, filename, sip): return self._modulecode.apply(filename, sip) diff --git a/find-modules/rules_engine.py b/find-modules/rules_engine.py index 88cb277..60611ee 100755 --- a/find-modules/rules_engine.py +++ b/find-modules/rules_engine.py @@ -1,996 +1,974 @@ #!/usr/bin/env python # -# Copyright 2016 by Shaheed Haque (srhaque@theiet.org) -# Copyright 2016 Stephen Kelly -# -# 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. +# SPDX-FileCopyrightText: 2016 by Shaheed Haque +# SPDX-FileCopyrightText: 2016 Stephen Kelly # +# SPDX-License-Identifier: BSD-3-Clause """SIP file generation rules engine.""" from __future__ import print_function from abc import * import argparse import gettext import inspect import logging import os import re import sys import textwrap import traceback from copy import deepcopy from clang.cindex import CursorKind from clang.cindex import AccessSpecifier class HelpFormatter(argparse.ArgumentDefaultsHelpFormatter, argparse.RawDescriptionHelpFormatter): pass logger = logging.getLogger(__name__) gettext.install(__name__) _SEPARATOR = "\x00" def _parents(container): parents = [] parent = container.semantic_parent while parent and parent.kind != CursorKind.TRANSLATION_UNIT: parents.append(parent.spelling) parent = parent.semantic_parent if parents: parents = "::".join(reversed(parents)) else: parents = os.path.basename(container.translation_unit.spelling) return parents class Rule(object): def __init__(self, db, rule_number, fn, pattern_zip): # # Derive a useful name for diagnostic purposes. # caller = os.path.basename(inspect.stack()[3][1]) self.name = "{}:{}[{}],{}".format(caller, type(db).__name__, rule_number, fn.__name__) self.rule_number = rule_number self.fn = fn self.usage = 0 try: groups = ["(?P<{}>{})".format(name, pattern) for pattern, name in pattern_zip] groups = _SEPARATOR.join(groups) # # We'll use re.match to anchor the start of the match, and so need a $ to anchor the end. # self.matcher = re.compile(groups + "$") except Exception as e: groups = ["{} '{}'".format(name, pattern) for pattern, name in pattern_zip] groups = ", ".join(groups) raise RuntimeError(_("Bad {}: {}: {}").format(self, groups, e)) def match(self, candidate): return self.matcher.match(candidate) def trace_result(self, parents, item, original, modified): """ Record any modification both in the log and the returned result. If a rule fired, but caused no modification, that is logged. :return: Modifying rule or None. """ fqn = parents + "::" + original["name"] + "[" + str(item.extent.start.line) + "]" return self._trace_result(fqn, original, modified) def _trace_result(self, fqn, original, modified): """ Record any modification both in the log and the returned result. If a rule fired, but caused no modification, that is logged. :return: Modifying rule or None. """ if not modified["name"]: logger.debug(_("Rule {} suppressed {}, {}").format(self, fqn, original)) else: delta = False for k, v in original.items(): if v != modified[k]: delta = True break if delta: logger.debug(_("Rule {} modified {}, {}->{}").format(self, fqn, original, modified)) else: logger.warn(_("Rule {} did not modify {}, {}").format(self, fqn, original)) return None return self def __str__(self): return self.name class AbstractCompiledRuleDb(object): __metaclass__ = ABCMeta def __init__(self, db, parameter_names): self.db = db self.compiled_rules = [] for i, raw_rule in enumerate(db()): if len(raw_rule) != len(parameter_names) + 1: raise RuntimeError(_("Bad raw rule {}: {}: {}").format(db.__name__, raw_rule, parameter_names)) z = zip(raw_rule[:-1], parameter_names) self.compiled_rules.append(Rule(self, i, raw_rule[-1], z)) self.candidate_formatter = _SEPARATOR.join(["{}"] * len(parameter_names)) def _match(self, *args): candidate = self.candidate_formatter.format(*args) for rule in self.compiled_rules: matcher = rule.match(candidate) if matcher: # # Only use the first matching rule. # rule.usage += 1 return matcher, rule return None, None @abstractmethod def apply(self, *args): raise NotImplemented(_("Missing subclass")) def dump_usage(self, fn): """ Dump the usage counts.""" for rule in self.compiled_rules: fn(str(rule), rule.usage) class ContainerRuleDb(AbstractCompiledRuleDb): """ THE RULES FOR CONTAINERS. These are used to customize the behaviour of the SIP generator by allowing the declaration for any container (class, namespace, struct, union) to be customized, for example to add SIP compiler annotations. Each entry in the raw rule database must be a list with members as follows: 0. A regular expression which matches the fully-qualified name of the "container" enclosing the container. 1. A regular expression which matches the container name. 2. A regular expression which matches any template parameters. 3. A regular expression which matches the container declaration. 4. A regular expression which matches any base specifiers. 5. A function. In use, the database is walked in order from the first entry. If the regular expressions are matched, the function is called, and no further entries are walked. The function is called with the following contract: def container_xxx(container, sip, matcher): ''' Return a modified declaration for the given container. :param container: The clang.cindex.Cursor for the container. :param sip: A dict with the following keys: name The name of the container. template_parameters Any template parameters. decl The declaration. base_specifiers Any base specifiers. body The body, less the outer pair of braces. annotations Any SIP annotations. :param matcher: The re.Match object. This contains named groups corresponding to the key names above EXCEPT body and annotations. :return: An updated set of sip.xxx values. Setting sip.name to the empty string will cause the container to be suppressed. ''' :return: The compiled form of the rules. """ def __init__(self, db): super(ContainerRuleDb, self).__init__(db, ["parents", "container", "template_parameters", "decl", "base_specifiers"]) def apply(self, container, sip): """ Walk over the rules database for containers, applying the first matching transformation. :param container: The clang.cindex.Cursor for the container. :param sip: The SIP dict (may be modified on return). :return: Modifying rule or None (even if a rule matched, it may not modify things). """ parents = _parents(container) matcher, rule = self._match(parents, sip["name"], ", ".join(sip["template_parameters"]), sip["decl"], ", ".join(sip["base_specifiers"])) if matcher: before = deepcopy(sip) rule.fn(container, sip, matcher) return rule.trace_result(parents, container, before, sip) return None class ForwardDeclarationRuleDb(AbstractCompiledRuleDb): """ THE RULES FOR FORWARD DECLARATIONS. These are used to customize the behaviour of the SIP generator by allowing the forward declaration for any container (class, struct, union) to be customized, for example to add SIP compiler annotations. Each entry in the raw rule database must be a list with members as follows: 0. A regular expression which matches the fully-qualified name of the "container" enclosing the container. 1. A regular expression which matches the container name. 2. A regular expression which matches any template parameters. 3. A function. In use, the database is walked in order from the first entry. If the regular expressions are matched, the function is called, and no further entries are walked. The function is called with the following contract: def declaration_xxx(container, sip, matcher): ''' Return a modified declaration for the given container. :param container: The clang.cindex.Cursor for the container. :param sip: A dict with the following keys: name The name of the container. template_parameters Any template parameters. annotations Any SIP annotations. :param matcher: The re.Match object. This contains named groups corresponding to the key names above EXCEPT body and annotations. :return: An updated set of sip.xxx values. Setting sip.name to the empty string will cause the container to be suppressed. ''' :return: The compiled form of the rules. """ def __init__(self, db): super(ForwardDeclarationRuleDb, self).__init__(db, ["parents", "container", "template_parameters"]) def apply(self, container, sip): """ Walk over the rules database for containers, applying the first matching transformation. :param container: The clang.cindex.Cursor for the container. :param sip: The SIP dict (may be modified on return). :return: Modifying rule or None (even if a rule matched, it may not modify things). """ parents = _parents(container) matcher, rule = self._match(parents, sip["name"], ", ".join(sip["template_parameters"])) if matcher: before = deepcopy(sip) rule.fn(container, sip, matcher) return rule.trace_result(parents, container, before, sip) return None class FunctionRuleDb(AbstractCompiledRuleDb): """ THE RULES FOR FUNCTIONS. These are used to customize the behaviour of the SIP generator by allowing the declaration for any function to be customized, for example to add SIP compiler annotations. Each entry in the raw rule database must be a list with members as follows: 0. A regular expression which matches the fully-qualified name of the "container" enclosing the function. 1. A regular expression which matches the function name. 2. A regular expression which matches any template parameters. 3. A regular expression which matches the function result. 4. A regular expression which matches the function parameters (e.g. "int a, void *b" for "int foo(int a, void *b)"). 5. A function. In use, the database is walked in order from the first entry. If the regular expressions are matched, the function is called, and no further entries are walked. The function is called with the following contract: def function_xxx(container, function, sip, matcher): ''' Return a modified declaration for the given function. :param container: The clang.cindex.Cursor for the container. :param function: The clang.cindex.Cursor for the function. :param sip: A dict with the following keys: name The name of the function. template_parameters Any template parameters. fn_result Result, if not a constructor. parameters The parameters. prefix Leading keyworks ("static"). Separated by space, ends with a space. suffix Trailing keywords ("const"). Separated by space, starts with space. annotations Any SIP annotations. :param matcher: The re.Match object. This contains named groups corresponding to the key names above EXCEPT annotations. :return: An updated set of sip.xxx values. Setting sip.name to the empty string will cause the container to be suppressed. ''' :return: The compiled form of the rules. """ def __init__(self, db): super(FunctionRuleDb, self).__init__(db, ["container", "function", "template_parameters", "fn_result", "parameters"]) def apply(self, container, function, sip): """ Walk over the rules database for functions, applying the first matching transformation. :param container: The clang.cindex.Cursor for the container. :param function: The clang.cindex.Cursor for the function. :param sip: The SIP dict (may be modified on return). :return: Modifying rule or None (even if a rule matched, it may not modify things). """ parents = _parents(function) matcher, rule = self._match(parents, sip["name"], ", ".join(sip["template_parameters"]), sip["fn_result"], ", ".join(sip["parameters"])) if matcher: sip.setdefault("code", "") before = deepcopy(sip) rule.fn(container, function, sip, matcher) return rule.trace_result(parents, function, before, sip) return None class ParameterRuleDb(AbstractCompiledRuleDb): """ THE RULES FOR FUNCTION PARAMETERS. These are used to customize the behaviour of the SIP generator by allowing the declaration for any parameter in any function to be customized, for example to add SIP compiler annotations. Each entry in the raw rule database must be a list with members as follows: 0. A regular expression which matches the fully-qualified name of the "container" enclosing the function enclosing the parameter. 1. A regular expression which matches the function name enclosing the parameter. 2. A regular expression which matches the parameter name. 3. A regular expression which matches the parameter declaration (e.g. "int foo"). 4. A regular expression which matches the parameter initialiser (e.g. "Xyz:MYCONST + 42"). 5. A function. In use, the database is walked in order from the first entry. If the regular expressions are matched, the function is called, and no further entries are walked. The function is called with the following contract: def parameter_xxx(container, function, parameter, sip, init, matcher): ''' Return a modified declaration and initialiser for the given parameter. :param container: The clang.cindex.Cursor for the container. :param function: The clang.cindex.Cursor for the function. :param parameter: The clang.cindex.Cursor for the parameter. :param sip: A dict with the following keys: name The name of the function. decl The declaration. init Any initialiser. annotations Any SIP annotations. :param matcher: The re.Match object. This contains named groups corresponding to the key names above EXCEPT annotations. :return: An updated set of sip.xxx values. ''' :return: The compiled form of the rules. """ def __init__(self, db): super(ParameterRuleDb, self).__init__(db, ["container", "function", "parameter", "decl", "init"]) def apply(self, container, function, parameter, sip): """ Walk over the rules database for parameters, applying the first matching transformation. :param container: The clang.cindex.Cursor for the container. :param function: The clang.cindex.Cursor for the function. :param parameter: The clang.cindex.Cursor for the parameter. :param sip: The SIP dict (may be modified on return). :return: Modifying rule or None (even if a rule matched, it may not modify things). """ parents = _parents(function) matcher, rule = self._match(parents, function.spelling, sip["name"], sip["decl"], sip["init"]) if matcher: sip.setdefault("code", "") before = deepcopy(sip) rule.fn(container, function, parameter, sip, matcher) return rule.trace_result(parents, parameter, before, sip) return None class TypedefRuleDb(AbstractCompiledRuleDb): """ THE RULES FOR TYPEDEFS. These are used to customize the behaviour of the SIP generator by allowing the declaration for any typedef to be customized, for example to add SIP compiler annotations. Each entry in the raw rule database must be a list with members as follows: 0. A regular expression which matches the fully-qualified name of the "container" enclosing the typedef. 1. A regular expression which matches the typedef name. 2. A function. In use, the database is walked in order from the first entry. If the regular expressions are matched, the function is called, and no further entries are walked. The function is called with the following contract: def typedef_xxx(container, typedef, sip, matcher): ''' Return a modified declaration for the given function. :param container: The clang.cindex.Cursor for the container. :param typedef: The clang.cindex.Cursor for the typedef. :param sip: A dict with the following keys: name The name of the typedef. annotations Any SIP annotations. :param matcher: The re.Match object. This contains named groups corresponding to the key names above EXCEPT annotations. :return: An updated set of sip.xxx values. Setting sip.name to the empty string will cause the container to be suppressed. ''' :return: The compiled form of the rules. """ def __init__(self, db): super(TypedefRuleDb, self).__init__(db, ["container", "typedef"]) def apply(self, container, typedef, sip): """ Walk over the rules database for typedefs, applying the first matching transformation. :param container: The clang.cindex.Cursor for the container. :param typedef: The clang.cindex.Cursor for the typedef. :param sip: The SIP dict. """ parents = _parents(typedef) matcher, rule = self._match(parents, sip["name"]) if matcher: before = deepcopy(sip) rule.fn(container, typedef, sip, matcher) return rule.trace_result(parents, typedef, before, sip) return None class VariableRuleDb(AbstractCompiledRuleDb): """ THE RULES FOR VARIABLES. These are used to customize the behaviour of the SIP generator by allowing the declaration for any variable to be customized, for example to add SIP compiler annotations. Each entry in the raw rule database must be a list with members as follows: 0. A regular expression which matches the fully-qualified name of the "container" enclosing the variable. 1. A regular expression which matches the variable name. 2. A regular expression which matches the variable declaration (e.g. "int foo"). 3. A function. In use, the database is walked in order from the first entry. If the regular expressions are matched, the function is called, and no further entries are walked. The function is called with the following contract: def variable_xxx(container, variable, sip, matcher): ''' Return a modified declaration for the given variable. :param container: The clang.cindex.Cursor for the container. :param variable: The clang.cindex.Cursor for the variable. :param sip: A dict with the following keys: name The name of the variable. decl The declaration. annotations Any SIP annotations. :param matcher: The re.Match object. This contains named groups corresponding to the key names above EXCEPT annotations. :return: An updated set of sip.xxx values. Setting sip.name to the empty string will cause the container to be suppressed. ''' :return: The compiled form of the rules. """ def __init__(self, db): super(VariableRuleDb, self).__init__(db, ["container", "variable", "decl"]) def apply(self, container, variable, sip): """ Walk over the rules database for variables, applying the first matching transformation. :param container: The clang.cindex.Cursor for the container. :param variable: The clang.cindex.Cursor for the variable. :param sip: The SIP dict (may be modified on return). :return: Modifying rule or None (even if a rule matched, it may not modify things). """ parents = _parents(variable) matcher, rule = self._match(parents, sip["name"], sip["decl"]) if matcher: sip.setdefault("code", "") before = deepcopy(sip) rule.fn(container, variable, sip, matcher) return rule.trace_result(parents, variable, before, sip) return None class AbstractCompiledCodeDb(object): __metaclass__ = ABCMeta def __init__(self, db): caller = os.path.basename(inspect.stack()[2][1]) self.name = "{}:{}".format(caller, type(self).__name__) self.db = db @abstractmethod def apply(self, function, sip): raise NotImplemented(_("Missing subclass")) def trace_result(self, parents, item, original, modified): """ Record any modification both in the log and the returned result. If a rule fired, but caused no modification, that is logged. :return: Modifying rule or None. """ fqn = parents + "::" + original["name"] + "[" + str(item.extent.start.line) + "]" self._trace_result(fqn, original, modified) def _trace_result(self, fqn, original, modified): """ Record any modification both in the log and the returned result. If a rule fired, but caused no modification, that is logged. :return: Modifying rule or None. """ if not modified["name"]: logger.debug(_("Rule {} suppressed {}, {}").format(self, fqn, original)) else: delta = False for k, v in original.items(): if v != modified[k]: delta = True break if delta: logger.debug(_("Rule {} modified {}, {}->{}").format(self, fqn, original, modified)) else: logger.warn(_("Rule {} did not modify {}, {}").format(self, fqn, original)) return None return self @abstractmethod def dump_usage(self, fn): raise NotImplemented(_("Missing subclass")) def __str__(self): return self.name class MethodCodeDb(AbstractCompiledCodeDb): """ THE RULES FOR INJECTING METHOD-RELATED CODE (such as %MethodCode, %VirtualCatcherCode, %VirtualCallCode and other method-level directives). These are used to customize the behaviour of the SIP generator by allowing method-level code injection. The raw rule database must be an outer dictionary as follows: 0. Each key is the fully-qualified name of a "container" enclosing methods. 1. Each value is an inner dictionary, each of whose keys is the name of a method. Each inner dictionary has entries which update the declaration as follows: "name": Optional string. If present, overrides the name of the method. "parameters": Optional list. If present, update the argument list. "fn_result": Optional string. If present, update the return type. "code": Required. Either a string, with the %XXXCode content, or a callable. In use, the database is directly indexed by "container" and then method name. If "code" entry is a string, then the other optional keys are interpreted as above. If "code" is a callable, it is called with the following contract: def methodcode_xxx(function, sip, entry): ''' Return a modified declaration for the given function. :param function: The clang.cindex.Cursor for the function. :param sip: A dict with keys as for function rules and (string) "code" keys described above. :param entry: The inner dictionary entry. :return: An updated set of sip.xxx values. ''' :return: The compiled form of the rules. """ __metaclass__ = ABCMeta def __init__(self, db): super(MethodCodeDb, self).__init__(db) for k, v in self.db.items(): for l in v.keys(): v[l]["usage"] = 0 def _get(self, item, name): parents = _parents(item) entries = self.db.get(parents, None) if not entries: return None entry = entries.get(name, None) if not entry: return None entry["usage"] += 1 return entry def apply(self, function, sip): """ Walk over the code database for functions, applying the first matching transformation. :param function: The clang.cindex.Cursor for the function. :param sip: The SIP dict (may be modified on return). :return: Modifying rule or None (even if a rule matched, it may not modify things). """ entry = self._get(function, sip["name"]) sip.setdefault("code", "") if entry: before = deepcopy(sip) if callable(entry["code"]): fn = entry["code"] fn_file = os.path.basename(inspect.getfile(fn)) trace = "// Generated (by {}:{}): {}\n".format(fn_file, fn.__name__, {k:v for (k,v) in entry.items() if k != "code"}) fn(function, sip, entry) else: trace = "// Inserted (by {}:{}): {}\n".format(_parents(function), function.spelling, {k:v for (k,v) in entry.items() if k != "code"}) sip["code"] = entry["code"] sip["parameters"] = entry.get("parameters", sip["parameters"]) sip["fn_result"] = entry.get("fn_result", sip["fn_result"]) # # Fetch/format the code. # sip["code"] = trace + textwrap.dedent(sip["code"]).strip() + "\n" return self.trace_result(_parents(function), function, before, sip) return None def dump_usage(self, fn): """ Dump the usage counts.""" for k in sorted(self.db.keys()): vk = self.db[k] for l in sorted(vk.keys()): vl = vk[l] fn(str(self) + " for " + k + "," + l, vl["usage"]) class ModuleCodeDb(AbstractCompiledCodeDb): """ THE RULES FOR INJECTING MODULE-RELATED CODE (such as %ExportedHeaderCode, %ModuleCode, %ModuleHeaderCode or other module-level directives). These are used to customize the behaviour of the SIP generator by allowing module-level code injection. The raw rule database must be a dictionary as follows: 0. Each key is the basename of a header file. 1. Each value has entries which update the declaration as follows: "code": Required. Either a string, with the %XXXCode content, or a callable. If "code" is a callable, it is called with the following contract: def module_xxx(filename, sip, entry): ''' Return a string to insert for the file. :param filename: The filename. :param sip: A dict with the key "name" for the filename, "decl" for the module body plus the "code" key described above. :param entry: The dictionary entry. :return: A string. ''' :return: The compiled form of the rules. """ __metaclass__ = ABCMeta def __init__(self, db): super(ModuleCodeDb, self).__init__(db) # # Add a usage count and other diagnostic support for each item in the database. # for k, v in self.db.items(): v["usage"] = 0 def _get(self, filename): # # Lookup for an actual hit. # entry = self.db.get(filename, None) if not entry: return None entry["usage"] += 1 return entry def apply(self, filename, sip): """ Walk over the code database for modules, applying the first matching transformation. :param filename: The file for the module. :param sip: The SIP dict (may be modified on return). :return: Modifying rule or None (even if a rule matched, it may not modify things). """ entry = self._get(filename) sip.setdefault("code", "") if entry: before = deepcopy(sip) if callable(entry["code"]): fn = entry["code"] fn_file = os.path.basename(inspect.getfile(fn)) trace = "\n// Generated (by {}:{}): {}".format(fn_file, fn.__name__, {k:v for (k,v) in entry.items() if k != "code"}) fn(filename, sip, entry) sip["code"] = trace + sip["code"] else: sip["code"] = entry["code"] # # Fetch/format the code. # sip["code"] = textwrap.dedent(sip["code"]).strip() + "\n" fqn = filename + "::" + before["name"] self._trace_result(fqn, before, sip) def dump_usage(self, fn): """ Dump the usage counts.""" for k in sorted(self.db.keys()): v = self.db[k] fn(str(self) + " for " + k, v["usage"]) class RuleSet(object): """ To implement your own binding, create a subclass of RuleSet, also called RuleSet in your own Python module. Your subclass will expose the raw rules along with other ancilliary data exposed through the subclass methods. You then simply run the SIP generation and SIP compilation programs passing in the name of your rules file """ __metaclass__ = ABCMeta @abstractmethod def container_rules(self): """ Return a compiled list of rules for containers. :return: A ContainerRuleDb instance """ raise NotImplemented(_("Missing subclass implementation")) @abstractmethod def forward_declaration_rules(self): """ Return a compiled list of rules for containers. :return: A ForwardDeclarationRuleDb instance """ raise NotImplemented(_("Missing subclass implementation")) @abstractmethod def function_rules(self): """ Return a compiled list of rules for functions. :return: A FunctionRuleDb instance """ raise NotImplemented(_("Missing subclass implementation")) @abstractmethod def parameter_rules(self): """ Return a compiled list of rules for function parameters. :return: A ParameterRuleDb instance """ raise NotImplemented(_("Missing subclass implementation")) @abstractmethod def typedef_rules(self): """ Return a compiled list of rules for typedefs. :return: A TypedefRuleDb instance """ raise NotImplemented(_("Missing subclass implementation")) @abstractmethod def variable_rules(self): """ Return a compiled list of rules for variables. :return: A VariableRuleDb instance """ raise NotImplemented(_("Missing subclass implementation")) @abstractmethod def methodcode_rules(self): """ Return a compiled list of rules for method-related code. :return: A MethodCodeDb instance """ raise NotImplemented(_("Missing subclass implementation")) @abstractmethod def modulecode_rules(self): """ Return a compiled list of rules for module-related code. :return: A ModuleCodeDb instance """ raise NotImplemented(_("Missing subclass implementation")) def dump_unused(self): """Usage statistics, to identify unused rules.""" def dumper(rule, usage): if usage: logger.info(_("Rule {} used {} times".format(rule, usage))) else: logger.warn(_("Rule {} was not used".format(rule))) for db in [self.container_rules(), self.forward_declaration_rules(), self.function_rules(), self.parameter_rules(), self.typedef_rules(), self.variable_rules(), self.methodcode_rules(), self.modulecode_rules()]: db.dump_usage(dumper) @abstractmethod def methodcode(self, container, function): """ Lookup %MethodCode. """ raise NotImplemented(_("Missing subclass implementation")) @abstractmethod def modulecode(self, filename): """ Lookup %ModuleCode and friends. """ raise NotImplemented(_("Missing subclass implementation")) def container_discard(container, sip, matcher): sip["name"] = "" def function_discard(container, function, sip, matcher): sip["name"] = "" def parameter_transfer_to_parent(container, function, parameter, sip, matcher): if function.is_static_method(): sip["annotations"].add("Transfer") else: sip["annotations"].add("TransferThis") def param_rewrite_mode_t_as_int(container, function, parameter, sip, matcher): sip["decl"] = sip["decl"].replace("mode_t", "unsigned int") def return_rewrite_mode_t_as_int(container, function, sip, matcher): sip["fn_result"] = "unsigned int" def variable_discard(container, variable, sip, matcher): sip["name"] = "" def parameter_strip_class_enum(container, function, parameter, sip, matcher): sip["decl"] = sip["decl"].replace("class ", "").replace("enum ", "") def function_discard_impl(container, function, sip, matcher): if function.extent.start.column == 1: sip["name"] = "" def typedef_discard(container, typedef, sip, matcher): sip["name"] = "" def discard_QSharedData_base(container, sip, matcher): sip["base_specifiers"].remove("QSharedData") def mark_forward_declaration_external(container, sip, matcher): sip["annotations"].add("External") def container_mark_abstract(container, sip, matcher): sip["annotations"].add("Abstract") def rules(project_rules): """ Constructor. :param project_rules: The rules file for the project. """ import imp imp.load_source("project_rules", project_rules) # # Statically prepare the rule logic. This takes the rules provided by the user and turns them into code. # return getattr(sys.modules["project_rules"], "RuleSet")() diff --git a/find-modules/sip_generator.py b/find-modules/sip_generator.py index b521e6c..2dd2ef1 100644 --- a/find-modules/sip_generator.py +++ b/find-modules/sip_generator.py @@ -1,819 +1,797 @@ #!/usr/bin/env python # -# Copyright 2016 by Shaheed Haque (srhaque@theiet.org) -# Copyright 2016 by Stephen Kelly (steveire@gmail.com) -# -# 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. +# SPDX-FileCopyrightText: 2016 Shaheed Haque +# SPDX-FileCopyrightText: 2016 Stephen Kelly # +# SPDX-License-Identifier: BSD-3-Clause """SIP file generator for PyQt.""" from __future__ import print_function import argparse import gettext import inspect import logging import os import re import sys import traceback from clang import cindex from clang.cindex import AccessSpecifier, AvailabilityKind, CursorKind, SourceRange, StorageClass, TokenKind, TypeKind, TranslationUnit import rules_engine class HelpFormatter(argparse.ArgumentDefaultsHelpFormatter, argparse.RawDescriptionHelpFormatter): pass logger = logging.getLogger(__name__) gettext.install(__name__) EXPR_KINDS = [ CursorKind.UNEXPOSED_EXPR, CursorKind.CONDITIONAL_OPERATOR, CursorKind.UNARY_OPERATOR, CursorKind.BINARY_OPERATOR, CursorKind.INTEGER_LITERAL, CursorKind.FLOATING_LITERAL, CursorKind.STRING_LITERAL, CursorKind.CXX_BOOL_LITERAL_EXPR, CursorKind.CXX_STATIC_CAST_EXPR, CursorKind.DECL_REF_EXPR ] TEMPLATE_KINDS = [ CursorKind.TYPE_REF, CursorKind.TEMPLATE_REF, CursorKind.NAMESPACE_REF ] + EXPR_KINDS def clang_diagnostic_to_logging_diagnostic(lvl): """ The diagnostic levels in cindex.py are Ignored = 0 Note = 1 Warning = 2 Error = 3 Fatal = 4 and the leves in the python logging module are NOTSET 0 DEBUG 10 INFO 20 WARNING 30 ERROR 40 CRITICAL 50 """ return (logging.NOTSET, logging.INFO, logging.WARNING, logging.ERROR, logging.CRITICAL)[lvl] def diagnostic_word(lvl): return ("", "info", "warning", "error", "fatality")[lvl] class SipGenerator(object): def __init__(self, project_rules, compile_flags, verbose=False, dump_includes=False, dump_privates=False): """ Constructor. :param project_rules: The rules for the file. :param compile_flags: The compile flags for the file. :param dump_includes: Turn on diagnostics for include files. :param dump_privates: Turn on diagnostics for omitted private items. """ self.rules = project_rules self.compile_flags = compile_flags self.verbose = verbose self.dump_includes = dump_includes self.dump_privates = dump_privates self.diagnostics = set() self.tu = None self.unpreprocessed_source = None @staticmethod def describe(cursor, text=None): if not text: text = cursor.spelling return "{} on line {} '{}'".format(cursor.kind.name, cursor.extent.start.line, text) def create_sip(self, h_file, include_filename): """ Actually convert the given source header file into its SIP equivalent. :param h_file: The source (header) file of interest. :param include_filename: The (header) to generate in the sip file. """ # # Read in the original file. # source = h_file self.unpreprocessed_source = [] with open(source, "rb") as f: for line in f: self.unpreprocessed_source.append(line) index = cindex.Index.create() self.tu = index.parse(source, ["-x", "c++"] + self.compile_flags) for diag in self.tu.diagnostics: # # We expect to be run over hundreds of files. Any parsing issues are likely to be very repetitive. # So, to avoid bothering the user, we suppress duplicates. # loc = diag.location msg = "{}:{}[{}] {}".format(loc.file, loc.line, loc.column, diag.spelling) if (diag.spelling == "#pragma once in main file"): continue if msg in self.diagnostics: continue self.diagnostics.add(msg) logger.log(clang_diagnostic_to_logging_diagnostic(diag.severity), "Parse {}: {}".format(diagnostic_word(diag.severity), msg)) if self.dump_includes: for include in sorted(set(self.tu.get_includes())): logger.debug(_("Used includes {}").format(include.include.name)) # # Run through the top level children in the translation unit. # body = self._container_get(self.tu.cursor, -1, h_file, include_filename) return body, self.tu.get_includes def skippable_attribute(self, parent, member, text, sip): """ We don't seem to have access to the __attribute__(())s, but at least we can look for stuff we care about. :param member: The attribute. :param text: The raw source corresponding to the region of member. """ if member.kind != CursorKind.VISIBILITY_ATTR: return False if member.spelling == "hidden": if self.dump_privates: logger.debug("Ignoring private {}".format(SipGenerator.describe(parent))) sip["name"] = "" return True return False def _container_get(self, container, level, h_file, include_filename): """ Generate the (recursive) translation for a class or namespace. :param container: A class or namespace. :param h_file: Name of header file being processed. :param level: Recursion level controls indentation. :return: A string. """ if container.kind.is_translation_unit(): # # Any module-related manual code (%ExportedHeaderCode, %ModuleCode, %ModuleHeaderCode or other # module-level directives? # sip = { "name": include_filename, "decl": "" } self.rules.modulecode(include_filename, sip) body = sip["code"] else: body = "" sip = { "name": container.displayname, "annotations": set() } name = container.displayname if container.access_specifier == AccessSpecifier.PRIVATE: if self.dump_privates: logger.debug("Ignoring private {}".format(SipGenerator.describe(container))) return "" base_specifiers = [] template_type_parameters = [] had_copy_constructor = False had_deleted_copy_constructor = False; had_const_member = False for member in container.get_children(): # # Only emit items in the translation unit. # if member.location.file.name != self.tu.spelling: continue decl = "" if member.kind in [CursorKind.CXX_METHOD, CursorKind.FUNCTION_DECL, CursorKind.FUNCTION_TEMPLATE, CursorKind.CONSTRUCTOR, CursorKind.DESTRUCTOR, CursorKind.CONVERSION_FUNCTION]: decl = self._fn_get(container, member, level + 1) elif member.kind == CursorKind.ENUM_DECL: decl = self._enum_get(container, member, level + 1) + ";\n" elif member.kind == CursorKind.CXX_ACCESS_SPEC_DECL: decl = self._get_access_specifier(member, level + 1) elif member.kind == CursorKind.TYPEDEF_DECL: decl = self._typedef_get(container, member, level + 1) elif member.kind == CursorKind.CXX_BASE_SPECIFIER: # # Strip off the leading "class". Except for TypeKind.UNEXPOSED... # base_specifiers.append(member.displayname.split(None, 2)[-1]) elif member.kind == CursorKind.TEMPLATE_TYPE_PARAMETER: template_type_parameters.append(member.displayname) elif member.kind == CursorKind.TEMPLATE_NON_TYPE_PARAMETER: template_type_parameters.append(member.type.spelling + " " + member.displayname) elif member.kind in [CursorKind.VAR_DECL, CursorKind.FIELD_DECL]: had_const_member = had_const_member or member.type.is_const_qualified() decl = self._var_get(container, member, level + 1) elif member.kind in [CursorKind.NAMESPACE, CursorKind.CLASS_DECL, CursorKind.CLASS_TEMPLATE, CursorKind.CLASS_TEMPLATE_PARTIAL_SPECIALIZATION, CursorKind.STRUCT_DECL, CursorKind.UNION_DECL]: decl = self._container_get(member, level + 1, h_file, include_filename) elif member.kind in TEMPLATE_KINDS + [CursorKind.USING_DECLARATION, CursorKind.USING_DIRECTIVE, CursorKind.CXX_FINAL_ATTR]: # # Ignore: # # TEMPLATE_KINDS: Template type parameter. # CursorKind.USING_DECLARATION, CursorKind.USING_DIRECTIVE: Using? Pah! # CursorKind.CXX_FINAL_ATTR: Again, not much to be done with this. # pass else: text = self._read_source(member.extent) if self.skippable_attribute(container, member, text, sip): if not sip["name"]: return "" else: SipGenerator._report_ignoring(container, member) def is_copy_constructor(member): if member.kind != CursorKind.CONSTRUCTOR: return False numParams = 0 hasSelfType = False for child in member.get_children(): numParams += 1 if child.kind == CursorKind.PARM_DECL: paramType = child.type.spelling paramType = paramType.split("::")[-1] paramType = paramType.replace("const", "").replace("&", "").strip() hasSelfType = paramType == container.displayname return numParams == 1 and hasSelfType def has_parameter_default(parameter): for member in parameter.get_children(): if member.kind.is_expression(): return True return False def is_default_constructor(member): if member.kind != CursorKind.CONSTRUCTOR: return False numParams = 0 for parameter in member.get_children(): if (has_parameter_default(parameter)): break numParams += 1 return numParams == 0 if is_copy_constructor(member): had_copy_constructor = True # We need to generate a fake private copy constructor for deleted constructors if member.availability == AvailabilityKind.NOT_AVAILABLE and member.access_specifier != AccessSpecifier.PRIVATE: had_deleted_copy_constructor = True continue # # Discard almost anything which is private. # if member.access_specifier == AccessSpecifier.PRIVATE: if member.kind == CursorKind.CXX_ACCESS_SPEC_DECL: # # We need these because... # pass elif is_copy_constructor(member) or is_default_constructor(member): # # ...we need to pass private copy contructors to the SIP compiler. # pass else: if self.dump_privates: logger.debug("Ignoring private {}".format(SipGenerator.describe(member))) continue if decl: if self.verbose: pad = " " * ((level + 1) * 4) body += pad + "// {}\n".format(SipGenerator.describe(member)) body += decl if container.kind == CursorKind.TRANSLATION_UNIT: return body if container.kind == CursorKind.NAMESPACE: container_type = "namespace " + name elif container.kind in [CursorKind.CLASS_DECL, CursorKind.CLASS_TEMPLATE, CursorKind.CLASS_TEMPLATE_PARTIAL_SPECIALIZATION]: container_type = "class " + name elif container.kind == CursorKind.STRUCT_DECL: container_type = "struct " + name elif container.kind == CursorKind.UNION_DECL: container_type = "union " + name else: raise AssertionError( _("Unexpected container {}: {}[{}]").format(container.kind, name, container.extent.start.line)) sip["decl"] = container_type sip["template_parameters"] = template_type_parameters pad = " " * (level * 4) # # Empty containers are still useful if they provide namespaces or forward declarations. # if not body: text = self._read_source(container.extent) if not text.endswith("}"): # # Forward declaration. # modifying_rule = self.rules.forward_declaration_rules().apply(container, sip) if sip["name"]: if modifying_rule: body += "// Modified {} (by {}):\n".format(SipGenerator.describe(container), modifying_rule) if "External" in sip["annotations"]: body += pad + sip["decl"] body += " /External/;\n" else: body = pad + "// Discarded {} (by {})\n".format(SipGenerator.describe(container), "default forward declaration handling") else: body = pad + "// Discarded {} (by {})\n".format(SipGenerator.describe(container), modifying_rule) else: # # Generate private copy constructor for non-copyable types. # if (had_deleted_copy_constructor) or (had_const_member and not had_copy_constructor): body += " private:\n {}(const {} &); // Generated\n".format(name, container.type.get_canonical().spelling) # # Flesh out the SIP context for the rules engine. # sip["base_specifiers"] = base_specifiers sip["body"] = body modifying_rule = self.rules.container_rules().apply(container, sip) if sip["name"]: decl = "" if modifying_rule: decl += "// Modified {} (by {}):\n".format(SipGenerator.describe(container), modifying_rule) decl += pad + sip["decl"] if sip["base_specifiers"]: decl += ": " + ", ".join(sip["base_specifiers"]) if sip["annotations"]: decl += " /" + ",".join(sip["annotations"]) + "/" if sip["template_parameters"]: decl = pad + "template <" + ", ".join(sip["template_parameters"]) + ">\n" + decl decl += "\n" + pad + "{\n" decl += "%TypeHeaderCode\n#include <{}>\n%End\n".format(include_filename) body = decl + sip["body"] + pad + "};\n" else: body = pad + "// Discarded {} (by {})\n".format(SipGenerator.describe(container), modifying_rule) return body def _get_access_specifier(self, member, level): """ Skip access specifiers embedded in the Q_OBJECT macro. """ access_specifier_text = self._read_source(member.extent) if access_specifier_text == "Q_OBJECT": return "" pad = " " * ((level - 1) * 4) access_specifier = "" if (access_specifier_text in ("Q_SIGNALS:", "signals:", "public Q_SLOTS:", "public slots:", "protected Q_SLOTS:", "protected slots:")): access_specifier = access_specifier_text elif member.access_specifier == AccessSpecifier.PRIVATE: access_specifier = "private:" elif member.access_specifier == AccessSpecifier.PROTECTED: access_specifier = "protected:" elif member.access_specifier == AccessSpecifier.PUBLIC: access_specifier = "public:" decl = pad + access_specifier + "\n" return decl def _enum_get(self, container, enum, level): pad = " " * (level * 4) scoped = "" if enum.is_scoped_enum(): scoped = "class " decl = pad + "enum {}{} {{\n".format(scoped, enum.displayname) enumerations = [] for enum in enum.get_children(): # # Skip visibility attributes and the like. # if enum.kind == CursorKind.ENUM_CONSTANT_DECL: enumerations.append(pad + " {}".format(enum.displayname)) decl += ",\n".join(enumerations) + "\n" decl += pad + "}" return decl def _fn_get(self, container, function, level): """ Generate the translation for a function. :param container: A class or namespace. :param function: The function object. :param level: Recursion level controls indentation. :return: A string. """ if container.kind == CursorKind.TRANSLATION_UNIT and \ (function.semantic_parent.kind == CursorKind.CLASS_DECL or function.semantic_parent.kind == CursorKind.STRUCT_DECL) and \ function.is_definition(): # Skip inline methods return sip = { "name": function.spelling, } parameters = [] parameter_modifying_rules = [] template_parameters = [] for child in function.get_children(): if child.kind == CursorKind.PARM_DECL: parameter = child.displayname or "__{}".format(len(parameters)) theType = child.type.get_canonical() typeSpelling = theType.spelling if theType.kind == TypeKind.POINTER: typeSpelling = theType.get_pointee().spelling + "* " decl = "{} {}".format(typeSpelling, parameter) child_sip = { "name": parameter, "decl": decl, "init": self._fn_get_parameter_default(function, child), "annotations": set() } modifying_rule = self.rules.parameter_rules().apply(container, function, child, child_sip) if modifying_rule: parameter_modifying_rules.append("// Modified {} (by {}):\n".format(SipGenerator.describe(child), modifying_rule)) decl = child_sip["decl"] if child_sip["annotations"]: decl += " /" + ",".join(child_sip["annotations"]) + "/" if child_sip["init"]: decl += " = " + child_sip["init"] parameters.append(decl) elif child.kind in [CursorKind.COMPOUND_STMT, CursorKind.CXX_OVERRIDE_ATTR, CursorKind.MEMBER_REF, CursorKind.DECL_REF_EXPR, CursorKind.CALL_EXPR] + TEMPLATE_KINDS: # # Ignore: # # CursorKind.COMPOUND_STMT: Function body. # CursorKind.CXX_OVERRIDE_ATTR: The "override" keyword. # CursorKind.MEMBER_REF, CursorKind.DECL_REF_EXPR, CursorKind.CALL_EXPR: Constructor initialisers. # TEMPLATE_KINDS: The result type. # pass elif child.kind == CursorKind.TEMPLATE_TYPE_PARAMETER: template_parameters.append(child.displayname) elif child.kind == CursorKind.TEMPLATE_NON_TYPE_PARAMETER: template_parameters.append(child.type.spelling + " " + child.displayname) else: text = self._read_source(child.extent) if self.skippable_attribute(function, child, text, sip): if not sip["name"]: return "" else: SipGenerator._report_ignoring(function, child) # # Flesh out the SIP context for the rules engine. # sip["template_parameters"] = template_parameters if function.kind in [CursorKind.CONSTRUCTOR, CursorKind.DESTRUCTOR]: sip["fn_result"] = "" else: sip["fn_result"] = function.result_type.spelling sip["parameters"] = parameters sip["prefix"], sip["suffix"] = self._fn_get_decorators(function) modifying_rule = self.rules.function_rules().apply(container, function, sip) pad = " " * (level * 4) if sip["name"]: # # Any method-related code (%MethodCode, %VirtualCatcherCode, VirtualCallCode # or other method-related directives)? # self.rules.methodcode(function, sip) decl = "" if modifying_rule: decl += "// Modified {} (by {}):\n".format(SipGenerator.describe(function), modifying_rule) + pad decl += pad.join(parameter_modifying_rules) if parameter_modifying_rules: decl += pad decl += sip["name"] + "(" + ", ".join(sip["parameters"]) + ")" if sip["fn_result"]: decl = sip["fn_result"] + " " + decl decl = pad + sip["prefix"] + decl + sip["suffix"] if sip["template_parameters"]: decl = pad + "template <" + ", ".join(sip["template_parameters"]) + ">\n" + decl decl += ";\n" decl += sip["code"] else: decl = pad + "// Discarded {} (by {})\n".format(SipGenerator.describe(function), modifying_rule) return decl def _fn_get_decorators(self, function): """ The parser does not provide direct access to the complete keywords (explicit, const, static, etc) of a function in the displayname. It would be nice to get these from the AST, but I cannot find where they are hiding. Now, we could resort to using the original source. That does not bode well if you have macros (QOBJECT, xxxDEPRECATED?), inlined bodies and the like, using the rule engine could be used to patch corner cases... ...or we can try to guess what SIP cares about, i.e static and maybe const. Luckily (?), we have those to hand! :param function: The function object. :return: prefix, suffix String containing any prefix or suffix keywords. """ suffix = "" if function.is_const_method(): suffix += " const" prefix = "" if function.is_static_method(): prefix += "static " if function.is_virtual_method(): prefix += "virtual " if function.is_pure_virtual_method(): suffix += " = 0" return prefix, suffix def _fn_get_parameter_default(self, function, parameter): """ The parser does not seem to provide access to the complete text of a parameter. This makes it hard to find any default values, so we: 1. Run the lexer from "here" to the end of the file, bailing out when we see the "," or a ")" marking the end. 2. Watch for the assignment. """ def _get_param_type(parameter): result = parameter.type.get_declaration().type if result.kind != TypeKind.ENUM and result.kind != TypeKind.TYPEDEF and parameter.type.kind == TypeKind.LVALUEREFERENCE: if parameter.type.get_pointee().get_declaration().type.kind != TypeKind.INVALID: return parameter.type.get_pointee().get_declaration().type return parameter.type.get_pointee() if parameter.type.get_declaration().type.kind == TypeKind.INVALID: return parameter.type if (parameter.type.get_declaration().type.kind == TypeKind.TYPEDEF): isQFlags = False for member in parameter.type.get_declaration().get_children(): if member.kind == CursorKind.TEMPLATE_REF and member.spelling == "QFlags": isQFlags = True if isQFlags and member.kind == CursorKind.TYPE_REF: result = member.type break return result def _get_param_value(text, parameterType): if text == "0" or text == "nullptr": return text if text == "{}": if parameterType.kind == TypeKind.ENUM: return "0" if parameterType.kind == TypeKind.POINTER: return "nullptr" if parameterType.spelling.startswith("const "): return parameterType.spelling[6:] + "()" return parameterType.spelling + "()" if not "::" in parameterType.spelling: return text try: typeText, typeInit = text.split("(") typeInit = "(" + typeInit except: typeText = text typeInit = "" if parameterType.kind == TypeKind.ENUM and parameterType.get_declaration().is_scoped_enum(): prefix = parameterType.spelling else: prefix = parameterType.spelling.rsplit("::", 1)[0] if "::" in typeText: typeText = typeText.rsplit("::", 1)[1] return prefix + "::" + typeText + typeInit for member in parameter.get_children(): if member.kind.is_expression(): possible_extent = SourceRange.from_locations(parameter.extent.start, function.extent.end) text = "" bracket_level = 0 found_start = False found_end = False for token in self.tu.get_tokens(extent=possible_extent): if (token.spelling == "="): found_start = True continue if token.spelling == "," and bracket_level == 0: found_end = True break elif token.spelling == "(": bracket_level += 1 text += token.spelling elif token.spelling == ")": if bracket_level == 0: found_end = True break bracket_level -= 1 text += token.spelling if bracket_level == 0: found_end = True break elif found_start: text += token.spelling if not found_end and text: RuntimeError(_("No end found for {}::{}, '{}'").format(function.spelling, parameter.spelling, text)) parameterType = _get_param_type(parameter) return _get_param_value(text, parameterType) return "" def _typedef_get(self, container, typedef, level): """ Generate the translation for a typedef. :param container: A class or namespace. :param typedef: The typedef object. :param level: Recursion level controls indentation. :return: A string. """ sip = { "name": typedef.displayname, "decl": typedef.underlying_typedef_type.spelling, "annotations": set(), } self.rules.typedef_rules().apply(container, typedef, sip) pad = " " * (level * 4) if sip["name"]: decl = pad + "typedef {} {}".format(sip["decl"], sip["name"]) decl += ";\n" else: decl = pad + "// Discarded {}\n".format(SipGenerator.describe(typedef)) return decl def _var_get(self, container, variable, level): """ Generate the translation for a variable. :param container: A class or namespace. :param variable: The variable object. :param level: Recursion level controls indentation. :return: A string. """ sip = { "name": variable.spelling } for child in variable.get_children(): if child.kind in TEMPLATE_KINDS + [CursorKind.STRUCT_DECL, CursorKind.UNION_DECL]: # # Ignore: # # TEMPLATE_KINDS, CursorKind.STRUCT_DECL, CursorKind.UNION_DECL: : The variable type. # pass else: text = self._read_source(child.extent) if self.skippable_attribute(variable, child, text, sip): if not sip["name"]: return "" else: SipGenerator._report_ignoring(variable, child) # # Flesh out the SIP context for the rules engine. # decl = "{} {}".format(variable.type.spelling, variable.spelling) sip["decl"] = decl modifying_rule = self.rules.variable_rules().apply(container, variable, sip) pad = " " * (level * 4) if sip["name"]: decl = sip["decl"] # # SIP does not support protected variables, so we ignore them. # if variable.access_specifier == AccessSpecifier.PROTECTED: decl = pad + "// Discarded {}\n".format(SipGenerator.describe(variable)) else: decl = pad + decl + ";\n" else: decl = pad + "// Discarded {} (by {})\n".format(SipGenerator.describe(variable), modifying_rule) return decl def _read_source(self, extent): """ Read the given range from the unpre-processed source. :param extent: The range of text required. """ # Extent columns are specified in bytes extract = self.unpreprocessed_source[extent.start.line - 1:extent.end.line] if extent.start.line == extent.end.line: extract[0] = extract[0][extent.start.column - 1:extent.end.column - 1] else: extract[0] = extract[0][extent.start.column - 1:] extract[-1] = extract[-1][:extent.end.column - 1] # # Return a single line of text. # Replace all kinds of newline variants (DOS, UNIX, MAC style) by single spaces # return b''.join(extract).decode('utf-8').replace("\r\n", " ").replace("\n", " ").replace("\r", " ") @staticmethod def _report_ignoring(parent, child, text=None): if not text: text = child.displayname or child.spelling logger.debug(_("Ignoring {} {} child {}").format(parent.kind.name, parent.spelling, SipGenerator.describe(child, text))) def main(argv=None): """ Take a single C++ header file and generate the corresponding SIP file. Beyond simple generation of the SIP file from the corresponding C++ header file, a set of rules can be used to customize the generated SIP file. Examples: sip_generator.py /usr/include/KF5/KItemModels/kselectionproxymodel.h """ if argv is None: argv = sys.argv parser = argparse.ArgumentParser(epilog=inspect.getdoc(main), formatter_class=HelpFormatter) parser.add_argument("-v", "--verbose", action="store_true", default=False, help=_("Enable verbose output")) parser.add_argument("--flags", help=_("Semicolon-separated C++ compile flags to use")) parser.add_argument("--include_filename", help=_("C++ header include to compile")) parser.add_argument("libclang", help=_("libclang library to use for parsing")) parser.add_argument("project_rules", help=_("Project rules")) parser.add_argument("source", help=_("C++ header to process")) parser.add_argument("output", help=_("output filename to write")) try: args = parser.parse_args(argv[1:]) if args.verbose: logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(name)s %(levelname)s: %(message)s') else: logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') # # Generate! # cindex.Config.set_library_file(args.libclang) rules = rules_engine.rules(args.project_rules) g = SipGenerator(rules, args.flags.lstrip().split(";"), args.verbose) body, includes = g.create_sip(args.source, args.include_filename) with open(args.output, "w") as outputFile: outputFile.write(body) except Exception as e: tbk = traceback.format_exc() print(tbk) return -1 if __name__ == "__main__": if sys.argv[1] != "--self-check": sys.exit(main()) else: cindex.Config.set_library_file(sys.argv[2]) diff --git a/kde-modules/KDECMakeSettings.cmake b/kde-modules/KDECMakeSettings.cmake index 0be3d35..0690a2e 100644 --- a/kde-modules/KDECMakeSettings.cmake +++ b/kde-modules/KDECMakeSettings.cmake @@ -1,388 +1,367 @@ #.rst: # KDECMakeSettings # ---------------- # # Changes various CMake settings to what the KDE community views as more # sensible defaults. # # It is recommended to include this module with the NO_POLICY_SCOPE flag, # otherwise you may get spurious warnings with some versions of CMake. # # It is split into three parts, which can be independently disabled if desired. # # Runtime Paths # ~~~~~~~~~~~~~ # # The default runtime path (used on Unix systems to search for # dynamically-linked libraries) is set to include the location that libraries # will be installed to (as set in LIB_INSTALL_DIR or, if the former is not set, # KDE_INSTALL_LIBDIR), and also the linker search path. # # Note that ``LIB_INSTALL_DIR`` or alternatively ``KDE_INSTALL_LIBDIR`` needs # to be set before including this module. # Typically, this is done by including the :kde-module:`KDEInstallDirs` module. # # This section can be disabled by setting ``KDE_SKIP_RPATH_SETTINGS`` to TRUE # before including this module. # # # Testing # ~~~~~~~ # # Testing is enabled by default, and an option (BUILD_TESTING) is provided for # users to control this. See the CTest module documentation in the CMake manual # for more details. # # This section can be disabled by setting ``KDE_SKIP_TEST_SETTINGS`` to TRUE # before including this module. # # # Build Settings # ~~~~~~~~~~~~~~ # # Various CMake build defaults are altered, such as searching source and build # directories for includes first, enabling automoc by default. # # When find_package(ECM 5.38) or higher is called, this also selects # a layout for the build dir that helps running executables without installing: # all executables are built into a toplevel "bin" dir, making it possible to find # helper binaries, and to find uninstalled plugins (provided that you use # kcoreaddons_add_plugin or set LIBRARY_OUTPUT_DIRECTORY as documented on # https://community.kde.org/Guidelines_and_HOWTOs/Making_apps_run_uninstalled). # # This section can be disabled by setting ``KDE_SKIP_BUILD_SETTINGS`` to TRUE # before including this module. # # This section also provides an "uninstall" target that can be individually # disabled by setting ``KDE_SKIP_UNINSTALL_TARGET`` to TRUE before including # this module. # # By default on OS X, X11 and XCB related detections are disabled. However if # the need would arise to use these technologies, the detection can be enabled # by setting ``APPLE_FORCE_X11`` to ``ON``. # # A warning is printed for the developer to know that the detection is disabled on OS X. # This message can be turned off by setting ``APPLE_SUPPRESS_X11_WARNING`` to ``ON``. # # Since pre-1.0.0. # # ``ENABLE_CLAZY`` option is added (OFF by default) when clang is being used. # Turning this option on will force clang to load the clazy plugins for richer # warnings on Qt-related code. # # If clang is not being used, this won't have an effect. # See https://commits.kde.org/clazy?path=README.md # # Since 5.17.0 # # - Uninstall target functionality since 1.7.0. # - ``APPLE_FORCE_X11`` option since 5.14.0 (detecting X11 was previously the default behavior) # - ``APPLE_SUPPRESS_X11_WARNING`` option since 5.14.0 # - CMAKE_AUTORCC enabled by default when supported by cmake (>= 3.0) since 5.62.0 # # Translations # ~~~~~~~~~~~~ # A fetch-translations target will be set up that will download translations # for projects using l10n.kde.org. # # ``KDE_L10N_BRANCH`` will be responsible for choosing which l10n branch to use # for the translations. # # ``KDE_L10N_AUTO_TRANSLATIONS`` (OFF by default) will indicate whether translations # should be downloaded when building the project. # # Since 5.34.0 # # ``KDE_L10N_SYNC_TRANSLATIONS`` (OFF by default) will download the translations at configuration # time instead of build time. # # Since 5.50.0 # # #============================================================================= -# Copyright 2014 Alex Merry -# Copyright 2013 Aleix Pol -# Copyright 2012-2013 Stephen Kelly -# Copyright 2007 Matthias Kretz -# Copyright 2006-2007 Laurent Montel -# Copyright 2006-2013 Alex Neundorf -# -# 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. +# SPDX-FileCopyrightText: 2014 Alex Merry +# SPDX-FileCopyrightText: 2013 Aleix Pol +# SPDX-FileCopyrightText: 2012-2013 Stephen Kelly +# SPDX-FileCopyrightText: 2007 Matthias Kretz +# SPDX-FileCopyrightText: 2006-2007 Laurent Montel +# SPDX-FileCopyrightText: 2006-2013 Alex Neundorf +# +# SPDX-License-Identifier: BSD-3-Clause ################# RPATH handling ################################## if(NOT KDE_SKIP_RPATH_SETTINGS) # Set the default RPATH to point to useful locations, namely where the # libraries will be installed and the linker search path # First look for the old LIB_INSTALL_DIR, then fallback to newer KDE_INSTALL_LIBDIR if(NOT LIB_INSTALL_DIR) if(NOT KDE_INSTALL_LIBDIR) message(FATAL_ERROR "Neither KDE_INSTALL_LIBDIR nor LIB_INSTALL_DIR is set. Setting one is necessary for using the RPATH settings.") else() set(_abs_LIB_INSTALL_DIR "${KDE_INSTALL_LIBDIR}") endif() else() set(_abs_LIB_INSTALL_DIR "${LIB_INSTALL_DIR}") endif() if (NOT IS_ABSOLUTE "${_abs_LIB_INSTALL_DIR}") set(_abs_LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}") endif() if (UNIX) # for mac os: add install name dir in addition # check: is the rpath stuff below really required on mac os? at least it seems so to use a stock qt from qt.io if (APPLE) set(CMAKE_INSTALL_NAME_DIR ${_abs_LIB_INSTALL_DIR}) endif () # add our LIB_INSTALL_DIR to the RPATH (but only when it is not one of # the standard system link directories - such as /usr/lib on UNIX) list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${_abs_LIB_INSTALL_DIR}" _isSystemLibDir) list(FIND CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "${_abs_LIB_INSTALL_DIR}" _isSystemCxxLibDir) list(FIND CMAKE_C_IMPLICIT_LINK_DIRECTORIES "${_abs_LIB_INSTALL_DIR}" _isSystemCLibDir) if("${_isSystemLibDir}" STREQUAL "-1" AND "${_isSystemCxxLibDir}" STREQUAL "-1" AND "${_isSystemCLibDir}" STREQUAL "-1") set(CMAKE_INSTALL_RPATH "${_abs_LIB_INSTALL_DIR}") endif() # Append directories in the linker search path (but outside the project) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) endif (UNIX) endif() ################ Testing setup #################################### find_program(APPSTREAMCLI appstreamcli) function(appstreamtest) if(APPSTREAMCLI AND NOT appstreamtest_added) set(appstreamtest_added TRUE PARENT_SCOPE) add_test(NAME appstreamtest COMMAND ${CMAKE_COMMAND} -DAPPSTREAMCLI=${APPSTREAMCLI} -DINSTALL_FILES=${CMAKE_BINARY_DIR}/install_manifest.txt -P ${CMAKE_CURRENT_LIST_DIR}/appstreamtest.cmake) else() message(STATUS "Could not set up the appstream test. appstreamcli is missing.") endif() endfunction() if(NOT KDE_SKIP_TEST_SETTINGS) # If there is a CTestConfig.cmake, include CTest. # Otherwise, there will not be any useful settings, so just # fake the functionality we care about from CTest. if (EXISTS ${CMAKE_SOURCE_DIR}/CTestConfig.cmake) include(CTest) else() option(BUILD_TESTING "Build the testing tree." ON) if(BUILD_TESTING) enable_testing() appstreamtest() endif () endif () endif() ################ Build-related settings ########################### if(NOT KDE_SKIP_BUILD_SETTINGS) # Always include srcdir and builddir in include path # This saves typing ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} in about every subdir # since cmake 2.4.0 set(CMAKE_INCLUDE_CURRENT_DIR ON) # put the include dirs which are in the source or build tree # before all other include dirs, so the headers in the sources # are preferred over the already installed ones # since cmake 2.4.1 set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON) # Add the src and build dir to the BUILD_INTERFACE include directories # of all targets. Similar to CMAKE_INCLUDE_CURRENT_DIR, but transitive. # Since CMake 2.8.11 set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) # When a shared library changes, but its includes do not, don't relink # all dependencies. It is not needed. # Since CMake 2.8.11 set(CMAKE_LINK_DEPENDS_NO_SHARED ON) # Default to shared libs for KDE, if no type is explicitly given to add_library(): set(BUILD_SHARED_LIBS TRUE CACHE BOOL "If enabled, shared libs will be built by default, otherwise static libs") # Enable automoc in cmake # Since CMake 2.8.6 set(CMAKE_AUTOMOC ON) # Enable autorcc and in cmake so qrc files get generated. # Since CMake 3.0 # TODO KF6: discuss enabling AUTOUIC and note porting requirements. autouic # acts on all #include "ui_*.h" assuming *.ui exists if(NOT CMAKE_VERSION VERSION_LESS 3.0) set(CMAKE_AUTORCC ON) endif() # By default, create 'GUI' executables. This can be reverted on a per-target basis # using ECMMarkNonGuiExecutable # Since CMake 2.8.8 set(CMAKE_WIN32_EXECUTABLE ON) set(CMAKE_MACOSX_BUNDLE ON) # By default, don't put a prefix on MODULE targets. add_library(MODULE) is basically for plugin targets, # and in KDE plugins don't have a prefix. set(CMAKE_SHARED_MODULE_PREFIX "") unset(EXECUTABLE_OUTPUT_PATH) unset(LIBRARY_OUTPUT_PATH) unset(CMAKE_ARCHIVE_OUTPUT_DIRECTORY) unset(CMAKE_LIBRARY_OUTPUT_DIRECTORY) unset(CMAKE_RUNTIME_OUTPUT_DIRECTORY) # under Windows, output all executables and dlls into # one common directory, and all static|import libraries and plugins # into another one. This way test executables can find their dlls # even without installation. # We do the same under Unix to make it possible to run tests and apps without installing if (WIN32 OR NOT ("${ECM_GLOBAL_FIND_VERSION}" VERSION_LESS "5.38.0")) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") endif() if (APPLE) # Disable detection of X11 and related package on OS X because when using # brew or macports, X11 can be installed and thus is detected. option(APPLE_FORCE_X11 "Force enable X11 related detection on OS X" OFF) option(APPLE_SUPPRESS_X11_WARNING "Suppress X11 and related technologies search disabling warning on OS X" OFF) if(NOT APPLE_FORCE_X11) if (NOT APPLE_SUPPRESS_X11_WARNING) message(WARNING "Searching for X11 and related technologies is disabled on Apple systems. Set APPLE_FORCE_X11 to ON to change this behaviour. Set APPLE_SUPPRESS_X11_WARNING to ON to hide this warning.") endif() set(CMAKE_DISABLE_FIND_PACKAGE_X11 true) set(CMAKE_DISABLE_FIND_PACKAGE_XCB true) set(CMAKE_DISABLE_FIND_PACKAGE_Qt5X11Extras true) endif() endif() option(KDE_SKIP_UNINSTALL_TARGET "Prevent an \"uninstall\" target from being generated." OFF) if(NOT KDE_SKIP_UNINSTALL_TARGET) include("${ECM_MODULE_DIR}/ECMUninstallTarget.cmake") endif() endif() if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") option(ENABLE_CLAZY "Enable Clazy warnings" OFF) if(ENABLE_CLAZY) find_library(CLAZY_v1_5_FOUND ClazyPlugin${CMAKE_SHARED_LIBRARY_SUFFIX}) if(CLAZY_v1_5_FOUND) # clazy >= 1.5 set(CMAKE_CXX_COMPILE_OBJECT "${CMAKE_CXX_COMPILE_OBJECT} -Xclang -load -Xclang ClazyPlugin${CMAKE_SHARED_LIBRARY_SUFFIX} -Xclang -add-plugin -Xclang clazy") else() # clazy < 1.5 set(CMAKE_CXX_COMPILE_OBJECT "${CMAKE_CXX_COMPILE_OBJECT} -Xclang -load -Xclang ClangLazy${CMAKE_SHARED_LIBRARY_SUFFIX} -Xclang -add-plugin -Xclang clang-lazy") endif() endif() endif() ################################################################### # Download translations function(_repository_name reponame dir) execute_process(COMMAND git config --get remote.origin.url OUTPUT_VARIABLE giturl RESULT_VARIABLE exitCode WORKING_DIRECTORY "${dir}") if(exitCode EQUAL 0) string(REGEX MATCHALL ".+[:\\/]([-A-Za-z0-9]+)(.git)?\\s*" "" ${giturl}) set(${reponame} ${CMAKE_MATCH_1}) endif() if(NOT ${reponame}) set(${reponame} ${CMAKE_PROJECT_NAME}) endif() set(${reponame} ${${reponame}} PARENT_SCOPE) endfunction() if(NOT EXISTS ${CMAKE_SOURCE_DIR}/po AND NOT TARGET fetch-translations) option(KDE_L10N_AUTO_TRANSLATIONS "Automatically 'make fetch-translations`" OFF) option(KDE_L10N_SYNC_TRANSLATIONS "Fetch translations when KDECMakeSettings.cmake is processed." OFF) set(KDE_L10N_BRANCH "trunk" CACHE STRING "Branch from l10n.kde.org to fetch from: trunk | stable | lts | trunk_kde4 | stable_kde4") if(KDE_L10N_AUTO_TRANSLATIONS AND NOT KDE_L10N_SYNC_TRANSLATIONS) set(_EXTRA_ARGS "ALL") else() set(_EXTRA_ARGS) endif() set(_reponame "") _repository_name(_reponame "${CMAKE_SOURCE_DIR}") set(releaseme_clone_commands COMMAND git clone --depth 1 https://anongit.kde.org/releaseme.git ) add_custom_command( OUTPUT "${CMAKE_BINARY_DIR}/releaseme" ${releaseme_clone_commands} WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" COMMENT "Fetching releaseme scripts to download translations..." ) set(_l10n_po_dir "${CMAKE_BINARY_DIR}/po") set(_l10n_poqm_dir "${CMAKE_BINARY_DIR}/poqm") if(CMAKE_VERSION VERSION_GREATER 3.2) set(extra BYPRODUCTS ${_l10n_po_dir} ${_l10n_poqm_dir}) endif() set(fetch_commands COMMAND ruby "${CMAKE_BINARY_DIR}/releaseme/fetchpo.rb" --origin ${KDE_L10N_BRANCH} --project "${_reponame}" --output-dir "${_l10n_po_dir}" --output-poqm-dir "${_l10n_poqm_dir}" "${CMAKE_CURRENT_SOURCE_DIR}" ) add_custom_target(fetch-translations ${_EXTRA_ARGS} COMMENT "Downloading translations for ${_reponame} branch ${KDE_L10N_BRANCH}..." COMMAND git -C "${CMAKE_BINARY_DIR}/releaseme" pull COMMAND cmake -E remove_directory ${_l10n_po_dir} COMMAND cmake -E remove_directory ${_l10n_poqm_dir} ${fetch_commands} ${extra} DEPENDS "${CMAKE_BINARY_DIR}/releaseme" ) if (KDE_L10N_SYNC_TRANSLATIONS AND (NOT EXISTS ${_l10n_po_dir} OR NOT EXISTS ${_l10n_poqm_dir})) execute_process(${releaseme_clone_commands}) execute_process(${fetch_commands}) endif() endif() diff --git a/kde-modules/KDEClangFormat.cmake b/kde-modules/KDEClangFormat.cmake index 472727a..057433c 100644 --- a/kde-modules/KDEClangFormat.cmake +++ b/kde-modules/KDEClangFormat.cmake @@ -1,84 +1,63 @@ #.rst: # KDEClangFormat # -------------------- # # This module provides a functionality to format the source # code of your repository according to a predefined KDE # clang-format file. # # This module provides the following function: # # :: # # kde_clang_format() # # Using this function will create a clang-format target that will format all # ```` passed to the function with the predefined KDE clang-format style. # # Example usage: # # .. code-block:: cmake # # include(KDEClangFormat) # file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES src/*.cpp src/*.h) # kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES}) # # Since 5.64 #============================================================================= -# Copyright 2019 Christoph Cullmann +# SPDX-FileCopyrightText: 2019 Christoph Cullmann # -# 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. +# SPDX-License-Identifier: BSD-3-Clause # try to find clang-format in path find_program(KDE_CLANG_FORMAT_EXECUTABLE clang-format) # instantiate our clang-format file, must be in source directory for tooling if we have the tool if(KDE_CLANG_FORMAT_EXECUTABLE) configure_file(${CMAKE_CURRENT_LIST_DIR}/clang-format.cmake ${CMAKE_CURRENT_SOURCE_DIR}/.clang-format @ONLY) endif() # formatting target function(KDE_CLANG_FORMAT) # add target only if clang-format available if(KDE_CLANG_FORMAT_EXECUTABLE) add_custom_target(clang-format COMMAND ${KDE_CLANG_FORMAT_EXECUTABLE} -style=file -i ${ARGV} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Formatting sources in ${CMAKE_CURRENT_SOURCE_DIR} with ${KDE_CLANG_FORMAT_EXECUTABLE}..." ) else() add_custom_target(clang-format COMMAND ${CMAKE_COMMAND} -E echo "Could not set up the clang-format target as the clang-format executable is missing." ) endif() endfunction() diff --git a/kde-modules/KDECompilerSettings.cmake b/kde-modules/KDECompilerSettings.cmake index 11e7f56..63a5ce1 100644 --- a/kde-modules/KDECompilerSettings.cmake +++ b/kde-modules/KDECompilerSettings.cmake @@ -1,516 +1,495 @@ #.rst: # KDECompilerSettings # ------------------- # # Set useful compile and link flags for C++ (and C) code. # # Enables many more warnings than the default, and sets stricter modes # for some compiler features. By default, exceptions are disabled; # kde_target_enable_exceptions() can be used to re-enable them for a # specific target. # # NB: it is recommended to include this module with the NO_POLICY_SCOPE # flag, otherwise you may get spurious warnings with some versions of CMake. # # This module provides the following functions:: # # kde_source_files_enable_exceptions([file1 [file2 [...]]]) # # Enables exceptions for specific source files. This should not be # used on source files in a language other than C++. # # :: # # kde_target_enable_exceptions(target ) # # Enables exceptions for a specific target. This should not be used # on a target that has source files in a language other than C++. # # :: # # kde_enable_exceptions() # # Enables exceptions for C++ source files compiled for the # CMakeLists.txt file in the current directory and all subdirectories. # # Since pre-1.0.0. #============================================================================= -# Copyright 2014 Alex Merry -# Copyright 2013 Stephen Kelly -# Copyright 2012-2013 Raphael Kubo da Costa -# Copyright 2007 Matthias Kretz -# Copyright 2006-2007 Laurent Montel -# Copyright 2006-2013 Alex Neundorf +# SPDX-FileCopyrightText: 2014 Alex Merry +# SPDX-FileCopyrightText: 2013 Stephen Kelly +# SPDX-FileCopyrightText: 2012-2013 Raphael Kubo da Costa +# SPDX-FileCopyrightText: 2007 Matthias Kretz +# SPDX-FileCopyrightText: 2006-2007 Laurent Montel +# SPDX-FileCopyrightText: 2006-2013 Alex Neundorf # -# 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. +# SPDX-License-Identifier: BSD-3-Clause include("${ECM_MODULE_DIR}/ECMSourceVersionControl.cmake") ############################################################ # Default build type # If no build type was specified, default to using a debug build if the # source directory is a git clone. # Otherwise, leave it empty, to let distro packagers choose the flags. ############################################################ if (ECM_SOURCE_UNDER_VERSION_CONTROL AND NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(default_build_type "Debug") message(STATUS "Setting build type to '${default_build_type}' as none was specified.") set_property(CACHE CMAKE_BUILD_TYPE PROPERTY VALUE "${default_build_type}") # Set the possible values of build type for cmake-gui set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") endif() ############################################################ # Toolchain minimal requirements # # Note that only compilers officially supported by Qt are # supported by this file; workarounds for older compilers # will generally not be included. See # https://qt-project.org/doc/qt-5/supported-platforms.html # and # https://community.kde.org/Frameworks/Policies#Frameworks_compiler_requirements_and_C.2B.2B11 # for more details. ############################################################ macro(_kde_compiler_min_version min_version) if ("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "${min_version}") message(WARNING "Version ${CMAKE_CXX_COMPILER_VERSION} of the ${CMAKE_CXX_COMPILER_ID} C++ compiler is not supported. Please use version ${min_version} or later.") endif() endmacro() if (MSVC) # MSVC_VERSION 1600 = VS 10.0 = Windows SDK 7 # See: cmake --help-variable MSVC_VERSION # and https://developer.mozilla.org/en-US/docs/Windows_SDK_versions if (${MSVC_VERSION} LESS 1600) message(WARNING "Your MSVC version (${MSVC_VERSION}) is not supported. Please use the Windows SDK version 7 or later (or Microsoft Visual Studio 2010 or later).") endif() elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if (WIN32) _kde_compiler_min_version("4.7") elseif (APPLE) # FIXME: Apple heavily modifies GCC, so checking the # GCC version on OS/X is not very useful. else() _kde_compiler_min_version("4.5") endif() elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") _kde_compiler_min_version("3.1") else() message(WARNING "${CMAKE_CXX_COMPILER_ID} is not a supported C++ compiler.") endif() ############################################################ # System API features ############################################################ # This macro is for adding definitions that affect the underlying # platform API. It makes sure that configure checks will also have # the same defines, so that the checks match compiled code. macro (_KDE_ADD_PLATFORM_DEFINITIONS) add_definitions(${ARGV}) set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${ARGV}) endmacro() include(CheckSymbolExists) check_symbol_exists("__GLIBC__" "stdlib.h" LIBC_IS_GLIBC) if (LIBC_IS_GLIBC) # Enable everything in GNU libc. Any code using non-portable features # needs to perform feature tests, but this ensures that any such features # will be found if they exist. # # NB: we do NOT define _BSD_SOURCE, as with GNU libc that requires linking # against the -lbsd-compat library (it changes the behaviour of some # functions). This, however, means that strlcat and strlcpy are not # provided by glibc. _kde_add_platform_definitions(-D_GNU_SOURCE) endif () if (UNIX) # Enable extra API for using 64-bit file offsets on 32-bit systems. # FIXME: this is included in _GNU_SOURCE in glibc; do other libc # implementation recognize it? _kde_add_platform_definitions(-D_LARGEFILE64_SOURCE) include(CheckCXXSourceCompiles) # By default (in glibc, at least), on 32bit platforms off_t is 32 bits, # which causes a SIGXFSZ when trying to manipulate files larger than 2Gb # using libc calls (note that this issue does not occur when using QFile). check_cxx_source_compiles(" #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main() { return 0; } " _OFFT_IS_64BIT) if (NOT _OFFT_IS_64BIT) _kde_add_platform_definitions(-D_FILE_OFFSET_BITS=64) endif () endif() if (WIN32) # Speeds up compile times by not including everything with windows.h # See http://msdn.microsoft.com/en-us/library/windows/desktop/aa383745%28v=vs.85%29.aspx _kde_add_platform_definitions(-DWIN32_LEAN_AND_MEAN) # Target Windows Vista # This enables various bits of new API # See http://msdn.microsoft.com/en-us/library/windows/desktop/aa383745%28v=vs.85%29.aspx _kde_add_platform_definitions(-D_WIN32_WINNT=0x0600 -DWINVER=0x0600 -D_WIN32_IE=0x0600) # Use the Unicode versions of Windows API by default # See http://msdn.microsoft.com/en-us/library/windows/desktop/dd317766%28v=vs.85%29.aspx _kde_add_platform_definitions(-DUNICODE -D_UNICODE) # As stated in http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx M_PI only gets defined # if _USE_MATH_DEFINES is defined, with mingw this has a similar effect as -D_GNU_SOURCE on math.h _kde_add_platform_definitions(-D_USE_MATH_DEFINES) endif() ############################################################ # Language and toolchain features ############################################################ # Pick sensible versions of the C and C++ standards. if (NOT CMAKE_C_STANDARD) set(CMAKE_C_STANDARD 90) endif() if (NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED True) endif() # Do not merge uninitialized global variables. # This is mostly a "principle of least surprise" thing, but also # has performance benefits. # See https://www.ibm.com/developerworks/community/blogs/zTPF/entry/benefits_of_the_fnocommon_compile_option_peter_lemieszewski?lang=en # Note that this only applies to C code; C++ already behaves like this. if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang" OR (CMAKE_C_COMPILER_ID STREQUAL "Intel" AND NOT WIN32)) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-common") endif() # Do not treat the operator name keywords and, bitand, bitor, compl, not, or and xor as synonyms as keywords. # They're not supported under Visual Studio out of the box thus using them limits the portability of code if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang" OR (CMAKE_C_COMPILER_ID STREQUAL "Intel" AND NOT WIN32)) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-operator-names") endif() # Default to hidden visibility for symbols set(CMAKE_C_VISIBILITY_PRESET hidden) set(CMAKE_CXX_VISIBILITY_PRESET hidden) set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) if (POLICY CMP0063) # No sane project should be affected by CMP0063, so suppress the warnings # generated by the above visibility settings in CMake >= 3.3 cmake_policy(SET CMP0063 NEW) endif() if (UNIX AND NOT APPLE AND NOT CYGWIN) # Enable adding DT_RUNPATH, which means that LD_LIBRARY_PATH takes precedence # over the built-in rPath set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--enable-new-dtags ${CMAKE_SHARED_LINKER_FLAGS}") set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--enable-new-dtags ${CMAKE_MODULE_LINKER_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS "-Wl,--enable-new-dtags ${CMAKE_EXE_LINKER_FLAGS}") endif() if (CMAKE_SYSTEM_NAME STREQUAL GNU) # Enable multithreading with the pthread library # FIXME: Is this actually necessary to have here? # Can CMakeLists.txt files that require it use FindThreads.cmake # instead? set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pthread") set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -pthread") endif() ############################################################ # Turn off exceptions by default # # This involves enough code to be separate from the # previous section. ############################################################ # TODO: Deal with QT_NO_EXCEPTIONS for non-gnu compilers? # This should be defined if and only if exceptions are disabled. # qglobal.h has some magic to set it when exceptions are disabled # with gcc, but other compilers are unaccounted for. # Turn off exceptions by default if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND NOT WIN32) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") #elseif (MSVC OR (WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Intel")) # Exceptions appear to be disabled by default for MSVC # http://msdn.microsoft.com/en-us/library/1deeycx5.aspx # FIXME: are exceptions disabled by default for Intel? endif() macro(_kdecompilersettings_append_exception_flag VAR) if (MSVC) set(${VAR} "${${VAR}} -EHsc") elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") if (WIN32) set(${VAR} "${${VAR}} -EHsc") else() set(${VAR} "${${VAR}} -fexceptions") endif() elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") set(${VAR} "${${VAR}} -fexceptions") elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(${VAR} "${${VAR}} -fexceptions") endif() string(STRIP "${${VAR}}" ${VAR}) endmacro() function(KDE_SOURCE_FILES_ENABLE_EXCEPTIONS) foreach(source_file ${ARGV}) get_source_file_property(flags ${source_file} COMPILE_FLAGS) if(NOT flags) # If COMPILE_FLAGS is not set, get_source_file_property() sets it to # NOTFOUND, which breaks build if we concatenate anything to # the "NOTFOUND" string. # Note that NOTFOUND evaluates to False, so we do enter the if. set(flags "") endif() _kdecompilersettings_append_exception_flag(flags) set_source_files_properties(${source_file} COMPILE_FLAGS "${flags}") endforeach() endfunction() function(KDE_TARGET_ENABLE_EXCEPTIONS target mode) target_compile_options(${target} ${mode} "$<$:-EHsc>") if (WIN32) target_compile_options(${target} ${mode} "$<$:-EHsc>") else() target_compile_options(${target} ${mode} "$<$:-fexceptions>") endif() target_compile_options(${target} ${mode} "$<$,$,$>:-fexceptions>") endfunction() function(KDE_ENABLE_EXCEPTIONS) # We set CMAKE_CXX_FLAGS, rather than add_compile_options(), because # we only want to affect the compilation of C++ source files. # strip any occurrences of -DQT_NO_EXCEPTIONS; this should only be defined # if exceptions are disabled # the extra spaces mean we will not accentially mangle any other options string(REPLACE " -DQT_NO_EXCEPTIONS " " " CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} ") # this option is common to several compilers, so just always remove it string(REPLACE " -fno-exceptions " " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") # strip undoes the extra spaces we put in above string(STRIP "${CMAKE_CXX_FLAGS}" CMAKE_CXX_FLAGS) _kdecompilersettings_append_exception_flag(CMAKE_CXX_FLAGS) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" PARENT_SCOPE) endfunction() ############################################################ # Better diagnostics (warnings, errors) ############################################################ if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT APPLE) OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT APPLE) OR (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND NOT WIN32)) # Linker warnings should be treated as errors set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings ${CMAKE_SHARED_LINKER_FLAGS}") set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings ${CMAKE_MODULE_LINKER_FLAGS}") # Do not allow undefined symbols, even in non-symbolic shared libraries set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}") set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_MODULE_LINKER_FLAGS}") endif() set(_KDE_GCC_COMMON_WARNING_FLAGS "-Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef") if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") # -Wgnu-zero-variadic-macro-arguments (part of -pedantic) is triggered by every qCDebug() call and therefore results # in a lot of noise. This warning is only notifying us that clang is emulating the GCC behaviour # instead of the exact standard wording so we can safely ignore it set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-gnu-zero-variadic-macro-arguments") endif() if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_KDE_GCC_COMMON_WARNING_FLAGS} -Wmissing-format-attribute -Wwrite-strings") # Make some warnings errors set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=implicit-function-declaration") endif() if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_KDE_GCC_COMMON_WARNING_FLAGS} -Wnon-virtual-dtor -Woverloaded-virtual") # Make some warnings errors set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=return-type") endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5)) # -Wvla: use of variable-length arrays (an extension to C++) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wvla") endif() if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5)) include(CheckCXXCompilerFlag) check_cxx_compiler_flag(-Wdate-time HAVE_DATE_TIME) if (HAVE_DATE_TIME) # -Wdate-time: warn if we use __DATE__ or __TIME__ (we want to be able to reproduce the exact same binary) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wdate-time") endif() endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0.0") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override -Wlogical-op" ) endif() endif() # -w1 turns on warnings and errors # FIXME: someone needs to have a closer look at the Intel compiler options if (CMAKE_C_COMPILER_ID STREQUAL "Intel" AND NOT WIN32) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -w1 -Wpointer-arith") endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND NOT WIN32) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -w1 -Wpointer-arith") endif() if (MSVC) # FIXME: do we not want to set the warning level up to level 3? (/W3) # Disable warnings: # C4250: 'class1' : inherits 'class2::member' via dominance set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4250") # C4251: 'identifier' : class 'type' needs to have dll-interface to be # used by clients of class 'type2' set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4251") # C4396: 'identifier' : 'function' the inline specifier cannot be used # when a friend declaration refers to a specialization of a # function template set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4396") # C4661: 'identifier' : no suitable definition provided for explicit # template instantiation request set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4661") endif() if (WIN32) # Disable deprecation warnings for some API # FIXME: do we really want this? add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS ) endif() if (APPLE) #full Single Unix Standard v3 (SUSv3) conformance (the Unix API) _kde_add_platform_definitions(-D_DARWIN_C_SOURCE) #Cocoa is unconditional since we only support OS X 10.6 and above _kde_add_platform_definitions(-DQT_MAC_USE_COCOA) endif() ############################################################ # Hacks # # Anything in this section should be thoroughly documented, # including what problems it is supposed to fix and in what # circumstances those problems occur. Include links to any # relevant bug reports. ############################################################ if (APPLE) # FIXME: why are these needed? The commit log is unhelpful # (it was introduced in svn path=/trunk/KDE/kdelibs/; revision=503025 - # kdelibs git commit 4e4cb9cb9a2216b63d3eabf88b8fe94ee3c898cf - # with the message "mac os x fixes for the cmake build") set (CMAKE_SHARED_LINKER_FLAGS "-single_module -multiply_defined suppress ${CMAKE_SHARED_LINKER_FLAGS}") set (CMAKE_MODULE_LINKER_FLAGS "-multiply_defined suppress ${CMAKE_MODULE_LINKER_FLAGS}") endif() if (WIN32) if (MSVC OR CMAKE_CXX_COMPILER_ID STREQUAL "Intel") # MSVC has four incompatible C runtime libraries: static (libcmt), # static debug (libcmtd), shared (msvcrt) and shared debug (msvcrtd): # see http://support.microsoft.com/kb/154753 # # By default, when you create static libraries, they are automatically # linked against either libcmt or libcmtd, and when you create shared # libraries, they are automatically linked against either msvcrt or # msvcrtd. Trying to link to both a library that links to libcmt and # library that links to mscvrt, for example, will produce a warning as # described at # http://msdn.microsoft.com/en-us/library/aa267384%28VS.60%29.aspx # and can produce link errors like # "__thiscall type_info::type_info(class type_info const &)" # (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj) # # It is actually the options passed to the compiler, rather than the # linker, which control what will be linked (/MT, /MTd, /MD or /MDd), # but we can override this by telling the linker to ignore any "libcmt" # or "libcmtd" link suggestion embedded in the object files, and instead # link against the shared versions. That way, everything will link # against the same runtime library. set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/NODEFAULTLIB:libcmt /DEFAULTLIB:msvcrt ${CMAKE_EXE_LINKER_FLAGS_RELEASE}") set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/NODEFAULTLIB:libcmt /DEFAULTLIB:msvcrt ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO}") set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "/NODEFAULTLIB:libcmt /DEFAULTLIB:msvcrt ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL}") set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/NODEFAULTLIB:libcmtd /DEFAULTLIB:msvcrtd ${CMAKE_EXE_LINKER_FLAGS_DEBUG}") endif() endif() if (MINGW AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # This was copied from the Phonon build settings, where it had the comment # "otherwise undefined symbol in phononcore.dll errors occurs", with the commit # message "set linker flag --export-all-symbols for all targets, otherwise # some depending targets could not be build" # FIXME: do our export macros not deal with this properly? set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--export-all-symbols") set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--export-all-symbols") endif() if (CMAKE_GENERATOR STREQUAL "Ninja" AND ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5))) # Force colored warnings in Ninja's output, if the compiler has -fdiagnostics-color support. # Rationale in https://github.com/ninja-build/ninja/issues/814 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always") endif() include("${ECM_MODULE_DIR}/ECMEnableSanitizers.cmake") include("${ECM_MODULE_DIR}/ECMCoverageOption.cmake") diff --git a/kde-modules/KDEFrameworkCompilerSettings.cmake b/kde-modules/KDEFrameworkCompilerSettings.cmake index 90dab73..27298b8 100644 --- a/kde-modules/KDEFrameworkCompilerSettings.cmake +++ b/kde-modules/KDEFrameworkCompilerSettings.cmake @@ -1,87 +1,66 @@ #.rst: # KDEFrameworkCompilerSettings # ---------------------------- # # Set stricter compile and link flags for KDE Frameworks modules. # # The KDECompilerSettings module is included and, in addition, various # defines that affect the Qt libraries are set to enforce certain # conventions. # # For example, constructions like QString("foo") are prohibited, instead # forcing the use of QLatin1String or QStringLiteral, and some # Qt-defined keywords like signals and slots will not be defined. # # NB: it is recommended to include this module with the NO_POLICY_SCOPE # flag, otherwise you may get spurious warnings with some versions of CMake. # # Since pre-1.0.0. #============================================================================= -# Copyright 2013 Albert Astals Cid -# Copyright 2007 Matthias Kretz -# Copyright 2006-2007 Laurent Montel -# Copyright 2006-2013 Alex Neundorf +# SPDX-FileCopyrightText: 2013 Albert Astals Cid +# SPDX-FileCopyrightText: 2007 Matthias Kretz +# SPDX-FileCopyrightText: 2006-2007 Laurent Montel +# SPDX-FileCopyrightText: 2006-2013 Alex Neundorf # -# 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. +# SPDX-License-Identifier: BSD-3-Clause include(KDECompilerSettings NO_POLICY_SCOPE) add_definitions(-DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_URL_CAST_FROM_STRING -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_SIGNALS_SLOTS_KEYWORDS -DQT_USE_QSTRINGBUILDER -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT ) if (NOT WIN32) # Strict iterators can't be used on Windows, they lead to a link error # when application code iterates over a QVector for instance, unless # Qt itself was also built with strict iterators. # See example at https://bugreports.qt.io/browse/AUTOSUITE-946 add_definitions(-DQT_STRICT_ITERATORS) endif() add_definitions( -DQT_DEPRECATED_WARNINGS_SINCE=0x060000 -DKF_DEPRECATED_WARNINGS_SINCE=0x060000 ) if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic") endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0.0") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wzero-as-null-pointer-constant" ) endif() endif() if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0.0") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wzero-as-null-pointer-constant" ) endif() endif() diff --git a/kde-modules/KDEInstallDirs.cmake b/kde-modules/KDEInstallDirs.cmake index c1d056b..d739cf1 100644 --- a/kde-modules/KDEInstallDirs.cmake +++ b/kde-modules/KDEInstallDirs.cmake @@ -1,740 +1,719 @@ #.rst: # KDEInstallDirs # -------------- # # Define KDE standard installation directories. # # Note that none of the variables defined by this module provide any # information about the location of already-installed KDE software. # # Inclusion of this module defines the following variables: # # ``KDE_INSTALL_`` # destination for files of a given type # ``KDE_INSTALL_FULL_`` # corresponding absolute path # # where ```` is one of (default values in parentheses and alternative, # deprecated variable name in square brackets): # # ``BUNDLEDIR`` # application bundles (``/Applications/KDE``) [``BUNDLE_INSTALL_DIR``] # ``EXECROOTDIR`` # executables and libraries (````) [``EXEC_INSTALL_PREFIX``] # ``BINDIR`` # user executables (``EXECROOTDIR/bin``) [``BIN_INSTALL_DIR``] # ``SBINDIR`` # system admin executables (``EXECROOTDIR/sbin``) [``SBIN_INSTALL_DIR``] # ``LIBDIR`` # object code libraries (``EXECROOTDIR/lib``, ``EXECROOTDIR/lib64`` or # ``EXECROOTDIR/lib/`` variables (or their ``CMAKE_INSTALL_`` or # deprecated counterparts) may be passed to the DESTINATION options of # ``install()`` commands for the corresponding file type. They are set in the # CMake cache, and so the defaults above can be overridden by users. # # Note that the ``KDE_INSTALL_``, ``CMAKE_INSTALL_`` or deprecated # form of the variable can be changed using CMake command line variable # definitions; in either case, all forms of the variable will be affected. The # effect of passing multiple forms of the same variable on the command line # (such as ``KDE_INSTALL_BINDIR`` and ``CMAKE_INSTALL_BINDIR`` is undefined. # # The variable ``KDE_INSTALL_TARGETS_DEFAULT_ARGS`` is also defined (along with # the deprecated form ``INSTALL_TARGETS_DEFAULT_ARGS``). This should be used # when libraries or user-executable applications are installed, in the # following manner: # # .. code-block:: cmake # # install(TARGETS mylib myapp ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) # # It MUST NOT be used for installing plugins, system admin executables or # executables only intended for use internally by other code. Those should use # ``KDE_INSTALL_PLUGINDIR``, ``KDE_INSTALL_SBINDIR`` or # ``KDE_INSTALL_LIBEXECDIR`` respectively. # # Additionally, ``CMAKE_INSTALL_DEFAULT_COMPONENT_NAME`` will be set to # ``${PROJECT_NAME}`` to provide a sensible default for this CMake option. # # Note that mixing absolute and relative paths, particularly for ``BINDIR``, # ``LIBDIR`` and ``INCLUDEDIR``, can cause issues with exported targets. Given # that the default values for these are relative paths, relative paths should # be used on the command line when possible (eg: use # ``-DKDE_INSTALL_LIBDIR=lib64`` instead of # ``-DKDE_INSTALL_LIBDIR=/usr/lib/lib64`` to override the library directory). # # Since pre-1.0.0. # # NB: The variables starting ``KDE_INSTALL_`` are available since 1.6.0, # unless otherwise noted with the variable. # # The ``KDE_INSTALL_PREFIX_SCRIPT`` option will install a ${CMAKE_INSTALL_PREFIX}/prefix.sh # file that allows to easily incorporate the necessary environment variables # for the prefix into a process. # #============================================================================= -# Copyright 2014-2015 Alex Merry -# Copyright 2013 Stephen Kelly -# Copyright 2012 David Faure -# Copyright 2007 Matthias Kretz -# Copyright 2006-2007 Laurent Montel -# Copyright 2006-2013 Alex Neundorf +# SPDX-FileCopyrightText: 2014-2015 Alex Merry +# SPDX-FileCopyrightText: 2013 Stephen Kelly +# SPDX-FileCopyrightText: 2012 David Faure +# SPDX-FileCopyrightText: 2007 Matthias Kretz +# SPDX-FileCopyrightText: 2006-2007 Laurent Montel +# SPDX-FileCopyrightText: 2006-2013 Alex Neundorf # -# 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. +# SPDX-License-Identifier: BSD-3-Clause # Figure out what the default install directory for libraries should be. # This is based on the logic in GNUInstallDirs, but simplified (the # GNUInstallDirs code deals with re-configuring, but that is dealt with # by the _define_* macros in this module). set(_LIBDIR_DEFAULT "lib") # Override this default 'lib' with 'lib64' if: # - we are on a Linux, kFreeBSD or Hurd system but NOT cross-compiling # - we are NOT on debian # - we are NOT on flatpak # - we are on a 64 bits system # reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf # For Debian with multiarch, use 'lib/${CMAKE_LIBRARY_ARCHITECTURE}' if # CMAKE_LIBRARY_ARCHITECTURE is set (which contains e.g. "i386-linux-gnu" # See https://wiki.debian.org/Multiarch if((CMAKE_SYSTEM_NAME MATCHES "Linux|kFreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "GNU") AND NOT CMAKE_CROSSCOMPILING AND NOT EXISTS "/etc/arch-release" AND NOT DEFINED ENV{FLATPAK_ID}) if (EXISTS "/etc/debian_version") # is this a debian system ? if(CMAKE_LIBRARY_ARCHITECTURE) set(_LIBDIR_DEFAULT "lib/${CMAKE_LIBRARY_ARCHITECTURE}") endif() else() # not debian, rely on CMAKE_SIZEOF_VOID_P: if(NOT DEFINED CMAKE_SIZEOF_VOID_P) message(AUTHOR_WARNING "Unable to determine default LIB_INSTALL_LIBDIR directory because no target architecture is known. " "Please enable at least one language before including KDEInstallDirs.") else() if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") set(_LIBDIR_DEFAULT "lib64") endif() endif() endif() endif() set(_gnu_install_dirs_vars BINDIR SBINDIR LIBEXECDIR SYSCONFDIR SHAREDSTATEDIR LOCALSTATEDIR LIBDIR INCLUDEDIR OLDINCLUDEDIR DATAROOTDIR DATADIR INFODIR LOCALEDIR MANDIR DOCDIR) # Macro for variables that are relative to another variable. We store an empty # value in the cache (for documentation/GUI cache editor purposes), and store # the default value in a local variable. If the cache variable is ever set to # something non-empty, the local variable will no longer be set. However, if # the cache variable remains (or is set to be) empty, the value will be # relative to that of the parent variable. # # varname: the variable name suffix (eg: BINDIR for KDE_INSTALL_BINDIR) # parent: the variable suffix of the variable this is relative to # (eg: DATAROOTDIR for KDE_INSTALL_DATAROOTDIR) # subdir: the path of the default value of KDE_INSTALL_${varname} # relative to KDE_INSTALL_${parent}: no leading / # docstring: documentation about the variable (not including the default value) # oldstylename (optional): the old-style name of the variable macro(_define_relative varname parent subdir docstring) set(_oldstylename) if(NOT KDE_INSTALL_DIRS_NO_DEPRECATED AND ${ARGC} GREATER 4) set(_oldstylename "${ARGV4}") endif() set(_cmakename) if(NOT KDE_INSTALL_DIRS_NO_CMAKE_VARIABLES) list(FIND _gnu_install_dirs_vars "${varname}" _list_offset) set(_cmakename_is_deprecated FALSE) if(NOT KDE_INSTALL_DIRS_NO_DEPRECATED OR NOT _list_offset EQUAL -1) set(_cmakename CMAKE_INSTALL_${varname}) if(_list_offset EQUAL -1) set(_cmakename_is_deprecated TRUE) endif() endif() endif() # Surprisingly complex logic to deal with joining paths. # Note that we cannot use arg vars directly in if() because macro args are # not proper variables. set(_parent "${parent}") set(_subdir "${subdir}") if(_parent AND _subdir) set(_docpath "${_parent}/${_subdir}") if(KDE_INSTALL_${_parent}) set(_realpath "${KDE_INSTALL_${_parent}}/${_subdir}") else() set(_realpath "${_subdir}") endif() elseif(_parent) set(_docpath "${_parent}") set(_realpath "${KDE_INSTALL_${_parent}}") else() set(_docpath "${_subdir}") set(_realpath "${_subdir}") endif() if(KDE_INSTALL_${varname}) # make sure the cache documentation is set correctly get_property(_iscached CACHE KDE_INSTALL_${varname} PROPERTY VALUE SET) if (_iscached) # make sure the docs are still set if it was passed on the command line set_property(CACHE KDE_INSTALL_${varname} PROPERTY HELPSTRING "${docstring} (${_docpath})") # make sure the type is correct if it was passed on the command line set_property(CACHE KDE_INSTALL_${varname} PROPERTY TYPE PATH) endif() elseif(${_oldstylename}) if(NOT CMAKE_VERSION VERSION_LESS 3.0.0) message(DEPRECATION "${_oldstylename} is deprecated, use KDE_INSTALL_${varname} instead.") endif() # The old name was given (probably on the command line): move # it to the new name set(KDE_INSTALL_${varname} "${${_oldstylename}}" CACHE PATH "${docstring} (${_docpath})" FORCE) elseif(${_cmakename}) if(_cmakename_is_deprecated AND NOT CMAKE_VERSION VERSION_LESS 3.0.0) message(DEPRECATION "${_cmakename} is deprecated, use KDE_INSTALL_${varname} instead.") endif() # The CMAKE_ name was given (probably on the command line): move # it to the new name set(KDE_INSTALL_${varname} "${${_cmakename}}" CACHE PATH "${docstring} (${_docpath})" FORCE) else() # insert an empty value into the cache, indicating the default # should be used (including compatibility vars above) set(KDE_INSTALL_${varname} "" CACHE PATH "${docstring} (${_docpath})") set(KDE_INSTALL_${varname} "${_realpath}") endif() mark_as_advanced(KDE_INSTALL_${varname}) if(NOT IS_ABSOLUTE ${KDE_INSTALL_${varname}}) set(KDE_INSTALL_FULL_${varname} "${CMAKE_INSTALL_PREFIX}/${KDE_INSTALL_${varname}}") else() set(KDE_INSTALL_FULL_${varname} "${KDE_INSTALL_${varname}}") endif() # Override compatibility vars at runtime, even though we don't touch # them in the cache; this way, we keep the variables in sync where # KDEInstallDirs is included, but don't interfere with, say, # GNUInstallDirs in a parallel part of the CMake tree. if(_cmakename) set(${_cmakename} "${KDE_INSTALL_${varname}}") set(CMAKE_INSTALL_FULL_${varname} "${KDE_INSTALL_FULL_${varname}}") endif() if(_oldstylename) set(${_oldstylename} "${KDE_INSTALL_${varname}}") endif() endmacro() # varname: the variable name suffix (eg: BINDIR for KDE_INSTALL_BINDIR) # dir: the relative path of the default value of KDE_INSTALL_${varname} # relative to CMAKE_INSTALL_PREFIX: no leading / # docstring: documentation about the variable (not including the default value) # oldstylename (optional): the old-style name of the variable macro(_define_absolute varname dir docstring) _define_relative("${varname}" "" "${dir}" "${docstring}" ${ARGN}) endmacro() macro(_define_non_cache varname value) set(KDE_INSTALL_${varname} "${value}") if(NOT IS_ABSOLUTE ${KDE_INSTALL_${varname}}) set(KDE_INSTALL_FULL_${varname} "${CMAKE_INSTALL_PREFIX}/${KDE_INSTALL_${varname}}") else() set(KDE_INSTALL_FULL_${varname} "${KDE_INSTALL_${varname}}") endif() if(NOT KDE_INSTALL_DIRS_NO_CMAKE_VARIABLES) list(FIND _gnu_install_dirs_vars "${varname}" _list_offset) if(NOT KDE_INSTALL_DIRS_NO_DEPRECATED OR NOT _list_offset EQUAL -1) set(CMAKE_INSTALL_${varname} "${KDE_INSTALL_${varname}}") set(CMAKE_INSTALL_FULL_${varname} "${KDE_INSTALL_FULL_${varname}}") endif() endif() endmacro() if(APPLE) _define_absolute(BUNDLEDIR "/Applications/KDE" "application bundles" BUNDLE_INSTALL_DIR) endif() # Only supported since cmake 3.7 if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${ECM_PREFIX}" CACHE PATH "Install path prefix" FORCE) endif() _define_absolute(EXECROOTDIR "" "executables and libraries" EXEC_INSTALL_PREFIX) _define_relative(BINDIR EXECROOTDIR "bin" "user executables" BIN_INSTALL_DIR) _define_relative(SBINDIR EXECROOTDIR "sbin" "system admin executables" SBIN_INSTALL_DIR) _define_relative(LIBDIR EXECROOTDIR "${_LIBDIR_DEFAULT}" "object code libraries" LIB_INSTALL_DIR) if(WIN32) _define_relative(LIBEXECDIR BINDIR "" "executables for internal use by programs and libraries" LIBEXEC_INSTALL_DIR) _define_non_cache(LIBEXECDIR_KF5 "${CMAKE_INSTALL_LIBEXECDIR}") else() _define_relative(LIBEXECDIR LIBDIR "libexec" "executables for internal use by programs and libraries" LIBEXEC_INSTALL_DIR) _define_non_cache(LIBEXECDIR_KF5 "${CMAKE_INSTALL_LIBEXECDIR}/kf5") endif() if(NOT KDE_INSTALL_DIRS_NO_DEPRECATED) set(KF5_LIBEXEC_INSTALL_DIR "${CMAKE_INSTALL_LIBEXECDIR_KF5}") endif() _define_relative(CMAKEPACKAGEDIR LIBDIR "cmake" "CMake packages, including config files" CMAKECONFIG_INSTALL_PREFIX) include("${ECM_MODULE_DIR}/ECMQueryQmake.cmake") set(_default_KDE_INSTALL_USE_QT_SYS_PATHS OFF) if(NOT DEFINED KDE_INSTALL_USE_QT_SYS_PATHS) query_qmake(qt_install_prefix_dir QT_INSTALL_PREFIX TRY) if(qt_install_prefix_dir STREQUAL "${CMAKE_INSTALL_PREFIX}") message(STATUS "Installing in the same prefix as Qt, adopting their path scheme.") set(_default_KDE_INSTALL_USE_QT_SYS_PATHS ON) endif() endif() option (KDE_INSTALL_USE_QT_SYS_PATHS "Install mkspecs files, QCH files for Qt-based libs, Plugins and Imports to the Qt 5 install dir" "${_default_KDE_INSTALL_USE_QT_SYS_PATHS}") if(KDE_INSTALL_USE_QT_SYS_PATHS) # Qt-specific vars query_qmake(qt_plugins_dir QT_INSTALL_PLUGINS) _define_absolute(QTPLUGINDIR ${qt_plugins_dir} "Qt plugins" QT_PLUGIN_INSTALL_DIR) query_qmake(qt_imports_dir QT_INSTALL_IMPORTS) _define_absolute(QTQUICKIMPORTSDIR ${qt_imports_dir} "QtQuick1 imports" IMPORTS_INSTALL_DIR) query_qmake(qt_qml_dir QT_INSTALL_QML) _define_absolute(QMLDIR ${qt_qml_dir} "QtQuick2 imports" QML_INSTALL_DIR) else() set(_pluginsDirParent LIBDIR) if (ANDROID) set(_pluginsDirParent) #androiddeployqt wants plugins right in the prefix endif() _define_relative(QTPLUGINDIR "${_pluginsDirParent}" "plugins" "Qt plugins" QT_PLUGIN_INSTALL_DIR) _define_relative(QTQUICKIMPORTSDIR QTPLUGINDIR "imports" "QtQuick1 imports" IMPORTS_INSTALL_DIR) _define_relative(QMLDIR LIBDIR "qml" "QtQuick2 imports" QML_INSTALL_DIR) endif() _define_relative(PLUGINDIR QTPLUGINDIR "" "Plugins" PLUGIN_INSTALL_DIR) _define_absolute(INCLUDEDIR "include" "C and C++ header files" INCLUDE_INSTALL_DIR) _define_non_cache(INCLUDEDIR_KF5 "${CMAKE_INSTALL_INCLUDEDIR}/KF5") if(NOT KDE_INSTALL_DIRS_NO_DEPRECATED) set(KF5_INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR_KF5}") endif() _define_absolute(LOCALSTATEDIR "var" "modifiable single-machine data") _define_absolute(SHAREDSTATEDIR "com" "modifiable architecture-independent data") if (WIN32) _define_relative(DATAROOTDIR BINDIR "data" "read-only architecture-independent data root" SHARE_INSTALL_PREFIX) else() _define_absolute(DATAROOTDIR "share" "read-only architecture-independent data root" SHARE_INSTALL_PREFIX) endif() _define_relative(DATADIR DATAROOTDIR "" "read-only architecture-independent data" DATA_INSTALL_DIR) _define_non_cache(DATADIR_KF5 "${CMAKE_INSTALL_DATADIR}/kf5") if(NOT KDE_INSTALL_DIRS_NO_DEPRECATED) set(KF5_DATA_INSTALL_DIR "${CMAKE_INSTALL_DATADIR_KF5}") endif() # Qt-specific data vars if(KDE_INSTALL_USE_QT_SYS_PATHS) query_qmake(qt_docs_dir QT_INSTALL_DOCS) _define_absolute(QTQCHDIR ${qt_docs_dir} "documentation bundles in QCH format for Qt-extending libraries") else() _define_relative(QTQCHDIR DATAROOTDIR "doc/qch" "documentation bundles in QCH format for Qt-extending libraries") endif() # KDE Framework-specific things _define_relative(DOCBUNDLEDIR DATAROOTDIR "doc/HTML" "documentation bundles generated using kdoctools" HTML_INSTALL_DIR) _define_relative(KCFGDIR DATAROOTDIR "config.kcfg" "kconfig description files" KCFG_INSTALL_DIR) _define_relative(KCONFUPDATEDIR DATAROOTDIR "kconf_update" "kconf_update scripts" KCONF_UPDATE_INSTALL_DIR) _define_relative(KSERVICES5DIR DATAROOTDIR "kservices5" "services for KDE Frameworks 5" SERVICES_INSTALL_DIR) _define_relative(KSERVICETYPES5DIR DATAROOTDIR "kservicetypes5" "service types for KDE Frameworks 5" SERVICETYPES_INSTALL_DIR) _define_relative(KNOTIFY5RCDIR DATAROOTDIR "knotifications5" "knotify description files" KNOTIFYRC_INSTALL_DIR) _define_relative(KXMLGUI5DIR DATAROOTDIR "kxmlgui5" "kxmlgui .rc files" KXMLGUI_INSTALL_DIR) _define_relative(KTEMPLATESDIR DATAROOTDIR "kdevappwizard/templates" "Kapptemplate and Kdevelop templates") _define_relative(LOGGINGCATEGORIESDIR DATAROOTDIR "qlogging-categories5" "Qt Logging categories files") _define_relative(JARDIR "" "jar" "Java AAR/JAR files for Android") # Cross-desktop or other system things _define_relative(ICONDIR DATAROOTDIR "icons" "icons" ICON_INSTALL_DIR) _define_relative(LOCALEDIR DATAROOTDIR "locale" "knotify description files" LOCALE_INSTALL_DIR) _define_relative(SOUNDDIR DATAROOTDIR "sounds" "sound files" SOUND_INSTALL_DIR) _define_relative(TEMPLATEDIR DATAROOTDIR "templates" "templates" TEMPLATES_INSTALL_DIR) _define_relative(WALLPAPERDIR DATAROOTDIR "wallpapers" "desktop wallpaper images" WALLPAPER_INSTALL_DIR) _define_relative(APPDIR DATAROOTDIR "applications" "application desktop files" XDG_APPS_INSTALL_DIR) _define_relative(DESKTOPDIR DATAROOTDIR "desktop-directories" "desktop directories" XDG_DIRECTORY_INSTALL_DIR) _define_relative(MIMEDIR DATAROOTDIR "mime/packages" "mime description files" XDG_MIME_INSTALL_DIR) _define_relative(METAINFODIR DATAROOTDIR "metainfo" "AppStream component metadata") _define_relative(QCHDIR DATAROOTDIR "doc/qch" "documentation bundles in QCH format") _define_relative(MANDIR DATAROOTDIR "man" "man documentation" MAN_INSTALL_DIR) _define_relative(INFODIR DATAROOTDIR "info" "info documentation") _define_relative(DBUSDIR DATAROOTDIR "dbus-1" "D-Bus") _define_relative(DBUSINTERFACEDIR DBUSDIR "interfaces" "D-Bus interfaces" DBUS_INTERFACES_INSTALL_DIR) _define_relative(DBUSSERVICEDIR DBUSDIR "services" "D-Bus session services" DBUS_SERVICES_INSTALL_DIR) _define_relative(DBUSSYSTEMSERVICEDIR DBUSDIR "system-services" "D-Bus system services" DBUS_SYSTEM_SERVICES_INSTALL_DIR) _define_relative(SYSTEMDUNITDIR CMAKE_INSTALL_PREFIX "lib/systemd" "Systemd units" SYSTEMD_UNIT_INSTALL_DIR) _define_relative(SYSTEMDUSERUNITDIR SYSTEMDUNITDIR "user" "Systemd user units" SYSTEMD_USER_UNIT_INSTALL_DIR) set(_default_sysconf_dir "etc") if (CMAKE_INSTALL_PREFIX STREQUAL "/usr") set(_default_sysconf_dir "/etc") endif() _define_absolute(SYSCONFDIR "${_default_sysconf_dir}" "read-only single-machine data" SYSCONF_INSTALL_DIR) _define_relative(CONFDIR SYSCONFDIR "xdg" "application configuration files" CONFIG_INSTALL_DIR) _define_relative(AUTOSTARTDIR CONFDIR "autostart" "autostart files" AUTOSTART_INSTALL_DIR) set(_mixed_core_path_styles FALSE) if (IS_ABSOLUTE "${KDE_INSTALL_BINDIR}") if (NOT IS_ABSOLUTE "${KDE_INSTALL_LIBDIR}" OR NOT IS_ABSOLUTE "${KDE_INSTALL_INCLUDEDIR}") set(_mixed_core_path_styles ) endif() else() if (IS_ABSOLUTE "${KDE_INSTALL_LIBDIR}" OR IS_ABSOLUTE "${KDE_INSTALL_INCLUDEDIR}") set(_mixed_core_path_styles TRUE) endif() endif() if (_mixed_core_path_styles) message(WARNING "KDE_INSTALL_BINDIR, KDE_INSTALL_LIBDIR and KDE_INSTALL_INCLUDEDIR should either all be absolute paths or all be relative paths.") endif() # For more documentation see above. # 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. # FIXME: why is INCLUDES (only) set for ARCHIVE targets? set(KDE_INSTALL_TARGETS_DEFAULT_ARGS RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT Devel INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ) set(KF5_INSTALL_TARGETS_DEFAULT_ARGS RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT Devel INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR_KF5}" ) # on the Mac support an extra install directory for application bundles if(APPLE) set(KDE_INSTALL_TARGETS_DEFAULT_ARGS ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} BUNDLE DESTINATION "${BUNDLE_INSTALL_DIR}" ) set(KF5_INSTALL_TARGETS_DEFAULT_ARGS ${KF5_INSTALL_TARGETS_DEFAULT_ARGS} BUNDLE DESTINATION "${BUNDLE_INSTALL_DIR}" ) endif() if(NOT KDE_INSTALL_DIRS_NO_DEPRECATED) set(INSTALL_TARGETS_DEFAULT_ARGS ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) endif() # new in cmake 2.8.9: this is used for all installed files which do not have a component set # so set the default component name to the name of the project, if a project name has been set: if(NOT "${PROJECT_NAME}" STREQUAL "Project") set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "${PROJECT_NAME}") endif() ################################################################### # Prefix set up configure_file(${CMAKE_CURRENT_LIST_DIR}/prefix.sh.cmake ${CMAKE_CURRENT_BINARY_DIR}/prefix.sh @ONLY) option(KDE_INSTALL_PREFIX_SCRIPT "Installs ${CMAKE_INSTALL_PREFIX}/prefix.sh that sets up the necessary environment variables" OFF) if(KDE_INSTALL_PREFIX_SCRIPT) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/prefix.sh DESTINATION ${CMAKE_INSTALL_PREFIX} PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ) endif() if(NOT KDE_INSTALL_USE_QT_SYS_PATHS) message("Installing in ${CMAKE_INSTALL_PREFIX}. Run ${CMAKE_CURRENT_BINARY_DIR}/prefix.sh to set the environment for ${CMAKE_PROJECT_NAME}.") endif() diff --git a/kde-modules/KDEPackageAppTemplates.cmake b/kde-modules/KDEPackageAppTemplates.cmake index b0f60e0..54fb6fa 100644 --- a/kde-modules/KDEPackageAppTemplates.cmake +++ b/kde-modules/KDEPackageAppTemplates.cmake @@ -1,141 +1,120 @@ #.rst: # KDETemplateGenerator # -------------------- # # Packages KApptemplate/KDevelop compatible application templates # # This module provides a functionality to package in a tarball and # install project templates compatible with the format used by # KApptemplate and KDevelop. Useful for providing minimal examples # for the usage of the KDE Frameworks. # # This module provides the following function: # # :: # # kde_package_app_templates(TEMPLATES