Warning, /utilities/krusader/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 cmake_minimum_required(VERSION 3.16)
0002 
0003 project(krusader)
0004 
0005 set(VERSION "2.9.0-dev")
0006 set(RELEASE_NAME "Bleeding Edge")
0007 
0008 set(MIN_QT_VERSION 5.12)
0009 set(MIN_KF_VERSION 5.68)
0010 
0011 
0012 # ===== Packages =====
0013 
0014 find_package(ECM ${MIN_KF_VERSION} REQUIRED NO_MODULE)
0015 set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
0016 set(KDE_COMPILERSETTINGS_LEVEL "5.68")
0017 
0018 include(KDEInstallDirs)
0019 include(KDECMakeSettings)
0020 include(KDECompilerSettings NO_POLICY_SCOPE)
0021 include(KDEClangFormat)
0022 include(KDEGitCommitHooks)
0023 
0024 include(ECMInstallIcons)
0025 include(ECMAddAppIcon)
0026 
0027 include(FeatureSummary)
0028 include(CheckIncludeFiles)
0029 
0030 find_package(Qt5 ${MIN_QT_VERSION} CONFIG REQUIRED
0031   Concurrent
0032   Core
0033   Gui
0034   DBus
0035   Widgets
0036   PrintSupport
0037   Xml
0038 )
0039 
0040 find_package(KF5 ${MIN_KF_VERSION} REQUIRED COMPONENTS
0041   Archive
0042   Bookmarks
0043   Codecs
0044   Completion
0045   CoreAddons
0046   Config
0047   DocTools
0048   I18n
0049   IconThemes
0050   ItemViews
0051   KIO
0052   Notifications
0053   Parts
0054   Solid
0055   TextWidgets
0056   Wallet
0057   WidgetsAddons
0058   WindowSystem
0059   XmlGui
0060   GuiAddons
0061 )
0062 
0063 
0064 # ===== Get GIT revision =====
0065 
0066 execute_process(COMMAND git log --pretty=format:%h -n 1
0067                 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
0068                 OUTPUT_VARIABLE GIT_REVISION
0069                 ERROR_QUIET)
0070 
0071 # ===== Definitions =====
0072 
0073 # Synchronizer is enabled by default, unless disabled from the command line (-DENABLE_SYNCHRONIZER=OFF)
0074 option(ENABLE_SYNCHRONIZER "Enable Synchronizer" ON)
0075 
0076 # If an old setting is being used, use the setting that complies with the structure of other Krusader settings.
0077 if(ENABLE_SYNCHRONIZER)
0078     set(SYNCHRONIZER_ENABLED TRUE)
0079     add_definitions(-DSYNCHRONIZER_ENABLED)
0080 else()
0081     set(SYNCHRONIZER_ENABLED FALSE)
0082 endif()
0083 
0084 # For security reasons, absolute kdesu path is set at build time and is not configurable.
0085 if(NOT KDESU_PATH)
0086     if(EXISTS "${KDE_INSTALL_FULL_LIBDIR}/kf5/kdesu")
0087       # Used by Arch distribution
0088       set(KDESU_PATH "${KDE_INSTALL_FULL_LIBDIR}/kf5/kdesu")
0089     else()
0090       set(KDESU_PATH "${KDE_INSTALL_FULL_LIBEXECDIR_KF5}/kdesu")
0091     endif()
0092 endif()
0093 add_definitions(-DKDESU_PATH="${KDESU_PATH}")
0094 message(STATUS "kdesu path has been hard-coded: ${KDESU_PATH}")
0095 
0096 add_definitions(${QT_DEFINITIONS} ${KF5_DEFINITIONS})
0097 
0098 add_definitions(-DKRARC_ENABLED)
0099 add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
0100 
0101 # Enable Krarc query, since MIN_KF_VERSION >= 5.23
0102 add_definitions(-DKRARC_QUERY_ENABLED)
0103 
0104 
0105 # ===== Additional checks =====
0106 
0107 if (NOT CMAKE_INSTALL_PREFIX MATCHES "^/usr(/local)?/?$" AND NOT DEFINED KDE_INSTALL_QTPLUGINDIR
0108         AND NOT DEFINED KDE_INSTALL_USE_QT_SYS_PATHS)
0109     message(WARNING "CMAKE_INSTALL_PREFIX is not set to a standard location (/usr or /usr/local), \
0110                      krarc:/ protocol may not work. To force installing plugins into standard location \
0111                      use -DKDE_INSTALL_USE_QT_SYS_PATHS=true")
0112 endif()
0113 
0114 
0115 # ===== ACL support =====
0116 
0117 check_include_files(attr/libattr.h HAVE_ATTR_LIBATTR_H)
0118 check_include_files(sys/xattr.h HAVE_SYS_XATTR_H)
0119 check_include_files(sys/acl.h HAVE_SYS_ACL_H)
0120 check_include_files(acl/libacl.h HAVE_ACL_LIBACL_H)
0121 
0122 if (HAVE_ATTR_LIBATTR_H AND HAVE_SYS_XATTR_H AND HAVE_SYS_ACL_H AND HAVE_ACL_LIBACL_H)
0123     set(ACL_HEADERS_FOUND TRUE)
0124 endif(HAVE_ATTR_LIBATTR_H AND HAVE_SYS_XATTR_H AND HAVE_SYS_ACL_H AND HAVE_ACL_LIBACL_H)
0125 
0126 if (ACL_HEADERS_FOUND)
0127     find_library(ACL_LIBS NAMES acl)
0128     find_library(ATTR_LIBS NAMES attr)
0129 endif(ACL_HEADERS_FOUND)
0130 
0131 if (ACL_HEADERS_FOUND AND ACL_LIBS AND ATTR_LIBS)
0132     set(ACL_FOUND TRUE)
0133     set(ACL_LIBS ${ACL_LIBS} ${ATTR_LIBS})
0134     message(STATUS "Found ACL support: ${ACL_LIBS}")
0135     add_definitions(-DHAVE_POSIX_ACL)
0136 endif(ACL_HEADERS_FOUND AND ACL_LIBS AND ATTR_LIBS)
0137 
0138 
0139 # ===== Compile options =====
0140 
0141 if (CMAKE_COMPILER_IS_GNUCXX)
0142     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fno-common -ansi -Wpedantic -Wconversion -Wpointer-arith \
0143                          -Wcast-qual -Wcast-align -Wwrite-strings -Wsuggest-override -Wfloat-equal \
0144                          -Woverloaded-virtual -Wundef -Wlogical-op -Wuninitialized -Wredundant-decls -Wnoexcept \
0145                          -Wnon-virtual-dtor -Wctor-dtor-privacy -Wzero-as-null-pointer-constant" CACHE STRING "" FORCE)
0146 endif()
0147 
0148 
0149 # ===== Subdirectories =====
0150 
0151 add_subdirectory(app)
0152 add_subdirectory(doc/handbook)
0153 add_subdirectory(plugins/iso)
0154 add_subdirectory(plugins/krarc)
0155 
0156 
0157 # ===== Translations =====
0158 
0159 ki18n_install(po)
0160 kdoctools_install(po)
0161 
0162 # ==== clang-format target and commit hook ====
0163 
0164 file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h)
0165 kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
0166 
0167 kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
0168 
0169 # ===== Output configuration =====
0170 
0171 feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)