From 0fa21b4af5515e58a20a3b52193f9977c29e79bf Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Fri, 15 Nov 2013 16:46:59 +0100 Subject: [PATCH] Iterate over the cmake scripts Prefer using imported targets rather than cmake variables. --- .../krunnermodel/CMakeLists.txt | 4 ++-- src/declarativeimports/locale/CMakeLists.txt | 5 ++-- .../plasmacomponents/CMakeLists.txt | 4 ++-- .../plasmaextracomponents/CMakeLists.txt | 4 ++-- .../qtextracomponents/CMakeLists.txt | 4 ++-- src/plasma/CMakeLists.txt | 7 +++--- .../CMakeLists.txt | 8 +------ src/plasma/tests/testengine/CMakeLists.txt | 13 ++--------- src/scriptengines/javascript/CMakeLists.txt | 23 ++++++++----------- src/shell/CMakeLists.txt | 16 +++++-------- tools/port-cmake.sh | 2 ++ 11 files changed, 34 insertions(+), 56 deletions(-) diff --git a/src/declarativeimports/krunnermodel/CMakeLists.txt b/src/declarativeimports/krunnermodel/CMakeLists.txt index f66f3eeab..cd6435760 100644 --- a/src/declarativeimports/krunnermodel/CMakeLists.txt +++ b/src/declarativeimports/krunnermodel/CMakeLists.txt @@ -7,8 +7,8 @@ set(runnermodel_SRCS add_library(runnermodelplugin SHARED ${runnermodel_SRCS}) target_link_libraries(runnermodelplugin - ${Qt5Quick_LIBRARIES} - ${Qt5Qml_LIBRARIES} + Qt5::Quick + Qt5::Qml KF5::KI18n Plasma ) diff --git a/src/declarativeimports/locale/CMakeLists.txt b/src/declarativeimports/locale/CMakeLists.txt index 7c8506d6c..6aecb841d 100644 --- a/src/declarativeimports/locale/CMakeLists.txt +++ b/src/declarativeimports/locale/CMakeLists.txt @@ -17,9 +17,8 @@ set(localebindings_SRCS add_library(localebindingsplugin SHARED ${localebindings_SRCS}) target_link_libraries(localebindingsplugin Qt5::Core - ${Qt5Quick_LIBRARIES} - ${Qt5Qml_LIBRARIES} - ${KCore_LIBRARIES} + Qt5::Quick + Qt5::Qml KF5::KDE4Support KF5::KI18n ) diff --git a/src/declarativeimports/plasmacomponents/CMakeLists.txt b/src/declarativeimports/plasmacomponents/CMakeLists.txt index f14a9ef7d..012f65260 100644 --- a/src/declarativeimports/plasmacomponents/CMakeLists.txt +++ b/src/declarativeimports/plasmacomponents/CMakeLists.txt @@ -17,8 +17,8 @@ set(plasmacomponents_SRCS add_library(plasmacomponentsplugin SHARED ${plasmacomponents_SRCS}) target_link_libraries(plasmacomponentsplugin Qt5::Core - ${Qt5Quick_LIBRARIES} - ${Qt5Qml_LIBRARIES} + Qt5::Quick + Qt5::Qml Qt5::Gui KF5::KDeclarative Plasma) diff --git a/src/declarativeimports/plasmaextracomponents/CMakeLists.txt b/src/declarativeimports/plasmaextracomponents/CMakeLists.txt index aa7434aa5..c06d81e39 100644 --- a/src/declarativeimports/plasmaextracomponents/CMakeLists.txt +++ b/src/declarativeimports/plasmaextracomponents/CMakeLists.txt @@ -17,8 +17,8 @@ set(plasmaextracomponents_SRCS add_library(plasmaextracomponentsplugin SHARED ${plasmaextracomponents_SRCS}) target_link_libraries(plasmaextracomponentsplugin - ${Qt5Quick_LIBRARIES} - ${Qt5Qml_LIBRARIES} + Qt5::Quick + Qt5::Qml ${KACTIVITIES_LIBRARY} Plasma) diff --git a/src/declarativeimports/qtextracomponents/CMakeLists.txt b/src/declarativeimports/qtextracomponents/CMakeLists.txt index db986627b..aa44ae977 100644 --- a/src/declarativeimports/qtextracomponents/CMakeLists.txt +++ b/src/declarativeimports/qtextracomponents/CMakeLists.txt @@ -15,8 +15,8 @@ add_library(qtextracomponentsplugin SHARED ${qtextracomponents_SRCS}) target_link_libraries(qtextracomponentsplugin Qt5::Core - ${Qt5Quick_LIBRARIES} - ${Qt5Qml_LIBRARIES} + Qt5::Quick + Qt5::Qml Qt5::Gui KF5::KDeclarative KF5::KIconThemes diff --git a/src/plasma/CMakeLists.txt b/src/plasma/CMakeLists.txt index 9400d9960..ccb72ac3e 100644 --- a/src/plasma/CMakeLists.txt +++ b/src/plasma/CMakeLists.txt @@ -1,7 +1,5 @@ if(QCA2_FOUND) - include_directories( - ${QCA2_INCLUDE_DIR} - ) + include_directories( ${QCA2_INCLUDE_DIR} ) endif() # This option should be removed, or moved down as far as possible. @@ -129,7 +127,8 @@ kconfig_add_kcfg_files(Plasma_LIB_SRCS data/kconfigxt/libplasma-theme-global.kcf #) -add_library(Plasma SHARED ${Plasma_LIB_SRCS}) +add_library(Plasma ${Plasma_LIB_SRCS}) +add_library(KF5::Plasma ALIAS Plasma) target_link_libraries(Plasma Qt5::Network diff --git a/src/plasma/tests/testcontainmentactionsplugin/CMakeLists.txt b/src/plasma/tests/testcontainmentactionsplugin/CMakeLists.txt index 612e9fbcc..aba257565 100644 --- a/src/plasma/tests/testcontainmentactionsplugin/CMakeLists.txt +++ b/src/plasma/tests/testcontainmentactionsplugin/CMakeLists.txt @@ -1,18 +1,12 @@ project(plasma-containmentactions-test) -project(plasma_testengine_dataengine) - -find_package(KDE4 REQUIRED) - -include(KDE4Defaults) - set(test_SRCS test.cpp ) qt5_wrap_ui(test_SRCS config.ui) add_library(plasma_containmentactions_test MODULE ${test_SRCS}) -target_link_libraries(plasma_containmentactions_test ${Plasma_LIBRARIES} KF5::KIOCore KF5::KIOWidgets) +target_link_libraries(plasma_containmentactions_test KF5::Plasma KF5::KIOWidgets) install(TARGETS plasma_containmentactions_test DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES plasma-containmentactions-test.desktop DESTINATION ${SERVICES_INSTALL_DIR}) diff --git a/src/plasma/tests/testengine/CMakeLists.txt b/src/plasma/tests/testengine/CMakeLists.txt index 130c24fb5..dd906e867 100644 --- a/src/plasma/tests/testengine/CMakeLists.txt +++ b/src/plasma/tests/testengine/CMakeLists.txt @@ -1,18 +1,9 @@ project(plasma_testengine_dataengine) -find_package(KDE4 REQUIRED) - -include(KDE4Defaults) - -set(testengine_engine_SRCS - testengine.cpp) - -add_library(plasma_engine_testengine MODULE - ${testengine_engine_SRCS}) +add_library(plasma_engine_testengine MODULE testengine.cpp) target_link_libraries(plasma_engine_testengine - KF5::KIOCore KF5::KIOWidgets - ${Plasma_LIBRARIES}) + KF5::KIOWidgets KF5::Plasma) install(TARGETS plasma_engine_testengine DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES plasma-dataengine-testengine.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) diff --git a/src/scriptengines/javascript/CMakeLists.txt b/src/scriptengines/javascript/CMakeLists.txt index 6d9828b06..c8e91076e 100644 --- a/src/scriptengines/javascript/CMakeLists.txt +++ b/src/scriptengines/javascript/CMakeLists.txt @@ -52,12 +52,9 @@ include_directories(${PHONON_INCLUDES}) add_library(plasma_appletscript_simple_javascript MODULE ${simple_javascript_engine_SRCS}) target_link_libraries(plasma_appletscript_simple_javascript - ${KCore_LIBRARIES} KF5::KIOCore KF5::KIOWidgets - ${Plasma_LIBRARIES} + KF5::Plasma Qt5::Declarative - ${QT_QTSCRIPT_LIBRARY} - ${QT_QTUITOOLS_LIBRARY} Qt5::Xml ) @@ -78,10 +75,10 @@ set(javascript_runner_engine_SRCS add_library(plasma_runnerscript_javascript MODULE ${javascript_runner_engine_SRCS}) target_link_libraries(plasma_runnerscript_javascript - ${KCore_LIBRARIES} - KF5::KIOCore KF5::KIOWidgets - ${Plasma_LIBRARIES} - ${QT_QTSCRIPT_LIBRARY}) + KF5::KCoreAddons + KF5::KIOWidgets + KF5::Plasma + Qt5::Script) install(TARGETS plasma_runnerscript_javascript DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES data/plasma-scriptengine-runner-javascript.desktop DESTINATION ${SERVICES_INSTALL_DIR}) @@ -103,10 +100,10 @@ set(javascript_dataengine_engine_SRCS add_library(plasma_dataenginescript_javascript MODULE ${javascript_dataengine_engine_SRCS}) target_link_libraries(plasma_dataenginescript_javascript - ${KCore_LIBRARIES} - KF5::KIOCore KF5::KIOWidgets - ${Plasma_LIBRARIES} - ${QT_QTSCRIPT_LIBRARY}) + KF5::KCoreAddons + KF5::KIOWidgets + KF5::Plasma + Qt5::Script) install(TARGETS plasma_dataenginescript_javascript DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES data/plasma-scriptengine-dataengine-javascript.desktop DESTINATION ${SERVICES_INSTALL_DIR}) @@ -119,7 +116,7 @@ set(javascript_addon_packagestructure_SRCS ) add_library(plasma_packagestructure_javascriptaddon MODULE ${javascript_addon_packagestructure_SRCS}) -target_link_libraries(plasma_packagestructure_javascriptaddon ${Plasma_LIBRARIES}) +target_link_libraries(plasma_packagestructure_javascriptaddon KF5::Plasma) install(TARGETS plasma_packagestructure_javascriptaddon DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES data/plasma-packagestructure-javascript-addon.desktop DESTINATION ${SERVICES_INSTALL_DIR}) diff --git a/src/shell/CMakeLists.txt b/src/shell/CMakeLists.txt index 07c4a749e..c19dbd25f 100644 --- a/src/shell/CMakeLists.txt +++ b/src/shell/CMakeLists.txt @@ -7,10 +7,7 @@ set(CMAKE_AUTOMOC ON) # to always look for includes there: set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH}) - - -find_path(KDE_MODULES_DIR NAMES KDE4Macros.cmake PATH_SUFFIXES share/cmake/modules) +set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) add_definitions(-DHAVE_X11=${HAVE_X11}) @@ -61,16 +58,15 @@ add_executable(plasma-shell # The Qt5Widgets_LIBRARIES variable also includes QtGui and QtCore target_link_libraries(plasma-shell - #${Qt5Widgets_LIBRARIES} - ${Qt5Quick_LIBRARIES} - ${Qt5Qml_LIBRARIES} - ${KCore_LIBRARIES} + #Qt5::Widgets + Qt5::Quick + Qt5::Qml KF5::KIOCore - ${KWindowSystem_LIBRARIES} + KF5::KWindowSystem KF5::KCoreAddons Plasma PlasmaQuick - ${Qt5Script_LIBRARIES} + Qt5::Script KF5::KDE4Support KF5::Solid KF5::KDeclarative diff --git a/tools/port-cmake.sh b/tools/port-cmake.sh index 95880ecb2..720cc4b47 100755 --- a/tools/port-cmake.sh +++ b/tools/port-cmake.sh @@ -44,6 +44,7 @@ for FS in `find $PWD -type f -name 'CMakeLists.txt'`; do perl -p -i -e 's/\$\{KIconThemes_LIBRARIES\}/KF5\:\:KIconThemes/g' $FS perl -p -i -e 's/\$\{KWindowSystem_LIBRARIES\}/KF5\:\:KWindowSystem/g' $FS perl -p -i -e 's/\$\{KConfigWidgets_LIBRARIES\}/KF5\:\:KConfigWidgets/g' $FS + perl -p -i -e 's/\$\{KCMUTILS_LIBS\}/KF5\:\:KCMUtils/g' $FS perl -p -i -e 's/\$\{QT_QTXML_LIBRARY\}/Qt5\:\:Xml/g' $FS perl -p -i -e 's/\$\{QT_QTGUI_LIBRARY\}/Qt5\:\:Gui/g' $FS @@ -59,5 +60,6 @@ for FS in `find $PWD -type f -name 'CMakeLists.txt'`; do perl -p -i -e 's/\$\{Qt5Quick_LIBRARIES\}/Qt5\:\:Quick/g' $FS perl -p -i -e 's/\$\{Qt5Qml_LIBRARIES\}/Qt5\:\:Qml/g' $FS perl -p -i -e 's/\$\{Qt5Widgets_LIBRARIES\}/Qt5\:\:Widgets/g' $FS + perl -p -i -e 's/\$\{Qt5Script_LIBRARIES\}/Qt5\:\:Script/g' $FS done