Warning, /frameworks/kpackage/KF6PackageMacros.cmake is written in an unsupported language. File is not indexed.
0001 # To not mess up the ECM_FIND_VERSION we only include ECM if the required variables are not set 0002 if (NOT KDE_INSTALL_DATADIR OR NOT KDE_INSTALL_METAINFODIR) 0003 find_package(ECM 5.83.0 CONFIG REQUIRED) 0004 include(${ECM_KDE_MODULE_DIR}/KDEInstallDirs.cmake) 0005 endif() 0006 set(KPACKAGE_RELATIVE_DATA_INSTALL_DIR "kpackage") 0007 0008 # kpackage_install_package(path componentname [root] [install_dir]) 0009 # 0010 # Installs a package to the system path 0011 # @arg path The source path to install from, location of metadata.json 0012 # @arg componentname The plugin id of the component, corresponding to the 0013 # Id key of the KPlugin object in metadata.json 0014 # @arg root The subdirectory to install to, default: packages 0015 # @arg install_dir the path where to install packages, 0016 # such as myapp, that would go under prefix/share/myapp: 0017 # default ${KPACKAGE_RELATIVE_DATA_INSTALL_DIR} 0018 # 0019 # Examples: 0020 # kpackage_install_package(mywidget org.kde.plasma.mywidget plasmoids) # installs an applet 0021 # kpackage_install_package(declarativetoolbox org.kde.toolbox packages) # installs a generic package 0022 # kpackage_install_package(declarativetoolbox org.kde.toolbox) # installs a generic package 0023 # 0024 0025 set(kpackagedir ${CMAKE_CURRENT_LIST_DIR}) 0026 function(kpackage_install_package dir component) 0027 set(root ${ARGV2}) 0028 set(install_dir ${ARGV3}) 0029 if(NOT root) 0030 set(root packages) 0031 endif() 0032 if(NOT install_dir) 0033 set(install_dir ${KPACKAGE_RELATIVE_DATA_INSTALL_DIR}) 0034 endif() 0035 0036 install(DIRECTORY ${dir}/ DESTINATION ${KDE_INSTALL_DATADIR}/${install_dir}/${root}/${component} 0037 PATTERN .svn EXCLUDE 0038 PATTERN *.qmlc EXCLUDE 0039 PATTERN CMakeLists.txt EXCLUDE 0040 PATTERN Messages.sh EXCLUDE 0041 PATTERN dummydata EXCLUDE) 0042 0043 get_target_property(kpackagetool_cmd KF6::kpackagetool6 LOCATION) 0044 if (${component} MATCHES "^.+\\..+\\.") #we make sure there's at least 2 dots 0045 set(APPDATAFILE "${CMAKE_CURRENT_BINARY_DIR}/${component}.appdata.xml") 0046 0047 execute_process( 0048 COMMAND ${kpackagetool_cmd} --appstream-metainfo ${CMAKE_CURRENT_SOURCE_DIR}/${dir} --appstream-metainfo-output ${APPDATAFILE} 0049 ERROR_VARIABLE appstreamerror 0050 RESULT_VARIABLE result) 0051 if (NOT result EQUAL 0) 0052 message(WARNING "couldn't generate metainfo for ${component}: ${appstreamerror}") 0053 else() 0054 if(appstreamerror) 0055 message(WARNING "warnings during generation of metainfo for ${component}: ${appstreamerror}") 0056 endif() 0057 0058 # OPTIONAL because json files can be NoDisplay so they render no XML 0059 install(FILES ${APPDATAFILE} DESTINATION ${KDE_INSTALL_METAINFODIR} OPTIONAL) 0060 endif() 0061 else() 0062 message(DEBUG "KPackage components should be specified in reverse domain notation. Appstream information won't be generated for ${component}.") 0063 endif() 0064 endfunction()