Warning, /kdevelop/kdevelop/kdevplatform/cmake/modules/KDevPlatformMacros.cmake is written in an unsupported language. File is not indexed.
0001 # 0002 # KDevelop Platform Macros 0003 # 0004 # The following macros are defined here: 0005 # 0006 # KDEVPLATFORM_ADD_APP_TEMPLATES( template1 ... templateN ) 0007 # Use this to get packaged template archives for the given app templates. 0008 # Parameters should be the directories containing the templates. 0009 # 0010 # KDEVPLATFORM_ADD_FILE_TEMPLATES( template1 ... templateN ) 0011 # Use this to get packaged template archives for the given file templates. 0012 # Parameters should be the directories containing the templates. 0013 # 0014 # KDEVPLATFORM_ADD_PLUGIN( <plugin> JSON <jsonfile> SOURCES <src1> [<src2> [...]] [SKIP_INSTALL] ) 0015 # Use this to get create plugins for the KDevPlatform. 0016 # Parameters should be the json file with plugin metadata and the sources of the plugin. 0017 # In case the plugin should not be installed, pass SKIP_INSTALL. 0018 # 0019 # SPDX-FileCopyrightText: 2007 Andreas Pakulat <apaku@gmx.de> 0020 # 0021 # SPDX-License-Identifier: BSD-3-Clause 0022 0023 include(CMakeParseArguments) 0024 0025 # creates a template archive from the given directory, internal 0026 macro(kdevplatform_create_template_archive _templateName) 0027 get_filename_component(_tmp_file ${_templateName} ABSOLUTE) 0028 get_filename_component(_baseName ${_tmp_file} NAME_WE) 0029 set(_template ${CMAKE_CURRENT_BINARY_DIR}/${_baseName}.tar.bz2) 0030 0031 file(GLOB _files "${CMAKE_CURRENT_SOURCE_DIR}/${_templateName}/*") 0032 set(_deps) 0033 foreach(_file ${_files}) 0034 get_filename_component(_fileName ${_file} NAME) 0035 string(COMPARE NOTEQUAL ${_fileName} .kdev_ignore _v1) 0036 string(REGEX MATCH "\\.svn" _v2 ${_fileName} ) 0037 if(WIN32) 0038 string(REGEX MATCH "_svn" _v3 ${_fileName} ) 0039 else() 0040 set(_v3 FALSE) 0041 endif() 0042 if ( _v1 AND NOT _v2 AND NOT _v3 ) 0043 set(_deps ${_deps} ${_file}) 0044 endif ( _v1 AND NOT _v2 AND NOT _v3 ) 0045 endforeach(_file) 0046 list(SORT _deps) 0047 0048 add_custom_target(${_baseName} ALL DEPENDS ${_template}) 0049 0050 if(WIN32) 0051 add_custom_command(OUTPUT ${_template} 0052 COMMAND ${CMAKE_COMMAND} -E tar 0053 ARGS cfvj ${_template} -- ${_deps} 0054 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${_templateName} 0055 DEPENDS ${_deps} 0056 ) 0057 else() 0058 0059 if(APPLE OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") 0060 add_custom_command(OUTPUT ${_template} 0061 COMMAND tar ARGS -c -C ${CMAKE_CURRENT_SOURCE_DIR}/${_templateName} 0062 --exclude .kdev_ignore --exclude .svn --numeric-owner 0063 -j -f ${_template} . 0064 DEPENDS ${_deps} 0065 ) 0066 else() 0067 set(extraArgs "") 0068 if(DEFINED ENV{SOURCE_DATE_EPOCH}) 0069 # We assume there is tar > 1.28 if a reproducible build is wanted. 0070 set(extraArgs --mtime="@$ENV{SOURCE_DATE_EPOCH}" --sort=name 0071 --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime) 0072 endif() 0073 add_custom_command(OUTPUT ${_template} 0074 COMMAND tar ARGS -c -C ${CMAKE_CURRENT_SOURCE_DIR}/${_templateName} 0075 --exclude .kdev_ignore --exclude .svn --mode=go=rX,u+rw,a-s 0076 --owner=0 --group=0 --numeric-owner -j -f ${_template} ${extraArgs} . 0077 DEPENDS ${_deps} 0078 ) 0079 endif() 0080 0081 endif() 0082 0083 0084 endmacro(kdevplatform_create_template_archive _templateName) 0085 0086 # package and install the given directory as a template archive 0087 macro(kdevplatform_add_template _installDirectory _templateName) 0088 kdevplatform_create_template_archive(${_templateName}) 0089 0090 get_filename_component(_tmp_file ${_templateName} ABSOLUTE) 0091 get_filename_component(_baseName ${_tmp_file} NAME_WE) 0092 set(_template ${CMAKE_CURRENT_BINARY_DIR}/${_baseName}.tar.bz2) 0093 0094 install( FILES ${_template} DESTINATION ${_installDirectory}) 0095 GET_DIRECTORY_PROPERTY(_tmp_DIR_PROPS ADDITIONAL_MAKE_CLEAN_FILES ) 0096 list(APPEND _tmp_DIR_PROPS ${_template}) 0097 SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${_tmp_DIR_PROPS}") 0098 endmacro(kdevplatform_add_template _installDirectory _templateName) 0099 0100 macro(kdevplatform_add_app_templates _templateNames) 0101 foreach(_templateName ${ARGV}) 0102 kdevplatform_add_template(${KDE_INSTALL_DATADIR}/kdevappwizard/templates ${_templateName}) 0103 endforeach(_templateName ${ARGV}) 0104 endmacro(kdevplatform_add_app_templates _templateNames) 0105 0106 macro(kdevplatform_add_file_templates _templateNames) 0107 foreach(_templateName ${ARGV}) 0108 kdevplatform_add_template(${KDE_INSTALL_DATADIR}/kdevfiletemplates/templates ${_templateName}) 0109 endforeach(_templateName ${ARGV}) 0110 endmacro(kdevplatform_add_file_templates _templateNames) 0111 0112 function(kdevplatform_add_plugin plugin) 0113 set(options SKIP_INSTALL) 0114 set(multiValueArgs SOURCES) 0115 cmake_parse_arguments(KDEV_ADD_PLUGIN "${options}" "" "${multiValueArgs}" ${ARGN}) 0116 0117 list(LENGTH KDEV_ADD_PLUGIN_SOURCES src_count) 0118 if (NOT ${src_count} GREATER 0) 0119 message(FATAL_ERROR "kdevplatform_add_plugin() called without passing any source files. Please use the SOURCES parameter.") 0120 endif() 0121 0122 add_library(${plugin} MODULE ${KDEV_ADD_PLUGIN_SOURCES}) 0123 0124 if (NOT KDEV_ADD_PLUGIN_SKIP_INSTALL) 0125 install(TARGETS ${plugin} DESTINATION ${KDE_INSTALL_PLUGINDIR}/kdevplatform/${KDEV_PLUGIN_VERSION}) 0126 endif() 0127 endfunction()