Warning, /graphics/kooka/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 ########################################################################## 0002 ## ## 0003 ## This CMake file is part of Kooka, a KDE scanning/OCR application. ## 0004 ## ## 0005 ## This file may be distributed and/or modified under the terms of ## 0006 ## the GNU General Public License version 2, as published by the ## 0007 ## Free Software Foundation and appearing in the file COPYING ## 0008 ## included in the packaging of this file. ## 0009 ## ## 0010 ## Author: Jonathan Marten <jjm AT keelhaul DOT me DOT uk> ## 0011 ## ## 0012 ########################################################################## 0013 0014 cmake_minimum_required(VERSION 3.16) 0015 0016 project(kooka5) 0017 set(VERSION "0.90") 0018 message(STATUS "Configuring for Kooka/libkookascan version ${VERSION}") 0019 0020 set(QT_MIN_VERSION "5.15.0") 0021 set(KF5_MIN_VERSION "5.104.0") 0022 0023 # ECM setup (Extra Cmake Modules) 0024 find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) 0025 set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) 0026 0027 include(KDEInstallDirs) 0028 include(KDECMakeSettings) 0029 include(KDECompilerSettings NO_POLICY_SCOPE) 0030 0031 include(FeatureSummary) 0032 include(ECMSetupVersion) 0033 include(ECMGenerateHeaders) 0034 include(CMakePackageConfigHelpers) 0035 include(CheckFunctionExists) 0036 include(GenerateExportHeader) 0037 include(ECMInstallIcons) 0038 include(ECMQtDeclareLoggingCategory) 0039 include(KDEClangFormat) 0040 0041 # Options 0042 option(INSTALL_BINARIES "Install the binaries and libraries, turn off for development in place" ON) 0043 0044 # Required Qt components to build this package 0045 find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} REQUIRED COMPONENTS Core Widgets) 0046 0047 # Rigourousness 0048 add_definitions("-DQT_USE_QSTRINGBUILDER") 0049 add_definitions("-DQT_NO_CAST_FROM_BYTEARRAY") 0050 add_definitions("-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT") 0051 add_definitions("-DQT_NO_CAST_TO_ASCII") 0052 add_definitions("-DQT_NO_URL_CAST_FROM_STRING") 0053 0054 # Permissiveness 0055 remove_definitions("-DQT_NO_CAST_FROM_ASCII") 0056 remove_definitions("-DQT_NO_KEYWORDS") 0057 0058 # Support for SANE, here because library and sanedump both need it 0059 # 0060 # Prefer pkg-config(1), because sane-config(1) was removed from Debian 0061 # package sane-backends 1.0.25 in December 2016. Assuming here that 0062 # pkg-config(1) is available on any reasonable system. 0063 find_package(PkgConfig) 0064 if (PkgConfig_FOUND) 0065 pkg_check_modules(SANE sane-backends) 0066 endif (PkgConfig_FOUND) 0067 0068 if (SANE_FOUND) 0069 set(SANE_INCLUDES "${SANE_CFLAGS}") 0070 set(SANE_LIBRARIES "${SANE_LDFLAGS}") 0071 else (SANE_FOUND) 0072 # if pkg-config(1) did not find anything, then fall back to sane-config(1) 0073 message(STATUS "SANE not found via pkg-config(1), trying sane-config(1)") 0074 if (SANECONFIG_BIN) 0075 set(SANECONFIG_PROG ${SANECONFIG_BIN}) 0076 message(STATUS "Specified sane-config(1), ${SANECONFIG_PROG}") 0077 else (SANECONFIG_BIN) 0078 find_program(SANECONFIG_PROG NAMES sane-config) 0079 message(STATUS "Found sane-config(1), ${SANECONFIG_PROG}") 0080 endif (SANECONFIG_BIN) 0081 0082 if (SANECONFIG_PROG) 0083 set(SANE_FOUND true) 0084 execute_process(COMMAND ${SANECONFIG_PROG} --version OUTPUT_VARIABLE SANE_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) 0085 execute_process(COMMAND ${SANECONFIG_PROG} --cflags OUTPUT_VARIABLE SANE_INCLUDES OUTPUT_STRIP_TRAILING_WHITESPACE) 0086 execute_process(COMMAND ${SANECONFIG_PROG} --libs OUTPUT_VARIABLE SANE_LIBRARIES OUTPUT_STRIP_TRAILING_WHITESPACE) 0087 message(STATUS "Found SANE, version ${SANE_VERSION}") 0088 endif (SANECONFIG_PROG) 0089 0090 endif (SANE_FOUND) 0091 0092 if (SANE_FOUND) 0093 set(HAVE_SANE true) 0094 message(STATUS " SANE includes: ${SANE_INCLUDES}") 0095 message(STATUS " SANE libraries: ${SANE_LIBRARIES}") 0096 else (SANE_FOUND) 0097 message(SEND_ERROR "libkookascan needs SANE (http://www.sane-project.org) - install package or specify location of sane-config(1) with SANECONFIG_BIN") 0098 endif (SANE_FOUND) 0099 0100 ############### Common build flags ############### 0101 0102 if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") 0103 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic") 0104 0105 # both gcc & clang support it since the same version 0106 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 5.0.0) 0107 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wzero-as-null-pointer-constant" ) 0108 endif() 0109 endif() 0110 0111 ############### Common install locations ############### 0112 0113 set(PICS_INSTALL_DIR ${KDE_INSTALL_DATADIR}/kooka/pics) 0114 0115 ############### Common definitions ############### 0116 0117 add_definitions(-DKF5) 0118 0119 ############### Now, we add the Kooka components ############### 0120 0121 add_subdirectory(libdialogutil) 0122 add_subdirectory(libkookascan) 0123 add_subdirectory(libfiletree) 0124 add_subdirectory(app) 0125 add_subdirectory(plugins) 0126 add_subdirectory(doc) 0127 0128 add_subdirectory(tools EXCLUDE_FROM_ALL) 0129 0130 ############### VCS revision number in vcsversion.h ############### 0131 0132 add_custom_target(vcsversion 0133 ALL 0134 COMMENT "Checking VCS version" 0135 VERBATIM 0136 COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/vcsversion.sh ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${VERSION} 0137 ) 0138 0139 ########### Code formatting ############### 0140 0141 file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h *.c) 0142 kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES}) 0143 0144 # ########### documentation ############### 0145 # 0146 # if (HAVE_APIDOX) 0147 # add_custom_target(apidox 0148 # COMMENT "Generating API documentation in ${CMAKE_CURRENT_BINARY_DIR}..." 0149 # VERBATIM 0150 # COMMAND sh -c "${KDELIBS_SOURCE_DIR}/doc/api/doxygen.sh --no-modulename --recurse --doxdatadir=${KDELIBS_SOURCE_DIR}/doc/common ${CMAKE_CURRENT_SOURCE_DIR}; echo 'API documentation at file://${CMAKE_CURRENT_BINARY_DIR}/apidocs/index.html';") 0151 # endif (HAVE_APIDOX) 0152 0153 ############### Logging ############### 0154 0155 ecm_qt_install_logging_categories( 0156 EXPORT kookalogging 0157 FILE kooka.categories 0158 DESTINATION "${KDE_INSTALL_LOGGINGCATEGORIESDIR}") 0159 0160 ############### Configuration information ############### 0161 0162 feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)