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     if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${dir}/metadata.json")
0044         install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/${dir}/metadata.json" DESTINATION ${KDE_INSTALL_DATADIR}/${install_dir}/${root}/${component})
0045     endif()
0046 
0047    get_target_property(kpackagetool_cmd KF6::kpackagetool6 LOCATION)
0048    if (${component} MATCHES "^.+\\..+\\.") #we make sure there's at least 2 dots
0049         set(APPDATAFILE "${CMAKE_CURRENT_BINARY_DIR}/${component}.appdata.xml")
0050 
0051         execute_process(
0052             COMMAND ${kpackagetool_cmd} --appstream-metainfo ${CMAKE_CURRENT_SOURCE_DIR}/${dir} --appstream-metainfo-output ${APPDATAFILE}
0053             ERROR_VARIABLE appstreamerror
0054             RESULT_VARIABLE result)
0055         if (NOT result EQUAL 0)
0056             message(WARNING "couldn't generate metainfo for ${component}: ${appstreamerror}")
0057         else()
0058             if(appstreamerror)
0059                 message(WARNING "warnings during generation of metainfo for ${component}: ${appstreamerror}")
0060             endif()
0061 
0062             # OPTIONAL because json files can be NoDisplay so they render no XML
0063             install(FILES ${APPDATAFILE} DESTINATION ${KDE_INSTALL_METAINFODIR} OPTIONAL)
0064         endif()
0065    else()
0066         message(DEBUG "KPackage components should be specified in reverse domain notation. Appstream information won't be generated for ${component}.")
0067    endif()
0068 endfunction()