diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,9 +7,6 @@ set(KDEVELOP_VERSION_PATCH 40) set( KDEVELOP_VERSION "${KDEVELOP_VERSION_MAJOR}.${KDEVELOP_VERSION_MINOR}.${KDEVELOP_VERSION_PATCH}" ) -set(KDevPlatform_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/kdevplatform) -set(KDevPlatform_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/kdevplatform) - # plugin versions listed in the .desktop files set(KDEV_PLUGIN_VERSION 29) @@ -112,14 +109,7 @@ add_compile_flag_if_supported(-pedantic) endif() -include_directories( - ${KDevPlatform_SOURCE_DIR} - ${KDevPlatform_SOURCE_DIR}/plugins - ${KDevPlatform_BINARY_DIR} - - ${KDevelop_SOURCE_DIR} - ${KDevelop_BINARY_DIR} -) +include_directories(${KDevelop_SOURCE_DIR} ${KDevelop_BINARY_DIR}) string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_TOLOWER) if(CMAKE_BUILD_TYPE_TOLOWER MATCHES "debug" diff --git a/kdevplatform/CMakeLists.txt b/kdevplatform/CMakeLists.txt --- a/kdevplatform/CMakeLists.txt +++ b/kdevplatform/CMakeLists.txt @@ -10,9 +10,12 @@ # library version / SO version set(KDEVPLATFORM_LIB_SOVERSION 10) +set(KDevPlatform_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +set(KDevPlatform_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(CMAKE_MODULE_PATH ${KDevPlatform_SOURCE_DIR}/cmake/modules ${ECM_MODULE_PATH}) include(KDevPlatformMacros) +include(KDevPlatformMacrosInternal) find_package(Grantlee5 CONFIG) set_package_properties(Grantlee5 PROPERTIES @@ -30,6 +33,8 @@ configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/config-kdevplatform.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kdevplatform.h ) +include_directories(${KDevPlatform_SOURCE_DIR} ${KDevPlatform_BINARY_DIR}) + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_TOLOWER) if(CMAKE_BUILD_TYPE_TOLOWER MATCHES "debug" OR CMAKE_BUILD_TYPE_TOLOWER STREQUAL "") diff --git a/kdevplatform/cmake/modules/KDevPlatformMacros.cmake b/kdevplatform/cmake/modules/KDevPlatformMacros.cmake --- a/kdevplatform/cmake/modules/KDevPlatformMacros.cmake +++ b/kdevplatform/cmake/modules/KDevPlatformMacros.cmake @@ -6,17 +6,22 @@ # KDEVPLATFORM_ADD_APP_TEMPLATES( template1 ... templateN ) # Use this to get packaged template archives for the given app templates. # Parameters should be the directories containing the templates. - +# # KDEVPLATFORM_ADD_FILE_TEMPLATES( template1 ... templateN ) # Use this to get packaged template archives for the given file templates. # Parameters should be the directories containing the templates. # +# KDEVPLATFORM_ADD_PLUGIN( JSON SOURCES [ [...]] [SKIP_INSTALL] ) +# Use this to get create plugins for the KDevPlatform. +# Parameters should be the json file with plugin metadata and the sources of the plugin. +# In case the plugin should not be installed, pass SKIP_INSTALL. +# # Copyright 2007 Andreas Pakulat # Redistribution and use is allowed according to the terms of the BSD license. include(CMakeParseArguments) -# creates a template archive from the given directory +# creates a template archive from the given directory, internal macro(kdevplatform_create_template_archive _templateName) get_filename_component(_tmp_file ${_templateName} ABSOLUTE) get_filename_component(_baseName ${_tmp_file} NAME_WE) @@ -97,37 +102,6 @@ endforeach(_templateName ${ARGV}) endmacro(kdevplatform_add_file_templates _templateNames) -function(kdevplatform_add_library target) - set(options) - set(oneValueArgs) - set(multiValueArgs SOURCES) - cmake_parse_arguments(KDEV_ADD_LIBRARY "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - - string(REPLACE "KDevPlatform" "" shortTargetName ${target}) - if (${shortTargetName} STREQUAL ${target}) - message(FATAL_ERROR "Target passed to kdevplatform_add_library needs to start with \"KDevPlatform\", was \"${target}\"") - endif() - - string(TOLOWER ${shortTargetName} shortTargetNameToLower) - - add_library(${target} ${KDEV_ADD_LIBRARY_SOURCES}) - add_library(KDev::${shortTargetName} ALIAS ${target}) - - generate_export_header(${target} EXPORT_FILE_NAME ${shortTargetNameToLower}export.h) - - target_include_directories(${target} INTERFACE "$") - set_target_properties(${target} PROPERTIES - VERSION ${KDEVPLATFORM_VERSION} - SOVERSION ${KDEVPLATFORM_LIB_SOVERSION} - EXPORT_NAME ${shortTargetName} - ) - - install(TARGETS ${target} EXPORT KDevPlatformTargets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) - install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/${shortTargetNameToLower}export.h - DESTINATION ${KDE_INSTALL_INCLUDEDIR}/kdevplatform/${shortTargetNameToLower} COMPONENT Devel) -endfunction() - function(kdevplatform_add_plugin plugin) set(options SKIP_INSTALL) set(oneValueArgs JSON) diff --git a/kdevplatform/cmake/modules/KDevPlatformMacrosInternal.cmake b/kdevplatform/cmake/modules/KDevPlatformMacrosInternal.cmake new file mode 100644 --- /dev/null +++ b/kdevplatform/cmake/modules/KDevPlatformMacrosInternal.cmake @@ -0,0 +1,50 @@ +# +# KDevelop Platform Private Macros +# +# The following macros are defined here: +# +# KDEVPLATFORM_ADD_LIBRARY( SOURCES [ [...]] ) +# Use this to add libraries part of the KDevPlatform +# +# Copyright 2007 Andreas Pakulat +# Redistribution and use is allowed according to the terms of the BSD license. + +include(CMakeParseArguments) + +function(kdevplatform_add_library target) + set(options) + set(oneValueArgs) + set(multiValueArgs SOURCES) + cmake_parse_arguments(KDEV_ADD_LIBRARY "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + string(REPLACE "KDevPlatform" "" shortTargetName ${target}) + if (${shortTargetName} STREQUAL ${target}) + message(FATAL_ERROR "Target passed to kdevplatform_add_library needs to start with \"KDevPlatform\", was \"${target}\"") + endif() + + string(TOLOWER ${shortTargetName} shortTargetNameToLower) + + add_library(${target} ${KDEV_ADD_LIBRARY_SOURCES}) + add_library(KDev::${shortTargetName} ALIAS ${target}) + + generate_export_header(${target} EXPORT_FILE_NAME ${shortTargetNameToLower}export.h) + + target_include_directories(${target} + INTERFACE "$" + "$" "$" + "$" # useful for the "something.export.h" includes + ) + #some plugins install interfaces such as execute/iexecuteplugin.h + target_include_directories(${target} INTERFACE + "$" "$" ) + set_target_properties(${target} PROPERTIES + VERSION ${KDEVPLATFORM_VERSION} + SOVERSION ${KDEVPLATFORM_LIB_SOVERSION} + EXPORT_NAME ${shortTargetName} + ) + + install(TARGETS ${target} EXPORT KDevPlatformTargets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) + install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/${shortTargetNameToLower}export.h + DESTINATION ${KDE_INSTALL_INCLUDEDIR}/kdevplatform/${shortTargetNameToLower} COMPONENT Devel) +endfunction()