Commit 0737efbb authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

lookandfeel kcm: Cleanup CMake code and avoid compiling files 3 times

Instead use a static library for the files that are shared between the
kcm, tests and the command line tool
parent 44a55fde
......@@ -18,7 +18,6 @@ endif()
configure_file (config-kcm.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kcm.h )
set(kcm_lookandfeel_SRCS
kcmmain.cpp
kcm.cpp
../kcms-common_p.h
)
......@@ -38,36 +37,35 @@ kcmutils_generate_module_data(
SETTINGS_HEADERS lookandfeelsettings.h
SETTINGS_CLASSES LookAndFeelSettings
)
kconfig_add_kcfg_files(kcm_lookandfeel_SRCS lookandfeelsettings.kcfgc GENERATE_MOC)
add_library(kcm_lookandfeel MODULE ${kcm_lookandfeel_SRCS})
target_link_libraries(kcm_lookandfeel
Qt::DBus
KF5::I18n
KF5::KCMUtils
KF5::IconThemes
KF5::JobWidgets
KF5::Service
KF5::QuickAddons
KF5::KIOWidgets
KF5::Declarative
PW::KWorkspace
krdb
add_library(kcm_lookandfeel_static STATIC ${kcm_lookandfeel_SRCS})
target_link_libraries(kcm_lookandfeel_static
Qt::DBus
KF5::I18n
KF5::KCMUtils
KF5::IconThemes
KF5::JobWidgets
KF5::Service
KF5::QuickAddons
KF5::KIOWidgets
KF5::Declarative
PW::KWorkspace
krdb
)
if(X11_FOUND)
target_link_libraries(kcm_lookandfeel Qt::X11Extras)
target_link_libraries(kcm_lookandfeel_static Qt::X11Extras)
endif()
if (X11_Xcursor_FOUND)
target_link_libraries(kcm_lookandfeel X11::Xcursor)
target_link_libraries(kcm_lookandfeel_static X11::Xcursor)
endif ()
if (X11_Xfixes_FOUND)
target_link_libraries(kcm_lookandfeel X11::Xfixes)
target_link_libraries(kcm_lookandfeel_static X11::Xfixes)
endif ()
add_library(kcm_lookandfeel MODULE kcmmain.cpp)
kcoreaddons_desktop_to_json(kcm_lookandfeel "kcm_lookandfeel.desktop" SERVICE_TYPES kcmodule.desktop)
target_link_libraries(kcm_lookandfeel kcm_lookandfeel_static)
#this desktop file is installed only for retrocompatibility with sycoca
install(FILES lookandfeelsettings.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
......@@ -85,50 +83,11 @@ kpackage_install_package(package kcm_lookandfeel kcms)
###### Command line tool
set(plasma-apply-lookandfeel_SRCS
lnftool.cpp
# TODO: load kcm plugin instead of using code copy
kcm.cpp
lookandfeeldata.cpp
../kcms-common_p.h
)
if (X11_Xcursor_FOUND)
set(plasma-apply-lookandfeel_SRCS
${plasma-apply-lookandfeel_SRCS}
../cursortheme/xcursor/cursortheme.cpp
../cursortheme/xcursor/xcursortheme.cpp
)
endif ()
kconfig_add_kcfg_files(plasma-apply-lookandfeel_SRCS lookandfeelsettings.kcfgc GENERATE_MOC)
add_executable(plasma-apply-lookandfeel ${plasma-apply-lookandfeel_SRCS})
target_link_libraries(plasma-apply-lookandfeel
Qt::DBus
KF5::CoreAddons
KF5::I18n
KF5::KCMUtils
KF5::IconThemes
KF5::JobWidgets
KF5::Service
KF5::QuickAddons
KF5::KIOWidgets
KF5::Declarative
PW::KWorkspace
krdb
)
add_executable(plasma-apply-lookandfeel lnftool.cpp)
if(X11_FOUND)
target_link_libraries(plasma-apply-lookandfeel X11::X11 Qt::X11Extras)
endif()
if (X11_Xcursor_FOUND)
target_link_libraries(plasma-apply-lookandfeel X11::Xcursor)
endif ()
if (X11_Xfixes_FOUND)
target_link_libraries(plasma-apply-lookandfeel X11::Xfixes)
endif ()
target_link_libraries(plasma-apply-lookandfeel kcm_lookandfeel_static)
ADD_CUSTOM_TARGET(plasma-apply-lookandfeel_link ALL
COMMAND ${CMAKE_COMMAND} -E create_symlink ${KDE_INSTALL_FULL_BINDIR}/plasma-apply-lookandfeel ${CMAKE_CURRENT_BINARY_DIR}/lookandfeeltool)
......
......@@ -2,52 +2,8 @@ add_definitions(-DKSMSERVER_UNIT_TEST)
include(ECMMarkAsTest)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/..)
set( kcmTest_SRCS
kcmtest.cpp
../kcm.cpp
../lookandfeeldata.cpp
../../kcms-common_p.h
)
if (X11_Xcursor_FOUND)
set(kcmTest_SRCS
${kcmTest_SRCS}
../../cursortheme/xcursor/cursortheme.cpp
../../cursortheme/xcursor/xcursortheme.cpp
)
endif ()
kconfig_add_kcfg_files(kcmTest_SRCS ../lookandfeelsettings.kcfgc GENERATE_MOC)
add_executable(kcmTest ${kcmTest_SRCS})
add_dependencies(kcmTest kcm_lookandfeel)
target_link_libraries(kcmTest
Qt::DBus
Qt::Test
KF5::I18n
KF5::KCMUtils
KF5::IconThemes
KF5::JobWidgets
KF5::Service
KF5::QuickAddons
KF5::KIOWidgets
KF5::Declarative
PW::KWorkspace
X11::X11
krdb
)
if(X11_FOUND)
target_link_libraries(kcmTest Qt::X11Extras)
endif()
if (X11_Xcursor_FOUND)
target_link_libraries(kcmTest X11::Xcursor)
endif ()
if (X11_Xfixes_FOUND)
target_link_libraries(kcmTest X11::Xfixes)
endif ()
add_executable(kcmTest kcmtest.cpp)
target_link_libraries(kcmTest kcm_lookandfeel_static Qt::Test)
add_test(NAME lookandfeel-kcmTest COMMAND kcmTest)
ecm_mark_as_test(kcmTest)
......
Supports Markdown
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