Changeset View
Changeset View
Standalone View
Standalone View
kdevplatform/cmake/modules/KDevPlatformMacros.cmake
1 | # | 1 | # | ||
---|---|---|---|---|---|
2 | # KDevelop Platform Macros | 2 | # KDevelop Platform Macros | ||
3 | # | 3 | # | ||
4 | # The following macros are defined here: | 4 | # The following macros are defined here: | ||
5 | # | 5 | # | ||
6 | # KDEVPLATFORM_ADD_APP_TEMPLATES( template1 ... templateN ) | 6 | # KDEVPLATFORM_ADD_APP_TEMPLATES( template1 ... templateN ) | ||
7 | # Use this to get packaged template archives for the given app templates. | 7 | # Use this to get packaged template archives for the given app templates. | ||
8 | # Parameters should be the directories containing the templates. | 8 | # Parameters should be the directories containing the templates. | ||
9 | 9 | # | |||
10 | # KDEVPLATFORM_ADD_FILE_TEMPLATES( template1 ... templateN ) | 10 | # KDEVPLATFORM_ADD_FILE_TEMPLATES( template1 ... templateN ) | ||
11 | # Use this to get packaged template archives for the given file templates. | 11 | # Use this to get packaged template archives for the given file templates. | ||
12 | # Parameters should be the directories containing the templates. | 12 | # Parameters should be the directories containing the templates. | ||
13 | # | 13 | # | ||
14 | # KDEVPLATFORM_ADD_PLUGIN( <plugin> JSON <jsonfile> SOURCES <src1> [<src2> [...]] [SKIP_INSTALL] ) | ||||
15 | # Use this to get create plugins for the KDevPlatform. | ||||
16 | # Parameters should be the json file with plugin metadata and the sources of the plugin. | ||||
17 | # In case the plugin should not be installed, pass SKIP_INSTALL. | ||||
18 | # | ||||
14 | # Copyright 2007 Andreas Pakulat <apaku@gmx.de> | 19 | # Copyright 2007 Andreas Pakulat <apaku@gmx.de> | ||
15 | # Redistribution and use is allowed according to the terms of the BSD license. | 20 | # Redistribution and use is allowed according to the terms of the BSD license. | ||
16 | 21 | | |||
17 | include(CMakeParseArguments) | 22 | include(CMakeParseArguments) | ||
18 | 23 | | |||
19 | # creates a template archive from the given directory | 24 | # creates a template archive from the given directory, internal | ||
20 | macro(kdevplatform_create_template_archive _templateName) | 25 | macro(kdevplatform_create_template_archive _templateName) | ||
21 | get_filename_component(_tmp_file ${_templateName} ABSOLUTE) | 26 | get_filename_component(_tmp_file ${_templateName} ABSOLUTE) | ||
22 | get_filename_component(_baseName ${_tmp_file} NAME_WE) | 27 | get_filename_component(_baseName ${_tmp_file} NAME_WE) | ||
23 | set(_template ${CMAKE_CURRENT_BINARY_DIR}/${_baseName}.tar.bz2) | 28 | set(_template ${CMAKE_CURRENT_BINARY_DIR}/${_baseName}.tar.bz2) | ||
24 | 29 | | |||
25 | file(GLOB _files "${CMAKE_CURRENT_SOURCE_DIR}/${_templateName}/*") | 30 | file(GLOB _files "${CMAKE_CURRENT_SOURCE_DIR}/${_templateName}/*") | ||
26 | set(_deps) | 31 | set(_deps) | ||
27 | foreach(_file ${_files}) | 32 | foreach(_file ${_files}) | ||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Line(s) | |||||
92 | endmacro(kdevplatform_add_app_templates _templateNames) | 97 | endmacro(kdevplatform_add_app_templates _templateNames) | ||
93 | 98 | | |||
94 | macro(kdevplatform_add_file_templates _templateNames) | 99 | macro(kdevplatform_add_file_templates _templateNames) | ||
95 | foreach(_templateName ${ARGV}) | 100 | foreach(_templateName ${ARGV}) | ||
96 | kdevplatform_add_template(${KDE_INSTALL_DATADIR}/kdevfiletemplates/templates ${_templateName}) | 101 | kdevplatform_add_template(${KDE_INSTALL_DATADIR}/kdevfiletemplates/templates ${_templateName}) | ||
97 | endforeach(_templateName ${ARGV}) | 102 | endforeach(_templateName ${ARGV}) | ||
98 | endmacro(kdevplatform_add_file_templates _templateNames) | 103 | endmacro(kdevplatform_add_file_templates _templateNames) | ||
99 | 104 | | |||
100 | function(kdevplatform_add_library target) | | |||
101 | set(options) | | |||
102 | set(oneValueArgs) | | |||
103 | set(multiValueArgs SOURCES) | | |||
104 | cmake_parse_arguments(KDEV_ADD_LIBRARY "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) | | |||
105 | | ||||
106 | string(REPLACE "KDevPlatform" "" shortTargetName ${target}) | | |||
107 | if (${shortTargetName} STREQUAL ${target}) | | |||
108 | message(FATAL_ERROR "Target passed to kdevplatform_add_library needs to start with \"KDevPlatform\", was \"${target}\"") | | |||
109 | endif() | | |||
110 | | ||||
111 | string(TOLOWER ${shortTargetName} shortTargetNameToLower) | | |||
112 | | ||||
113 | add_library(${target} ${KDEV_ADD_LIBRARY_SOURCES}) | | |||
114 | add_library(KDev::${shortTargetName} ALIAS ${target}) | | |||
115 | | ||||
116 | generate_export_header(${target} EXPORT_FILE_NAME ${shortTargetNameToLower}export.h) | | |||
117 | | ||||
118 | target_include_directories(${target} INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR}/kdevplatform>") | | |||
119 | set_target_properties(${target} PROPERTIES | | |||
120 | VERSION ${KDEVPLATFORM_VERSION} | | |||
121 | SOVERSION ${KDEVPLATFORM_LIB_SOVERSION} | | |||
122 | EXPORT_NAME ${shortTargetName} | | |||
123 | ) | | |||
124 | | ||||
125 | install(TARGETS ${target} EXPORT KDevPlatformTargets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) | | |||
126 | install(FILES | | |||
127 | ${CMAKE_CURRENT_BINARY_DIR}/${shortTargetNameToLower}export.h | | |||
128 | DESTINATION ${KDE_INSTALL_INCLUDEDIR}/kdevplatform/${shortTargetNameToLower} COMPONENT Devel) | | |||
129 | endfunction() | | |||
130 | | ||||
131 | function(kdevplatform_add_plugin plugin) | 105 | function(kdevplatform_add_plugin plugin) | ||
132 | set(options SKIP_INSTALL) | 106 | set(options SKIP_INSTALL) | ||
133 | set(oneValueArgs JSON) | 107 | set(oneValueArgs JSON) | ||
134 | set(multiValueArgs SOURCES) | 108 | set(multiValueArgs SOURCES) | ||
135 | cmake_parse_arguments(KDEV_ADD_PLUGIN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) | 109 | cmake_parse_arguments(KDEV_ADD_PLUGIN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) | ||
136 | 110 | | |||
137 | get_filename_component(json "${KDEV_ADD_PLUGIN_JSON}" REALPATH) | 111 | get_filename_component(json "${KDEV_ADD_PLUGIN_JSON}" REALPATH) | ||
138 | 112 | | |||
Show All 29 Lines |