Improve CMake usage

It's basically a run of the port-cmake.sh script in here, mostly the changes
are the following:
- Using KF5::* targets
- Using the proper macros, following recent developments in frameworks
master
Aleix Pol 11 years ago
parent 38b62ce928
commit 7b110f0671

@ -1,21 +1,21 @@
########### configure tests ###############
INCLUDE(CMakeDependentOption)
OPTION(KWIN_BUILD_DECORATIONS "Enable building of KWin decorations." ON)
OPTION(KWIN_BUILD_OXYGEN "Enable building of default decoration Oxygen" ON)
OPTION(KWIN_BUILD_KCMS "Enable building of KWin configuration modules." ON)
OPTION(KWIN_MOBILE_EFFECTS "Only build effects relevant for mobile devices" OFF)
OPTION(KWIN_BUILD_TABBOX "Enable building of KWin Tabbox functionality" ON)
OPTION(KWIN_BUILD_SCREENEDGES "Enable building of KWin with screen edge support" ON)
OPTION(KWIN_BUILD_SCRIPTING "Enable building of KWin with scripting support" ON)
OPTION(KWIN_BUILD_KAPPMENU "Enable building of KWin with application menu support" ON)
OPTION(KWIN_BUILD_XRENDER_COMPOSITING "Enable building of KWin with XRender Compositing support" ON)
OPTION(KWIN_BUILD_OPENGL_1_COMPOSITING "Enable support for OpenGL 1.x, automatically disabled when building for OpenGL ES 2.0" ON)
OPTION(KWIN_BUILD_ACTIVITIES "Enable building of KWin with kactivities support" OFF)
include(CMakeDependentOption)
option(KWIN_BUILD_DECORATIONS "Enable building of KWin decorations." ON)
option(KWIN_BUILD_OXYGEN "Enable building of default decoration Oxygen" ON)
option(KWIN_BUILD_KCMS "Enable building of KWin configuration modules." ON)
option(KWIN_MOBILE_EFFECTS "Only build effects relevant for mobile devices" OFF)
option(KWIN_BUILD_TABBOX "Enable building of KWin Tabbox functionality" ON)
option(KWIN_BUILD_SCREENEDGES "Enable building of KWin with screen edge support" ON)
option(KWIN_BUILD_SCRIPTING "Enable building of KWin with scripting support" ON)
option(KWIN_BUILD_KAPPMENU "Enable building of KWin with application menu support" ON)
option(KWIN_BUILD_XRENDER_COMPOSITING "Enable building of KWin with XRender Compositing support" ON)
option(KWIN_BUILD_OPENGL_1_COMPOSITING "Enable support for OpenGL 1.x, automatically disabled when building for OpenGL ES 2.0" ON)
option(KWIN_BUILD_ACTIVITIES "Enable building of KWin with kactivities support" OFF)
if(${KDE_PLATFORM_PROFILE} STREQUAL "Desktop")
OPTION(KWIN_PLASMA_ACTIVE "Enable building KWin for Plasma Active." OFF)
option(KWIN_PLASMA_ACTIVE "Enable building KWin for Plasma Active." OFF)
else()
OPTION(KWIN_PLASMA_ACTIVE "Enable building KWin for Plasma Active." On)
option(KWIN_PLASMA_ACTIVE "Enable building KWin for Plasma Active." On)
endif()
# Binary name of KWin
@ -225,12 +225,12 @@ qt4_add_dbus_adaptor( kwin_KDEINIT_SRCS org.kde.KWin.xml dbusinterface.h KWin::D
qt4_add_dbus_adaptor( kwin_KDEINIT_SRCS org.kde.kwin.Compositing.xml composite.h KWin::Compositor )
qt4_add_dbus_adaptor( kwin_KDEINIT_SRCS org.kde.kwin.Effects.xml effects.h KWin::EffectsHandlerImpl )
qt4_add_dbus_interface( kwin_KDEINIT_SRCS
qt5_add_dbus_interface( kwin_KDEINIT_SRCS
${KDEBASE_WORKSPACE_SOURCE_DIR}/ksmserver/org.kde.KSMServerInterface.xml ksmserver_interface)
qt4_add_dbus_interface( kwin_KDEINIT_SRCS
qt5_add_dbus_interface( kwin_KDEINIT_SRCS
${KDEBASE_WORKSPACE_SOURCE_DIR}/ksmserver/screenlocker/dbus/org.freedesktop.ScreenSaver.xml screenlocker_interface)
qt4_add_resources( kwin_KDEINIT_SRCS resources.qrc )
qt5_add_resources( kwin_KDEINIT_SRCS resources.qrc )
########### target link libraries ###############

@ -7,7 +7,7 @@ kde4_add_plugin(kwin_b2_config ${kwin_b2_config_PART_SRCS})
target_link_libraries(kwin_b2_config ${KDE4_KDEUI_LIBS} ${QT_QTGUI_LIBRARY})
target_link_libraries(kwin_b2_config ${KDE4_KDEUI_LIBS} Qt5::Gui)
install(TARGETS kwin_b2_config DESTINATION ${PLUGIN_INSTALL_DIR} )

@ -5,53 +5,53 @@ set(kwin_xml ${CMAKE_CURRENT_SOURCE_DIR}/../org.kde.KWin.xml)
set(kwin_update_default_rules_SRCS update_default_rules.cpp)
kde4_add_executable( kwin_update_default_rules ${kwin_update_default_rules_SRCS})
add_executable( kwin_update_default_rules ${kwin_update_default_rules_SRCS})
target_link_libraries( kwin_update_default_rules ${KDE4_KDECORE_LIBS} )
target_link_libraries( kwin_update_default_rules )
install(TARGETS kwin_update_default_rules DESTINATION ${LIB_INSTALL_DIR}/kconf_update_bin/ )
########### next target ###############
set( kwin_update_tabbox_settings_SRCS update_tabbox_settings.cpp )
kde4_add_executable( kwin_update_tabbox_settings ${kwin_update_tabbox_settings_SRCS} )
add_executable( kwin_update_tabbox_settings ${kwin_update_tabbox_settings_SRCS} )
target_link_libraries( kwin_update_tabbox_settings ${KDE4_KDECORE_LIBS} )
target_link_libraries( kwin_update_tabbox_settings )
install( TARGETS kwin_update_tabbox_settings DESTINATION ${LIB_INSTALL_DIR}/kconf_update_bin/ )
########### next target ###############
set( kwin_update_tabbox_qml_settings_SRCS update_tabbox_qml_settings.cpp )
kde4_add_executable( kwin_update_tabbox_qml_settings ${kwin_update_tabbox_qml_settings_SRCS} )
add_executable( kwin_update_tabbox_qml_settings ${kwin_update_tabbox_qml_settings_SRCS} )
target_link_libraries( kwin_update_tabbox_qml_settings ${KDE4_KDECORE_LIBS} )
target_link_libraries( kwin_update_tabbox_qml_settings )
install( TARGETS kwin_update_tabbox_qml_settings DESTINATION ${LIB_INSTALL_DIR}/kconf_update_bin/ )
########### next target ###############
set( kwin_update_settings_49_SRCS update_kwin_49.cpp update_kwin_49_main.cpp )
kde4_add_executable( kwin_update_settings_49 ${kwin_update_settings_49_SRCS} )
add_executable( kwin_update_settings_49 ${kwin_update_settings_49_SRCS} )
target_link_libraries( kwin_update_settings_49 ${KDE4_KDECORE_LIBS} )
target_link_libraries( kwin_update_settings_49 )
install( TARGETS kwin_update_settings_49 DESTINATION ${LIB_INSTALL_DIR}/kconf_update_bin/ )
########### next target ###############
set( kwin_update_settings_410_SRCS update_kwin_410.cpp )
kde4_add_executable( kwin_update_settings_410 ${kwin_update_settings_410_SRCS} )
add_executable( kwin_update_settings_410 ${kwin_update_settings_410_SRCS} )
target_link_libraries( kwin_update_settings_410 ${KDE4_KDECORE_LIBS} )
target_link_libraries( kwin_update_settings_410 )
install( TARGETS kwin_update_settings_410 DESTINATION ${LIB_INSTALL_DIR}/kconf_update_bin/ )
########### next target ###############
set( kwin_update_settings_411_SRCS update_kwin_411.cpp )
kde4_add_executable( kwin_update_settings_411 ${kwin_update_settings_411_SRCS} )
add_executable( kwin_update_settings_411 ${kwin_update_settings_411_SRCS} )
target_link_libraries( kwin_update_settings_411 ${KDE4_KDECORE_LIBS} )
target_link_libraries( kwin_update_settings_411 )
install( TARGETS kwin_update_settings_411 DESTINATION ${LIB_INSTALL_DIR}/kconf_update_bin/ )

@ -49,7 +49,7 @@ endmacro()
# Adds effect plugin with given name. Sources are given after the name
macro( KWIN4_ADD_EFFECT name )
KWIN4_ADD_EFFECT_BACKEND(kwin4_effect_${name} ${ARGN})
kwin4_add_effect_backend(kwin4_effect_${name} ${ARGN})
if(KWIN_BUILD_OPENGL)
if( KWIN_BUILD_OPENGL_1_COMPOSITING )
set_target_properties(kwin4_effect_${name} PROPERTIES COMPILE_FLAGS -DKWIN_HAVE_OPENGL_1)
@ -171,7 +171,7 @@ endif()
###############################################################################
# Add the builtins plugin
KWIN4_ADD_EFFECT( builtins ${kwin4_effect_builtins_sources} )
kwin4_add_effect( builtins ${kwin4_effect_builtins_sources} )
if( NOT KWIN_MOBILE_EFFECTS )
KWIN4_ADD_EFFECT_CONFIG( builtins ${kwin4_effect_builtins_config_sources} )
kwin4_add_effect_config( builtins ${kwin4_effect_builtins_config_sources} )
endif()

@ -9,9 +9,9 @@ set(kcm_kwincompositing_PART_SRCS
kde4_add_ui_files(kcm_kwincompositing_PART_SRCS main.ui)
set(kwin_xml ${KDEBASE_WORKSPACE_SOURCE_DIR}/kwin/org.kde.KWin.xml)
set_source_files_properties(${kwin_xml} PROPERTIES INCLUDE "interface_util.h")
QT4_ADD_DBUS_INTERFACE(kcm_kwincompositing_PART_SRCS ${kwin_xml} kwin_interface)
kde4_add_plugin(kcm_kwincompositing ${kcm_kwincompositing_PART_SRCS})
target_link_libraries(kcm_kwincompositing ${KDE4_KNEWSTUFF3_LIBS} ${KDE4_KCMUTILS_LIBS} ${KDE4_KDEUI_LIBS} ${X11_LIBRARIES})
qt5_add_dbus_interface(kcm_kwincompositing_PART_SRCS ${kwin_xml} kwin_interface)
add_library(kcm_kwincompositing MODULE ${kcm_kwincompositing_PART_SRCS})
target_link_libraries(kcm_kwincompositing KF5::KNewStuff ${KDE4_KCMUTILS_LIBS} ${KDE4_KDEUI_LIBS} ${X11_LIBRARIES})
install(TARGETS kcm_kwincompositing DESTINATION ${PLUGIN_INSTALL_DIR} )

@ -23,7 +23,7 @@ kde4_add_ui_files(kcm_kwindecoration_PART_SRCS
decoration.ui
)
kde4_add_plugin(kcm_kwindecoration ${kcm_kwindecoration_PART_SRCS})
add_library(kcm_kwindecoration MODULE ${kcm_kwindecoration_PART_SRCS})
target_link_libraries(kcm_kwindecoration
kdecorations
Qt5::DBus
@ -32,7 +32,7 @@ target_link_libraries(kcm_kwindecoration
KF5::KCMUtils
KF5::KCompletion
KF5::KI18n
${KDE4_KNEWSTUFF3_LIBS}
KF5::KNewStuff
KF5::KDE4Support
)
install(TARGETS kcm_kwindecoration DESTINATION ${PLUGIN_INSTALL_DIR} )

@ -4,7 +4,7 @@
set(kcm_kwindesktop_PART_SRCS main.cpp desktopnameswidget.cpp)
kde4_add_ui_files(kcm_kwindesktop_PART_SRCS main.ui)
kde4_add_plugin(kcm_kwindesktop ${kcm_kwindesktop_PART_SRCS})
add_library(kcm_kwindesktop MODULE ${kcm_kwindesktop_PART_SRCS})
target_link_libraries(kcm_kwindesktop
Qt5::X11Extras

@ -2,7 +2,7 @@
set(kcm_kwinoptions_PART_SRCS windows.cpp mouse.cpp main.cpp )
kde4_add_ui_files(kcm_kwinoptions_PART_SRCS actions.ui advanced.ui focus.ui mouse.ui moving.ui)
kde4_add_plugin(kcm_kwinoptions ${kcm_kwinoptions_PART_SRCS})
add_library(kcm_kwinoptions MODULE ${kcm_kwinoptions_PART_SRCS})
target_link_libraries(kcm_kwinoptions Qt5::DBus KF5::KCompletion KF5::KI18n KF5::KCMUtils KF5::KDE4Support)
install(TARGETS kcm_kwinoptions DESTINATION ${PLUGIN_INSTALL_DIR} )

@ -1,4 +1,4 @@
ADD_DEFINITIONS(-DKCMRULES)
add_definitions(-DKCMRULES)
########### next target ###############
set (kwinrules_MOC_HDRS yesnobox.h ../../client_machine.h ../../cursor.h)
@ -39,7 +39,7 @@ install(TARGETS kwin_rules_dialog DESTINATION ${LIBEXEC_INSTALL_DIR} )
set(kcm_kwinrules_PART_SRCS kcm.cpp ${kwinrules_SRCS})
kde4_add_plugin(kcm_kwinrules ${kcm_kwinrules_PART_SRCS})
add_library(kcm_kwinrules MODULE ${kcm_kwinrules_PART_SRCS})
target_link_libraries(kcm_kwinrules ${kcm_libs} ${kwin_kcm_rules_XCB_LIBS})

@ -8,7 +8,7 @@ set(kcm_SRCS
kde4_add_ui_files(kcm_SRCS module.ui)
kde4_add_plugin(kcm_kwin_scripts ${kcm_SRCS})
add_library(kcm_kwin_scripts MODULE ${kcm_SRCS})
target_link_libraries(kcm_kwin_scripts
Qt5::DBus
@ -17,7 +17,7 @@ target_link_libraries(kcm_kwin_scripts
KF5::KI18n
KF5::Plasma
KF5::KDE4Support
${KDE4_KNEWSTUFF3_LIBS}
KF5::KNewStuff
)
install(TARGETS kcm_kwin_scripts DESTINATION ${PLUGIN_INSTALL_DIR})

@ -2,7 +2,7 @@ include_directories( ${KDEBASE_WORKSPACE_SOURCE_DIR}/kwin/tabbox ${KDEBASE_WORKS
########### next target ###############
ADD_DEFINITIONS(-DTABBOX_KCM)
add_definitions(-DTABBOX_KCM)
set(kcm_kwintabbox_PART_SRCS
main.cpp
@ -17,7 +17,7 @@ set(kcm_kwintabbox_PART_SRCS
kde4_add_ui_files( kcm_kwintabbox_PART_SRCS main.ui )
kde4_add_plugin(kcm_kwintabbox ${kcm_kwintabbox_PART_SRCS})
add_library(kcm_kwintabbox MODULE ${kcm_kwintabbox_PART_SRCS})
target_link_libraries(kcm_kwintabbox
Qt5::Quick
@ -31,7 +31,7 @@ target_link_libraries(kcm_kwintabbox
KF5::KWindowSystem
KF5::Plasma
KF5::XmlGui
${KDE4_KNEWSTUFF3_LIBS}
KF5::KNewStuff
KF5::KDE4Support
${XCB_XCB_LIBRARY})

@ -3,7 +3,7 @@
set(kwin_killer_helper_SRCS killer.cpp )
kde4_add_executable(kwin_killer_helper ${kwin_killer_helper_SRCS})
add_executable(kwin_killer_helper ${kwin_killer_helper_SRCS})
set_target_properties(kwin_killer_helper PROPERTIES COMPILE_FLAGS ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS})
target_link_libraries(kwin_killer_helper

@ -7,7 +7,7 @@ set(kdecorations_LIB_SRCS
kcommondecoration.cpp
kcommondecoration_p.cpp )
kde4_add_library(kdecorations SHARED ${kdecorations_LIB_SRCS})
add_library(kdecorations SHARED ${kdecorations_LIB_SRCS})
target_link_libraries(kdecorations
Qt5::Widgets

@ -24,7 +24,7 @@ set(kwineffects_XCB_LIBS
${XCB_RENDER_LIBRARY}
)
kde4_add_library(kwineffects SHARED ${kwin_EFFECTSLIB_SRCS})
add_library(kwineffects SHARED ${kwin_EFFECTSLIB_SRCS})
target_link_libraries(kwineffects
${kwineffects_QT_LIBS}
${kwineffects_KDE_LIBS}
@ -49,7 +49,7 @@ macro( KWIN4_ADD_GLUTILS_BACKEND name glinclude )
if(OPENGL_EGL_FOUND)
include_directories(${OPENGLES_EGL_INCLUDE_DIR})
endif()
kde4_add_library(${name} SHARED ${kwin_GLUTILSLIB_SRCS})
add_library(${name} SHARED ${kwin_GLUTILSLIB_SRCS})
target_link_libraries(${name} PUBLIC ${kwineffects_QT_LIBS} ${kwineffects_XCB_LIBS} kwineffects)
if(OPENGL_EGL_FOUND)
target_link_libraries(${name} PRIVATE ${OPENGLES_EGL_LIBRARY})
@ -61,12 +61,12 @@ macro( KWIN4_ADD_GLUTILS_BACKEND name glinclude )
endmacro()
if(KWIN_BUILD_OPENGLES)
KWIN4_ADD_GLUTILS_BACKEND(kwinglesutils ${OPENGLES_INCLUDE_DIR} ${OPENGLES_LIBRARIES})
kwin4_add_glutils_backend(kwinglesutils ${OPENGLES_INCLUDE_DIR} ${OPENGLES_LIBRARIES})
set_target_properties(kwinglesutils PROPERTIES COMPILE_FLAGS -DKWIN_HAVE_OPENGLES)
set_target_properties(kwinglesutils PROPERTIES OUTPUT_NAME ${KWIN_NAME}glesutils)
endif()
if(KWIN_BUILD_OPENGL)
KWIN4_ADD_GLUTILS_BACKEND(kwinglutils ${OPENGL_INCLUDE_DIR} ${OPENGL_gl_LIBRARY})
kwin4_add_glutils_backend(kwinglutils ${OPENGL_INCLUDE_DIR} ${OPENGL_gl_LIBRARY})
set_target_properties(kwinglutils PROPERTIES OUTPUT_NAME ${KWIN_NAME}glutils)
if( KWIN_BUILD_OPENGL_1_COMPOSITING )

@ -14,7 +14,7 @@ set( testTabBoxClientModel_SRCS
#kde4_add_unit_test( testTabBoxClientModel TESTNAME kwin-testTabBoxClientModel ${testTabBoxClientModel_SRCS} )
#target_link_libraries( testTabBoxClientModel ${KDE4_KDEUI_LIBS} ${QT_QTDECLARATIVE_LIBRARY} ${X11_LIBRARIES} ${QT_QTTEST_LIBRARY} )
#target_link_libraries( testTabBoxClientModel ${KDE4_KDEUI_LIBS} Qt5::Declarative ${X11_LIBRARIES} Qt5::Test )
########################################################
# Test TabBox::TabBoxHandler
@ -32,7 +32,7 @@ set( testTabBoxHandler_SRCS
# kde4_add_unit_test( testTabBoxHandler TESTNAME kwin-testTabBoxHandler ${testTabBoxHandler_SRCS} )
# target_link_libraries( testTabBoxHandler ${KDE4_KDEUI_LIBS} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} ${QT_QTTEST_LIBRARY} ${X11_LIBRARIES} )
# target_link_libraries( testTabBoxHandler ${KDE4_KDEUI_LIBS} Qt5::Core Qt5::Gui Qt5::Declarative Qt5::Test ${X11_LIBRARIES} )
########################################################
# Test TabBox::TabBoxConfig

@ -3,7 +3,7 @@ include(ECMMarkAsTest)
set( testUpdateKWin49_SRCS test_update_kwin_49.cpp ../data/update_kwin_49.cpp ../tabbox/tabboxconfig.cpp )
#add_executable( testUpdateKWin49 ${testUpdateKWin49_SRCS} )
#target_link_libraries( testUpdateKWin49 ${KDE4_KDECORE_LIBS} ${QT_QTTEST_LIBRARY} )
#target_link_libraries( testUpdateKWin49 Qt5::Test )
#ecm_mark_as_test(testUpdateKWin49)
########################################################

Loading…
Cancel
Save