Commit 58e19566 authored by Daan De Meyer's avatar Daan De Meyer

Further cleanup addons CMake scripts.

- Update CMake minimum required version to CMake 3.1 which is when
`target_sources` was added.
- Use `target_sources` even when commands that work on
sources variables are used. Instead of appending the generated sources
to an existing sources variable, we store them in a temporary variable
and immediately add them to the corresponding target with
`target_sources`.
- Remove unnecessary dependencies on `kdeinit_kate`.
- Remove the intermediary katefiletree static library and have the tests
build the single required source file manually instead which is
consistent with how the other addons with tests work.
parent 6f3e2231
# minimal requirements
cmake_minimum_required (VERSION 3.0 FATAL_ERROR)
# 3.1 is required for `target_sources`.
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
# Kate project
project (kate)
......
set(katebacktracebrowserplugin_PART_SRCS
katebacktracebrowser.cpp
btparser.cpp
btfileindexer.cpp
btdatabase.cpp
)
set(katebacktracebrowserplugin_PART_UI
btbrowserwidget.ui
btconfigwidget.ui
)
ki18n_wrap_ui(katebacktracebrowserplugin_PART_SRCS ${katebacktracebrowserplugin_PART_UI})
add_library(katebacktracebrowserplugin MODULE ${katebacktracebrowserplugin_PART_SRCS})
add_library(katebacktracebrowserplugin MODULE "")
target_compile_definitions(katebacktracebrowserplugin PRIVATE TRANSLATION_DOMAIN="katebacktracebrowserplugin")
target_link_libraries(katebacktracebrowserplugin PRIVATE KF5::TextEditor)
ki18n_wrap_ui(UI_SRCS btbrowserwidget.ui btconfigwidget.ui)
target_sources(katebacktracebrowserplugin PRIVATE ${UI_SRCS})
target_sources(
katebacktracebrowserplugin
PRIVATE
katebacktracebrowser.cpp
btparser.cpp
btfileindexer.cpp
btdatabase.cpp
)
kcoreaddons_desktop_to_json(katebacktracebrowserplugin katebacktracebrowserplugin.desktop)
install(TARGETS katebacktracebrowserplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor)
......
......@@ -7,7 +7,7 @@ find_package(Qt5Test QUIET REQUIRED)
target_link_libraries(
btbrowser_test
PRIVATE
kdeinit_kate
Qt5::Widgets
Qt5::Test
)
......
......@@ -5,17 +5,7 @@ if(NOT KF5IconThemes_FOUND)
return()
endif()
set(KATE_CLOSE_EXCEPT_PLUGIN_SOURCES
close_confirm_dialog.cpp
close_except_plugin.cpp
plugin.qrc
)
set(KATE_CLOSE_EXCEPT_PLUGIN_UI close_confirm_dialog.ui)
ki18n_wrap_ui(KATE_CLOSE_EXCEPT_PLUGIN_SOURCES ${KATE_CLOSE_EXCEPT_PLUGIN_UI})
add_library(katecloseexceptplugin MODULE ${KATE_CLOSE_EXCEPT_PLUGIN_SOURCES})
add_library(katecloseexceptplugin MODULE "")
target_compile_definitions(katecloseexceptplugin PRIVATE TRANSLATION_DOMAIN="katecloseexceptplugin")
target_link_libraries(
......@@ -25,5 +15,16 @@ target_link_libraries(
KF5::IconThemes
)
ki18n_wrap_ui(UI_SOURCES close_confirm_dialog.ui)
target_sources(katecloseexceptplugin PRIVATE ${UI_SOURCES})
target_sources(
katecloseexceptplugin
PRIVATE
close_confirm_dialog.cpp
close_except_plugin.cpp
plugin.qrc
)
kcoreaddons_desktop_to_json(katecloseexceptplugin katecloseexceptplugin.desktop)
install(TARGETS katecloseexceptplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor)
......@@ -5,14 +5,7 @@ if(NOT KF5KIO_FOUND)
return()
endif()
set(katefilebrowserplugin_PART_SRCS
katefilebrowserplugin.cpp
katefilebrowserconfig.cpp
katefilebrowser.cpp
katebookmarkhandler.cpp
)
add_library(katefilebrowserplugin MODULE ${katefilebrowserplugin_PART_SRCS})
add_library(katefilebrowserplugin MODULE "")
target_compile_definitions(katefilebrowserplugin PRIVATE TRANSLATION_DOMAIN="katefilebrowserplugin")
target_link_libraries(
......@@ -22,5 +15,14 @@ target_link_libraries(
KF5::KIOFileWidgets
)
target_sources(
katefilebrowserplugin
PRIVATE
katefilebrowserplugin.cpp
katefilebrowserconfig.cpp
katefilebrowser.cpp
katebookmarkhandler.cpp
)
kcoreaddons_desktop_to_json(katefilebrowserplugin katefilebrowserplugin.desktop)
install(TARGETS katefilebrowserplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor)
......@@ -5,42 +5,30 @@ if(NOT KF5GuiAddons_FOUND)
return()
endif()
add_library(katefiletree STATIC "")
set_target_properties(katefiletree PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
# PUBLIC so that `katefiletreeplugin` inherits these usage requirements.
target_compile_definitions(katefiletree PUBLIC TRANSLATION_DOMAIN="katefiletree")
add_library(katefiletree MODULE "")
target_compile_definitions(katefiletree PRIVATE TRANSLATION_DOMAIN="katefiletree")
target_link_libraries(
katefiletree
katefiletree
PUBLIC
KF5::TextEditor
KF5::GuiAddons
)
target_sources(
katefiletree
katefiletree
PRIVATE
katefiletree.cpp
katefiletreemodel.cpp
katefiletreeproxymodel.cpp
plugin.qrc
)
add_library(katefiletreeplugin MODULE "")
target_link_libraries(katefiletreeplugin PRIVATE katefiletree)
target_sources(
katefiletreeplugin
PRIVATE
katefiletreeplugin.cpp
katefiletreeconfigpage.cpp
katefiletree.cpp
katefiletreeconfigpage.cpp
katefiletreemodel.cpp
katefiletreeplugin.cpp
katefiletreepluginsettings.cpp
katefiletreeproxymodel.cpp
plugin.qrc
)
kcoreaddons_desktop_to_json(katefiletreeplugin katefiletreeplugin.desktop)
install(TARGETS katefiletreeplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor)
kcoreaddons_desktop_to_json(katefiletree katefiletreeplugin.desktop)
install(TARGETS katefiletree DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor)
if(BUILD_TESTING)
add_subdirectory(autotests)
......
include(ECMMarkAsTest)
add_executable(filetree_model_test "")
target_include_directories(filetree_model_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/..)
find_package(Qt5Test QUIET REQUIRED)
target_link_libraries(
filetree_model_test
PRIVATE
katefiletree
KF5::GuiAddons
KF5::TextEditor
Qt5::Test
)
target_sources(
filetree_model_test
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../katefiletreemodel.cpp
filetree_model_test.cpp
document_dummy.cpp
)
......
......@@ -3,21 +3,24 @@ if(WIN32)
return()
endif()
set(kategdbplugin_PART_SRCS
plugin_kategdb.cpp
debugview.cpp
configview.cpp
ioview.cpp
localsview.cpp
advanced_settings.cpp
plugin.qrc
)
ki18n_wrap_ui(kategdbplugin_PART_SRCS advanced_settings.ui)
add_library(kategdbplugin MODULE ${kategdbplugin_PART_SRCS})
add_library(kategdbplugin MODULE "")
target_compile_definitions(kategdbplugin PRIVATE TRANSLATION_DOMAIN="kategdbplugin")
target_link_libraries(kategdbplugin PRIVATE KF5::TextEditor)
ki18n_wrap_ui(UI_SOURCES advanced_settings.ui)
target_sources(kategdbplugin PRIVATE ${UI_SOURCES})
target_sources(
kategdbplugin
PRIVATE
plugin_kategdb.cpp
debugview.cpp
configview.cpp
ioview.cpp
localsview.cpp
advanced_settings.cpp
plugin.qrc
)
kcoreaddons_desktop_to_json(kategdbplugin kategdbplugin.desktop)
install(TARGETS kategdbplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor)
include(ECMQtDeclareLoggingCategory)
add_library(katectagsplugin MODULE "")
target_compile_definitions(katectagsplugin PRIVATE TRANSLATION_DOMAIN="kate-ctags-plugin")
target_link_libraries(katectagsplugin PRIVATE KF5::TextEditor)
set(ctagsplugin_SRC
readtags.c
tags.cpp
ctagskinds.cpp
kate_ctags_view.cpp
kate_ctags_plugin.cpp
plugin.qrc
)
ki18n_wrap_ui(UI_SOURCES kate_ctags.ui CTagsGlobalConfig.ui)
target_sources(katectagsplugin PRIVATE ${UI_SOURCES})
include(ECMQtDeclareLoggingCategory)
ecm_qt_declare_logging_category(
ctagsplugin_SRC
DEBUG_SOURCES
HEADER kate_ctags_debug.h
IDENTIFIER KTECTAGS
CATEGORY_NAME "katectagsplugin"
)
target_sources(katectagsplugin PRIVATE ${DEBUG_SOURCES})
ki18n_wrap_ui(ctagsplugin_SRC kate_ctags.ui CTagsGlobalConfig.ui)
add_library(katectagsplugin MODULE ${ctagsplugin_SRC})
target_compile_definitions(katectagsplugin PRIVATE TRANSLATION_DOMAIN="kate-ctags-plugin")
target_link_libraries(katectagsplugin PRIVATE KF5::TextEditor)
target_sources(
katectagsplugin
PRIVATE
readtags.c
tags.cpp
ctagskinds.cpp
kate_ctags_view.cpp
kate_ctags_plugin.cpp
plugin.qrc
)
kcoreaddons_desktop_to_json(katectagsplugin katectagsplugin.desktop)
install(TARGETS katectagsplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor)
set(katebuild_SRCS
plugin_katebuild.cpp
targets.cpp
TargetHtmlDelegate.cpp
TargetModel.cpp
UrlInserter.cpp
SelectTargetView.cpp
plugin.qrc
)
ki18n_wrap_ui(katebuild_SRCS build.ui SelectTargetUi.ui)
add_library(katebuildplugin MODULE ${katebuild_SRCS})
add_library(katebuildplugin MODULE "")
target_compile_definitions(katebuildplugin PRIVATE TRANSLATION_DOMAIN="katebuild-plugin")
target_link_libraries(katebuildplugin PRIVATE KF5::TextEditor)
ki18n_wrap_ui(UI_SOURCES build.ui SelectTargetUi.ui)
target_sources(katebuildplugin PRIVATE ${UI_SOURCES})
target_sources(
katebuildplugin
PRIVATE
plugin_katebuild.cpp
targets.cpp
TargetHtmlDelegate.cpp
TargetModel.cpp
UrlInserter.cpp
SelectTargetView.cpp
plugin.qrc
)
kcoreaddons_desktop_to_json (katebuildplugin katebuildplugin.desktop)
install(TARGETS katebuildplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor)
......@@ -5,34 +5,37 @@ if(NOT KF5ItemModels_FOUND)
return()
endif()
set(lspclientplugin_SRCS
lspclientcompletion.cpp
lspclientconfigpage.cpp
lspclienthover.cpp
lspclientplugin.cpp
lspclientpluginview.cpp
lspclientserver.cpp
lspclientservermanager.cpp
lspclientsymbolview.cpp
plugin.qrc
add_library(lspclientplugin MODULE "")
target_compile_definitions(lspclientplugin PRIVATE TRANSLATION_DOMAIN="lspclient")
target_link_libraries(
lspclientplugin
PRIVATE
KF5::ItemModels
KF5::TextEditor
)
include(ECMQtDeclareLoggingCategory)
ecm_qt_declare_logging_category(
lspclientplugin_debug_SRCS
DEBUG_SOURCES
HEADER lspclient_debug.h
IDENTIFIER LSPCLIENT
CATEGORY_NAME "katelspclientplugin"
)
target_sources(lspclientplugin PRIVATE ${DEBUG_SOURCES})
add_library(lspclientplugin MODULE ${lspclientplugin_SRCS} ${lspclientplugin_debug_SRCS})
target_compile_definitions(lspclientplugin PRIVATE TRANSLATION_DOMAIN="lspclient")
target_link_libraries(
lspclientplugin
PRIVATE
KF5::ItemModels
KF5::TextEditor
target_sources(
lspclientplugin
PRIVATE
lspclientcompletion.cpp
lspclientconfigpage.cpp
lspclienthover.cpp
lspclientplugin.cpp
lspclientpluginview.cpp
lspclientserver.cpp
lspclientservermanager.cpp
lspclientsymbolview.cpp
plugin.qrc
)
kcoreaddons_desktop_to_json(lspclientplugin lspclientplugin.desktop)
......
......@@ -7,5 +7,5 @@ target_sources(
PRIVATE
lsptestapp.cpp
../lspclientserver.cpp
${lspclientplugin_debug_SRCS}
${DEBUG_SOURCES}
)
include(ECMQtDeclareLoggingCategory)
set(ktexteditorpreviewplugin_SRCS
ktexteditorpreviewplugin.cpp
ktexteditorpreviewview.cpp
previewwidget.cpp
kpartview.cpp
)
add_library(ktexteditorpreviewplugin MODULE "")
target_compile_definitions(ktexteditorpreviewplugin PRIVATE TRANSLATION_DOMAIN="ktexteditorpreviewplugin")
target_link_libraries(ktexteditorpreviewplugin PRIVATE KF5::TextEditor)
include(ECMQtDeclareLoggingCategory)
ecm_qt_declare_logging_category(
ktexteditorpreviewplugin_SRCS
DEBUG_SOURCES
HEADER ktexteditorpreview_debug.h
IDENTIFIER KTEPREVIEW
CATEGORY_NAME "ktexteditorpreviewplugin"
)
target_sources(ktexteditorpreviewplugin PRIVATE ${DEBUG_SOURCES})
add_library(ktexteditorpreviewplugin MODULE ${ktexteditorpreviewplugin_SRCS})
target_compile_definitions(ktexteditorpreviewplugin PRIVATE TRANSLATION_DOMAIN="ktexteditorpreviewplugin")
target_link_libraries(ktexteditorpreviewplugin PRIVATE KF5::TextEditor)
target_sources(
ktexteditorpreviewplugin
PRIVATE
ktexteditorpreviewplugin.cpp
ktexteditorpreviewview.cpp
previewwidget.cpp
kpartview.cpp
)
install(TARGETS ktexteditorpreviewplugin DESTINATION ${KDE_INSTALL_PLUGINDIR}/ktexteditor)
......@@ -7,7 +7,7 @@ find_package(Qt5Test QUIET REQUIRED)
target_link_libraries(
projectplugin_test
PRIVATE
kdeinit_kate
KF5::TextEditor
Qt5::Test
)
......
......@@ -5,18 +5,7 @@ if(NOT KF5IconThemes_FOUND)
return()
endif()
set(katereplicode_SRCS
replicodeplugin.cpp
replicodeconfigpage.cpp
replicodeconfig.cpp
replicodesettings.cpp
replicodeview.cpp
plugin.qrc
)
ki18n_wrap_ui(katereplicode_SRCS config.ui)
add_library(katereplicodeplugin MODULE ${katereplicode_SRCS})
add_library(katereplicodeplugin MODULE "")
target_compile_definitions(katereplicodeplugin PRIVATE TRANSLATION_DOMAIN="kate-replicode-plugin")
target_link_libraries(
......@@ -26,5 +15,19 @@ target_link_libraries(
KF5::IconThemes
)
ki18n_wrap_ui(UI_SOURCES config.ui)
target_sources(katereplicodeplugin PRIVATE ${UI_SOURCES})
target_sources(
katereplicodeplugin
PRIVATE
replicodeplugin.cpp
replicodeconfigpage.cpp
replicodeconfig.cpp
replicodesettings.cpp
replicodeview.cpp
plugin.qrc
)
kcoreaddons_desktop_to_json(katereplicodeplugin katereplicodeplugin.desktop)
install(TARGETS katereplicodeplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor)
add_library(kterustcompletionplugin MODULE ${kterustcompletion_SRCS})
add_library(kterustcompletionplugin MODULE "")
target_compile_definitions(kterustcompletionplugin PRIVATE TRANSLATION_DOMAIN="kterustcompletion")
target_link_libraries(kterustcompletionplugin PRIVATE KF5::TextEditor)
......
......@@ -5,19 +5,7 @@ if(NOT KF5ItemViews_FOUND)
return()
endif()
set(katesearchplugin_PART_SRCS
plugin_search.cpp
search_open_files.cpp
SearchDiskFiles.cpp
FolderFilesList.cpp
replace_matches.cpp
htmldelegate.cpp
plugin.qrc
)
ki18n_wrap_ui(katesearchplugin_PART_SRCS search.ui results.ui)
add_library(katesearchplugin MODULE ${katesearchplugin_PART_SRCS})
add_library(katesearchplugin MODULE "")
target_compile_definitions(katesearchplugin PRIVATE TRANSLATION_DOMAIN="katesearch")
target_link_libraries(
......@@ -27,5 +15,20 @@ target_link_libraries(
KF5::TextEditor
)
ki18n_wrap_ui(UI_SOURCES search.ui results.ui)
target_sources(katesearchplugin PRIVATE ${UI_SOURCES})
target_sources(
katesearchplugin
PRIVATE
plugin_search.cpp
search_open_files.cpp
SearchDiskFiles.cpp
FolderFilesList.cpp
replace_matches.cpp
htmldelegate.cpp
plugin.qrc
)
kcoreaddons_desktop_to_json(katesearchplugin katesearch.desktop)
install(TARGETS katesearchplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor)
......@@ -8,7 +8,7 @@ if(NOT KF5Plasma_FOUND OR NOT Qt5Widgets_FOUND)
return()
endif()
add_library(plasma_engine_katesessions MODULE ${plasma_engine_katesessions_SRCS})
add_library(plasma_engine_katesessions MODULE "")
target_compile_definitions(plasma_engine_katesessions PRIVATE TRANSLATION_DOMAIN="plasma_applet_org.kde.plasma.katesessions")
target_link_libraries(
......
......@@ -5,23 +5,7 @@ if(NOT KF5NewStuff_FOUND)
return()
endif()
set(katesnippetsplugin_PART_SRCS
katesnippets.cpp
katesnippetglobal.cpp
snippetview.cpp
snippetstore.cpp
snippetrepository.cpp
snippetcompletionmodel.cpp
snippetcompletionitem.cpp
snippet.cpp
editrepository.cpp
editsnippet.cpp
plugin.qrc
)
ki18n_wrap_ui(katesnippetsplugin_PART_SRCS snippetview.ui editrepository.ui editsnippet.ui)
add_library(katesnippetsplugin MODULE ${katesnippetsplugin_PART_SRCS})
add_library(katesnippetsplugin MODULE "")
target_compile_definitions(katesnippetsplugin PRIVATE TRANSLATION_DOMAIN="katesnippetsplugin")
target_link_libraries(
......@@ -31,5 +15,24 @@ target_link_libraries(
KF5::TextEditor
)
ki18n_wrap_ui(UI_SOURCES snippetview.ui editrepository.ui editsnippet.ui)
target_sources(katesnippetsplugin PRIVATE ${UI_SOURCES})
target_sources(
katesnippetsplugin
PRIVATE
katesnippets.cpp
katesnippetglobal.cpp
snippetview.cpp
snippetstore.cpp
snippetrepository.cpp
snippetcompletionmodel.cpp
snippetcompletionitem.cpp
snippet.cpp
editrepository.cpp
editsnippet.cpp
plugin.qrc
)
kcoreaddons_desktop_to_json(katesnippetsplugin katesnippetsplugin.desktop)
install(TARGETS katesnippetsplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor)
......@@ -7,7 +7,7 @@ find_package(Qt5Test QUIET REQUIRED)
target_link_libraries(
tabswitcher_test
PRIVATE
kdeinit_kate
KF5::TextEditor
Qt5::Test
)
......
set(textfilterplugin_PART_SRCS
plugin_katetextfilter.cpp
plugin.qrc
)
ki18n_wrap_ui(textfilterplugin_PART_SRCS textfilterwidget.ui)
add_library(textfilterplugin MODULE ${textfilterplugin_PART_SRCS})
add_library(textfilterplugin MODULE "")
target_compile_definitions(textfilterplugin PRIVATE TRANSLATION_DOMAIN="katetextfilter")
target_link_libraries(textfilterplugin PRIVATE KF5::TextEditor)
ki18n_wrap_ui(UI_SOURCES textfilterwidget.ui)
target_sources(textfilterplugin PRIVATE ${UI_SOURCES})
target_sources(
textfilterplugin
PRIVATE
plugin_katetextfilter.cpp
plugin.qrc
)
kcoreaddons_desktop_to_json(textfilterplugin textfilterplugin.desktop)
install(TARGETS textfilterplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor)
......@@ -3,7 +3,7 @@ remove_definitions(-DQT_NO_CAST_FROM_ASCII)
remove_definitions(-DQT_NO_URL_CAST_FROM_STRING)
remove_definitions(-DQT_NO_CAST_FROM_BYTEARRAY)
add_library(katexmlcheckplugin MODULE ${katexmlcheckplugin_PART_SRCS})
add_library(katexmlcheckplugin MODULE "")
target_compile_definitions(katexmlcheckplugin PRIVATE TRANSLATION_DOMAIN="katexmlcheck")
target_link_libraries(katexmlcheckplugin PRIVATE KF5::TextEditor)
......
......@@ -3,7 +3,7 @@ remove_definitions(-DQT_NO_CAST_FROM_ASCII)
remove_definitions(-DQT_NO_URL_CAST_FROM_STRING)
remove_definitions(-DQT_NO_CAST_FROM_BYTEARRAY)
add_library(katexmltoolsplugin MODULE ${katexmltoolsplugin_PART_SRCS})
add_library(katexmltoolsplugin MODULE "")
target_compile_definitions(katexmltoolsplugin PRIVATE TRANSLATION_DOMAIN="katexmltools")
target_link_libraries(katexmltoolsplugin PRIVATE KF5::TextEditor)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment