Warning, /office/kexi/src/data/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 # Adds app icons, updates target sources for kexi target
0002 macro(kexi_add_app_icons)
0003     set(_sizes 16 32 48 64 128 256)
0004     if(NOT APPLE)
0005         # Add larger icons. Not on Mac because iconutil is limited to 256x256 on at least
0006         # OS X 10.9; that size is probably large enough not to bother testing for OS version here.
0007         list(APPEND _sizes 512 1024)
0008     endif()
0009     unset(_copy_commands)
0010     unset(_source_files)
0011     unset(_files)
0012     foreach(_size ${_sizes})
0013         list(APPEND _copy_commands
0014              COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/data/${_size}-apps-kexi.png
0015              ${CMAKE_CURRENT_BINARY_DIR}/data/${_size}-apps-kexi-${KEXI_DISTRIBUTION_VERSION}.png)
0016         list(APPEND _source_files ${CMAKE_CURRENT_SOURCE_DIR}/data/${_size}-apps-kexi.png)
0017         list(APPEND _files ${CMAKE_CURRENT_BINARY_DIR}/data/${_size}-apps-kexi-${KEXI_DISTRIBUTION_VERSION}.png)
0018     endforeach()
0019     add_custom_target(copy_app_icons ${_copy_commands}
0020         DEPENDS "${_source_files}"
0021         SOURCES "${_source_files}"
0022         COMMENT "Preparing app icon files for version ${KEXI_DISTRIBUTION_VERSION}"
0023         VERBATIM
0024     )
0025     add_dependencies(kexi copy_app_icons)
0026     ecm_add_app_icon(
0027         _source_var ICONS ${_source_files}) # Win/Mac: still install copied KEXI files (_files)
0028                                             # BUT add the original ones (_source_files) to the binary
0029                                             # because the copied ones do not exist yet before
0030                                             # ecm_add_app_icon() gets called
0031     ecm_install_icons(ICONS ${_files}
0032                       DESTINATION ${KDE_INSTALL_ICONDIR}
0033                       THEME hicolor)
0034     target_sources(kexi PRIVATE ${_source_var})
0035     unset(_files)
0036     unset(_source_files)
0037     unset(_sizes)
0038     unset(_source_var)
0039 endmacro()
0040 
0041 # Adds metadata files to the source_var list
0042 macro(kexi_add_app_metadata_files source_var)
0043 
0044     # Check if the <binary> tag has proper binary version.
0045     set(_appdata ${CMAKE_CURRENT_SOURCE_DIR}/data/org.kde.kexi.appdata.xml)
0046     file(READ ${_appdata} _content)
0047     set(_binary_spec "<binary>kexi-${KEXI_DISTRIBUTION_VERSION}</binary>")
0048     string(FIND "${_content}" "${_binary_spec}" _pos)
0049     if(${_pos} EQUAL -1)
0050         message(FATAL_ERROR "Missing or invalid specification of KEXI binary \"${_binary_spec}\" in \"${_appdata}\". Please fix it.")
0051     endif()
0052     set(_binary_spec "<id>org.kde.kexi-${KEXI_DISTRIBUTION_VERSION}</id>")
0053     string(FIND "${_content}" "${_binary_spec}" _pos)
0054     if(${_pos} EQUAL -1)
0055         message(FATAL_ERROR "Missing or invalid specification of KEXI binary \"${_binary_spec}\" in \"${_appdata}\". Please fix it.")
0056     endif()
0057     unset(_binary_spec)
0058     unset(_pos)
0059 
0060     # Keep org.kde.kexi.appdata.xml in-source to satisfy the kde.org/applications scanner.
0061     # Then install with proper coinstallable name org.kde.kexi-${KEXI_DISTRIBUTION_VERSION}.appdata.xml.
0062     install(FILES ${_appdata}
0063             RENAME org.kde.kexi-${KEXI_DISTRIBUTION_VERSION}.appdata.xml
0064             DESTINATION ${KDE_INSTALL_METAINFODIR})
0065     install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/data/org.kde.kexi.desktop
0066             RENAME org.kde.kexi-${KEXI_DISTRIBUTION_VERSION}.desktop
0067             DESTINATION ${KDE_INSTALL_APPDIR})
0068 endmacro()