Warning, /graphics/libksane/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 cmake_minimum_required(VERSION 3.16.0)
0002 
0003 # KDE Applications version, managed by release script.
0004 set(RELEASE_SERVICE_VERSION_MAJOR "24")
0005 set(RELEASE_SERVICE_VERSION_MINOR "01")
0006 set(RELEASE_SERVICE_VERSION_MICRO "95")
0007 set(RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
0008 
0009 project(KSane VERSION ${RELEASE_SERVICE_VERSION})
0010 
0011 message(STATUS "-------------------------------------------")
0012 message(STATUS "Starting CMake configuration for: libksane")
0013 
0014 # ECM setup (Extended Cmake Modules)
0015 include(FeatureSummary)
0016 set(KF5_VERSION "5.90.0")
0017 find_package(ECM ${KF5_VERSION} REQUIRED NO_MODULE)
0018 set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules")
0019 # ECM setup2 and include find same cmake module (copied from /usr/share/kde4/apps/cmake/modules/FindSane.cmake)
0020 set(CMAKE_MODULE_PATH ${KSane_SOURCE_DIR}/cmake-modules ${ECM_MODULE_PATH})
0021 
0022 include(KDEInstallDirs)
0023 include(KDECMakeSettings)
0024 include(KDECompilerSettings NO_POLICY_SCOPE)
0025 
0026 include(FeatureSummary)
0027 include(ECMSetupVersion)
0028 include(ECMGenerateHeaders)
0029 include(ECMInstallIcons)
0030 include(CMakePackageConfigHelpers)
0031 include(CheckFunctionExists)
0032 include(ECMGenerateExportHeader)
0033 include(ECMQtDeclareLoggingCategory)
0034 
0035 if (QT_MAJOR_VERSION STREQUAL "5")
0036     set(KSANEWIDGETS_INSTALL_INCLUDEDIR "${KDE_INSTALL_INCLUDEDIR_KF}/KSane")
0037     set(KSANEWIDGETS_CMAKECONFIG_NAME "KF5Sane")
0038     set(LIBRARYFILE_NAME "KF5Sane")
0039     set(TARGET_EXPORT_NAME "Sane")
0040     set(TARGET_EXPORT_NAMESPACE_NAME "KF5::")
0041     set(SOVERSION 6)
0042     set(KSANECORE_NAME "KSaneCore")
0043     set(KSANECORE_TARGET "KSane::Core")
0044 else()
0045     set(KSANEWIDGETS_INSTALL_INCLUDEDIR "${KDE_INSTALL_INCLUDEDIR}/KSaneWidgets6")
0046     set(KSANEWIDGETS_CMAKECONFIG_NAME "KSaneWidgets6")
0047     set(LIBRARYFILE_NAME "KSaneWidgets6")
0048     set(TARGET_EXPORT_NAME "KSaneWidgets6")
0049     set(TARGET_EXPORT_NAMESPACE_NAME "")
0050     set(SOVERSION 6)
0051     set(KSANECORE_NAME "KSaneCore6")
0052     set(KSANECORE_TARGET "KSane6::Core")
0053 endif()
0054 
0055 set(ksane_version_header "${CMAKE_CURRENT_BINARY_DIR}/src/ksane_version.h")
0056 ecm_setup_version(
0057   ${RELEASE_SERVICE_VERSION}
0058   VARIABLE_PREFIX KSANE
0059   VERSION_HEADER "${ksane_version_header}"
0060   PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/${KSANEWIDGETS_CMAKECONFIG_NAME}ConfigVersion.cmake"
0061   SOVERSION ${SOVERSION}
0062 )
0063 # Dependencies
0064 set(REQUIRED_QT_VERSION "5.15.2")
0065 if (QT_MAJOR_VERSION STREQUAL "6")
0066     set(QT_REQUIRED_VERSION "6.4.0")
0067     set(KF_MIN_VERSION "5.240.0")
0068     set(KF_MAJOR_VERSION "6")
0069 else()
0070     set(KF_MAJOR_VERSION "5")
0071 endif()
0072 # Required Qt5 components to build this framework
0073 find_package(Qt${QT_MAJOR_VERSION} ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED Core Widgets)
0074 
0075 # Required KF5 frameworks
0076 find_package(KF${KF_MAJOR_VERSION}I18n ${KF5_VERSION} REQUIRED)
0077 
0078 if (NOT WIN32)
0079     find_package(KF${KF_MAJOR_VERSION}WidgetsAddons ${KF5_VERSION} REQUIRED)
0080     find_package(KF${KF_MAJOR_VERSION}TextWidgets ${KF5_VERSION} REQUIRED)
0081 
0082     # Optional KF5 frameworks
0083     find_package(KF${KF_MAJOR_VERSION}Wallet ${KF5_VERSION})
0084     set_package_properties(KF${KF_MAJOR_VERSION}Wallet PROPERTIES DESCRIPTION "Safe desktop-wide storage for passwords" TYPE OPTIONAL
0085         PURPOSE "Required to have permanent storage of passwords for scanners"
0086     )
0087 
0088     # Check if sane API is available.
0089     find_package(${KSANECORE_NAME} "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}" REQUIRED)
0090     add_subdirectory(src)
0091     if (BUILD_TESTING)
0092         add_subdirectory(autotests)
0093         add_subdirectory(tests)
0094     endif()
0095 else ()
0096     add_subdirectory(ksanetwain)
0097 endif()
0098 
0099 add_definitions(
0100     -DQT_NO_CAST_TO_ASCII
0101     -DQT_NO_CAST_FROM_ASCII
0102     -DQT_NO_URL_CAST_FROM_STRING
0103     -DQT_NO_CAST_FROM_BYTEARRAY
0104     -DQT_NO_KEYWORDS
0105     -DQT_USE_QSTRINGBUILDER
0106     -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT
0107     -DQT_STRICT_ITERATORS
0108 )
0109 add_definitions(
0110     -DQT_DISABLE_DEPRECATED_BEFORE=0x050F02
0111     -DQT_DEPRECATED_WARNINGS_SINCE=0x060000
0112     -DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055800
0113     -DKF_DEPRECATED_WARNINGS_SINCE=0x060000
0114 )
0115 
0116 # Create a Config.cmake and a ConfigVersion.cmake file and install them
0117 set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/${KSANEWIDGETS_CMAKECONFIG_NAME}")
0118 
0119 configure_package_config_file(
0120   "${CMAKE_CURRENT_SOURCE_DIR}/KF5SaneConfig.cmake.in"
0121   "${CMAKE_CURRENT_BINARY_DIR}/${KSANEWIDGETS_CMAKECONFIG_NAME}Config.cmake"
0122   INSTALL_DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
0123 )
0124 
0125 install(FILES
0126   "${CMAKE_CURRENT_BINARY_DIR}/${KSANEWIDGETS_CMAKECONFIG_NAME}Config.cmake"
0127   "${CMAKE_CURRENT_BINARY_DIR}/${KSANEWIDGETS_CMAKECONFIG_NAME}ConfigVersion.cmake"
0128   DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
0129   COMPONENT Devel
0130 )
0131 
0132 install(EXPORT
0133   KSaneWidgetsTargets
0134   DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
0135   FILE ${KSANEWIDGETS_CMAKECONFIG_NAME}Targets.cmake
0136   NAMESPACE ${TARGET_EXPORT_NAMESPACE_NAME}
0137 )
0138 
0139 install(FILES
0140   "${ksane_version_header}"
0141   DESTINATION ${KSANEWIDGETS_INSTALL_INCLUDEDIR}
0142   COMPONENT Devel
0143 )
0144 
0145 ki18n_install(po)
0146 
0147 # =======================================================
0148 
0149 # To prevent warnings from M$ compiler
0150 IF(WIN32 AND MSVC)
0151     ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
0152     ADD_DEFINITIONS(-D_ATL_SECURE_NO_WARNINGS)
0153     ADD_DEFINITIONS(-D_AFX_SECURE_NO_WARNINGS)
0154 ENDIF(WIN32 AND MSVC)
0155 
0156 # =======================================================
0157 
0158 feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)