Warning, /frameworks/kauth/src/ConfigureChecks.cmake is written in an unsupported language. File is not indexed.
0001 ####### checks for kdecore/kauth ############### 0002 0003 set(KAUTH_BACKEND_NAME "" CACHE STRING "Specifies the KAuth backend to build. Current available options are 0004 PolkitQt${QT_MAJOR_VERSION}-1, Fake, OSX. Not setting this variable will build the most 0005 appropriate backend for your system") 0006 0007 # Case-insensitive 0008 string(TOUPPER "${KAUTH_BACKEND_NAME}" KAUTH_BACKEND_NAME) 0009 0010 set(KAUTH_BACKEND ${KAUTH_BACKEND_NAME}) 0011 0012 set(POLKITQT_MIN_VERSION 0.112.0 PARENT_SCOPE) 0013 0014 ## Check if the user did not specify a backend to be built. If that is the case, 0015 ## we check what is the best backend to build on this system. 0016 if(NOT KAUTH_BACKEND) 0017 # Look for the most appropriate backend 0018 message(STATUS "No backend for KAuth was explicitly specified: probing system to find the best one available") 0019 if(APPLE) 0020 set(KAUTH_BACKEND "OSX") 0021 elseif(UNIX) 0022 find_package(PolkitQt${QT_MAJOR_VERSION}-1 ${POLKITQT_MIN_VERSION}) 0023 0024 if(PolkitQt${QT_MAJOR_VERSION}-1_FOUND) 0025 set(KAUTH_BACKEND "POLKITQT${QT_MAJOR_VERSION}-1") 0026 0027 set_package_properties(PolkitQt${QT_MAJOR_VERSION}-1 PROPERTIES 0028 URL "http://techbase.kde.org/Polkit-Qt-1" 0029 DESCRIPTION "PolicyKit API for Qt" 0030 TYPE RECOMMENDED 0031 PURPOSE "Support for executing privileged actions in a controlled way (KAuth)" 0032 ) 0033 else() 0034 set(KAUTH_BACKEND "FAKE") 0035 endif() 0036 else() 0037 set(KAUTH_BACKEND "FAKE") 0038 endif() 0039 0040 elseif(KAUTH_BACKEND AND NOT KAUTH_BUILD_CODEGENERATOR_ONLY) 0041 # Check if the specified backend is valid. If it is not, we fall back to the FAKE one 0042 if(NOT KAUTH_BACKEND STREQUAL "OSX" 0043 AND NOT KAUTH_BACKEND STREQUAL "POLKITQT${QT_MAJOR_VERSION}-1" 0044 AND NOT KAUTH_BACKEND STREQUAL "FAKE") 0045 message("WARNING: The KAuth Backend ${KAUTH_BACKEND} you specified does not exist. Falling back to Fake backend") 0046 set(KAUTH_BACKEND "FAKE") 0047 endif() 0048 0049 # Check requirements for each backend. If not, fall back to the fake one 0050 if(KAUTH_BACKEND STREQUAL "OSX" AND NOT APPLE) 0051 message("WARNING: You chose the OSX KAuth backend but your system does not support it. Falling back to Fake backend") 0052 set(KAUTH_BACKEND "FAKE") 0053 endif() 0054 0055 if(KAUTH_BACKEND STREQUAL "POLKITQT${QT_MAJOR_VERSION}-1") 0056 find_package(PolkitQt${QT_MAJOR_VERSION}-1 ${POLKITQT_MIN_VERSION}) 0057 set_package_properties(PolkitQt${QT_MAJOR_VERSION}-1 PROPERTIES 0058 URL "http://techbase.kde.org/Polkit-Qt-1" 0059 DESCRIPTION "PolicyKit API for Qt" 0060 TYPE RECOMMENDED 0061 PURPOSE "Support for executing privileged actions in a controlled way (KAuth). This is required to make KAuth work, and hence enable certain workspace functionalities" 0062 ) 0063 if(NOT PolkitQt${QT_MAJOR_VERSION}-1_FOUND) 0064 message("WARNING: You chose the PolkitQt${QT_MAJOR_VERSION}-1 KAuth backend but you don't have PolkitQt${QT_MAJOR_VERSION}-1 installed. 0065 Falling back to Fake backend") 0066 set(KAUTH_BACKEND "FAKE") 0067 endif() 0068 endif() 0069 endif() 0070 0071 set(KAUTH_BACKEND_NAME ${KAUTH_BACKEND} CACHE STRING "Specifies the KAuth backend to build. Current available options are 0072 PolkitQt${QT_MAJOR_VERSION}-1, Fake, OSX. Not setting this variable will build the most 0073 appropriate backend for your system" FORCE) 0074 0075 # Add the correct libraries depending on the backend, and eventually set the policy files install location 0076 if(KAUTH_BACKEND_NAME STREQUAL "OSX") 0077 find_library(CORE_FOUNDATION_LIBRARY CoreFoundation) 0078 find_library(SECURITY_LIBRARY Security) 0079 0080 message(STATUS "Building OSX KAuth backend") 0081 0082 set(KAUTH_BACKEND_SRCS 0083 backends/mac/AuthServicesBackend.cpp 0084 ) 0085 0086 set(KAUTH_BACKEND_LIBS ${SECURITY_LIBRARY} Qt${QT_MAJOR_VERSION}::Core) 0087 elseif(KAUTH_BACKEND_NAME STREQUAL "POLKITQT${QT_MAJOR_VERSION}-1") 0088 message(STATUS "Building PolkitQt${QT_MAJOR_VERSION}-1 KAuth backend") 0089 0090 include_directories(SYSTEM ${POLKITQT-1_INCLUDE_DIR}) 0091 0092 set(KAUTH_BACKEND_SRCS 0093 backends/polkit-1/Polkit1Backend.cpp 0094 ) 0095 0096 set(KAUTH_BACKEND_LIBS ${POLKITQT-1_CORE_LIBRARY} Qt${QT_MAJOR_VERSION}::DBus Qt${QT_MAJOR_VERSION}::Widgets KF5::AuthCore) 0097 0098 # POLKITQT-1_POLICY_FILES_INSTALL_DIR has an absolute pathname, fix that. 0099 if(PolkitQt${QT_MAJOR_VERSION}-1_FOUND) 0100 string(REPLACE ${POLKITQT-1_INSTALL_DIR} 0101 ${CMAKE_INSTALL_PREFIX} _KAUTH_POLICY_FILES_INSTALL_DIR 0102 ${POLKITQT-1_POLICY_FILES_INSTALL_DIR}) 0103 endif() 0104 0105 set(KAUTH_POLICY_FILES_INSTALL_DIR ${_KAUTH_POLICY_FILES_INSTALL_DIR} CACHE STRING 0106 "Where policy files generated by KAuth will be installed" FORCE) 0107 elseif(KAUTH_BACKEND_NAME STREQUAL "FAKE") 0108 set(KAUTH_COMPILING_FAKE_BACKEND TRUE) 0109 0110 message(STATUS "Building Fake KAuth backend") 0111 message("WARNING: No valid KAuth backends will be built. The library will not work properly unless compiled with 0112 a working backend") 0113 endif() 0114 0115 # KAuth policy generator executable source probing 0116 set(KAUTH_POLICY_GEN_SRCS 0117 policy-gen/policy-gen.cpp) 0118 set(KAUTH_POLICY_GEN_LIBRARIES) 0119 0120 if(KAUTH_BACKEND_NAME STREQUAL "OSX") 0121 set(KAUTH_POLICY_GEN_SRCS ${KAUTH_POLICY_GEN_SRCS} 0122 backends/mac/kauth-policy-gen-mac.cpp) 0123 set(KAUTH_POLICY_GEN_LIBRARIES ${KAUTH_POLICY_GEN_LIBRARIES} ${CORE_FOUNDATION_LIBRARY} ${SECURITY_LIBRARY} Qt${QT_MAJOR_VERSION}::Core) 0124 elseif(KAUTH_BACKEND_NAME STREQUAL "POLKITQT${QT_MAJOR_VERSION}-1") 0125 set(KAUTH_POLICY_GEN_SRCS ${KAUTH_POLICY_GEN_SRCS} 0126 backends/polkit-1/kauth-policy-gen-polkit1.cpp) 0127 set(KAUTH_POLICY_GEN_LIBRARIES ${KAUTH_POLICY_GEN_LIBRARIES} 0128 Qt${QT_MAJOR_VERSION}::Core) 0129 endif() 0130 0131 ######################## 0132 # Helper backend probing 0133 0134 set(KAUTH_HELPER_BACKEND_NAME "" CACHE STRING "Specifies the KAuth helper backend to build. Current available options are 0135 DBus, Fake. Not setting this variable will build the most appropriate backend for your system") 0136 0137 set(KAUTH_HELPER_BACKEND ${KAUTH_HELPER_BACKEND_NAME}) 0138 0139 if(NOT KAUTH_HELPER_BACKEND) 0140 # No checks needed, just set the dbus backend 0141 set(KAUTH_HELPER_BACKEND "DBus") 0142 string(TOUPPER ${KAUTH_HELPER_BACKEND} KAUTH_HELPER_BACKEND_UPPER) 0143 set(KAUTH_HELPER_BACKEND ${KAUTH_HELPER_BACKEND_UPPER}) 0144 else() 0145 # No checks needed here either 0146 string(TOUPPER ${KAUTH_HELPER_BACKEND} KAUTH_HELPER_BACKEND_UPPER) 0147 set(KAUTH_HELPER_BACKEND ${KAUTH_HELPER_BACKEND_UPPER}) 0148 endif() 0149 0150 set(KAUTH_HELPER_BACKEND_NAME ${KAUTH_HELPER_BACKEND} CACHE STRING "Specifies the KAuth helper backend to build. Current 0151 available options are DBus, Fake. Not setting this variable will 0152 build the most appropriate backend for your system" FORCE) 0153 0154 # Add the correct libraries/files depending on the backend 0155 if(KAUTH_HELPER_BACKEND_NAME STREQUAL "DBUS") 0156 qt_add_dbus_adaptor(kauth_dbus_adaptor_SRCS 0157 backends/dbus/org.kde.kf5auth.xml 0158 backends/dbus/DBusHelperProxy.h 0159 KAuth::DBusHelperProxy) 0160 0161 set(KAUTH_HELPER_BACKEND_SRCS 0162 backends/dbus/DBusHelperProxy.cpp 0163 ${kauth_dbus_adaptor_SRCS} 0164 ) 0165 0166 set(KAUTH_HELPER_BACKEND_LIBS Qt${QT_MAJOR_VERSION}::DBus KF5::AuthWidgets KF5::AuthCore) 0167 0168 # Install some files as well 0169 install(FILES backends/dbus/org.kde.kf5auth.conf 0170 DESTINATION ${KDE_INSTALL_DBUSDIR}/system.d) 0171 0172 install(FILES backends/dbus/dbus_policy.stub 0173 backends/dbus/dbus_service.stub 0174 DESTINATION ${KDE_INSTALL_DATADIR_KF}/kauth COMPONENT Devel) 0175 elseif(KAUTH_HELPER_BACKEND_NAME STREQUAL "FAKE") 0176 message("WARNING: No valid KAuth helper backends will be built. The library will not work properly unless compiled with 0177 a working backend") 0178 endif() 0179 0180 0181 set(_kf_prefix) 0182 if (QT_MAJOR_VERSION STREQUAL "6") 0183 set(_kf_prefix "kf6/") 0184 endif() 0185 # Set directories for plugins 0186 if(NOT WIN32) 0187 0188 # ### 0189 # WARNING Copied from KDE4Internal. Decide whether this should be fixed in 0190 # CMake or in ECM: 0191 # ### 0192 0193 # This macro implements some very special logic how to deal with the cache. 0194 # By default the various install locations inherit their value from their "parent" variable 0195 # so if you set CMAKE_INSTALL_PREFIX, then EXEC_INSTALL_PREFIX, PLUGIN_INSTALL_DIR will 0196 # calculate their value by appending subdirs to CMAKE_INSTALL_PREFIX . 0197 # This would work completely without using the cache. 0198 # But if somebody wants e.g. a different EXEC_INSTALL_PREFIX this value has to go into 0199 # the cache, otherwise it will be forgotten on the next cmake run. 0200 # Once a variable is in the cache, it doesn't depend on its "parent" variables 0201 # anymore and you can only change it by editing it directly. 0202 # this macro helps in this regard, because as long as you don't set one of the 0203 # variables explicitly to some location, it will always calculate its value from its 0204 # parents. So modifying CMAKE_INSTALL_PREFIX later on will have the desired effect. 0205 # But once you decide to set e.g. EXEC_INSTALL_PREFIX to some special location 0206 # this will go into the cache and it will no longer depend on CMAKE_INSTALL_PREFIX. 0207 # 0208 # additionally if installing to the same location as kdelibs, the other install 0209 # directories are reused from the installed kdelibs 0210 macro(_SET_FANCY _var _value _comment) 0211 set(predefinedvalue "${_value}") 0212 if(NOT DEFINED ${_var}) 0213 set(${_var} ${predefinedvalue}) 0214 else() 0215 set(${_var} "${${_var}}" CACHE PATH "${_comment}") 0216 endif() 0217 endmacro() 0218 _set_fancy(KAUTH_HELPER_PLUGIN_DIR "${_kf_prefix}kauth/helper" "Where KAuth's helper plugin will be installed") 0219 _set_fancy(KAUTH_BACKEND_PLUGIN_DIR "${_kf_prefix}kauth/backend" "Where KAuth's backend plugin will be installed") 0220 #set(KAUTH_OTHER_PLUGIN_DIR "${QT_PLUGINS_DIR}/kauth/plugins") 0221 else() 0222 set(KAUTH_HELPER_PLUGIN_DIR "${_kf_prefix}kauth/helper") 0223 set(KAUTH_BACKEND_PLUGIN_DIR "${_kf_prefix}kauth/backend") 0224 endif() 0225 0226 ## End