cmake: Rework how tabbox is conditionally compiled into libkwin

In modern CMake code, it is highly advised to avoid using variables. One
should instead try to use targets and properties more extensively.
This commit is contained in:
Vlad Zahorodnii 2020-12-30 12:28:40 +02:00
parent 9af78c0e7f
commit ccfaf1a1d6
2 changed files with 17 additions and 15 deletions

View file

@ -560,21 +560,6 @@ set(kwin_SRCS
xwl/xwayland_interface.cpp
)
if (KWIN_BUILD_TABBOX)
include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS})
set(kwin_SRCS ${kwin_SRCS}
tabbox/clientmodel.cpp
tabbox/desktopchain.cpp
tabbox/desktopmodel.cpp
tabbox/switcheritem.cpp
tabbox/tabbox.cpp
tabbox/tabbox_logging.cpp
tabbox/tabboxconfig.cpp
tabbox/tabboxhandler.cpp
tabbox/x11_filter.cpp
)
endif()
if (HAVE_LINUX_VT_H)
set(kwin_SRCS ${kwin_SRCS}
virtual_terminal.cpp
@ -711,6 +696,21 @@ if (KWIN_BUILD_ACTIVITIES)
target_link_libraries(kwin KF5::Activities)
endif()
if (KWIN_BUILD_TABBOX)
target_sources(kwin PRIVATE
tabbox/clientmodel.cpp
tabbox/desktopchain.cpp
tabbox/desktopmodel.cpp
tabbox/switcheritem.cpp
tabbox/tabbox.cpp
tabbox/tabbox_logging.cpp
tabbox/tabboxconfig.cpp
tabbox/tabboxhandler.cpp
tabbox/x11_filter.cpp
)
target_include_directories(kwin PRIVATE ${Qt5Gui_PRIVATE_INCLUDE_DIRS})
endif()
generate_export_header(kwin EXPORT_FILE_NAME kwin_export.h)
if(CMAKE_SYSTEM MATCHES "FreeBSD")

View file

@ -32,6 +32,7 @@ target_link_libraries(testTabBoxClientModel
XCB::XCB
)
target_include_directories(testTabBoxClientModel PRIVATE ${Qt5Gui_PRIVATE_INCLUDE_DIRS})
add_test(NAME kwin-testTabBoxClientModel COMMAND testTabBoxClientModel)
ecm_mark_as_test(testTabBoxClientModel)
@ -67,6 +68,7 @@ target_link_libraries(testTabBoxHandler
XCB::XCB
)
target_include_directories(testTabBoxHandler PRIVATE ${Qt5Gui_PRIVATE_INCLUDE_DIRS})
add_test(NAME kwin-testTabBoxHandler COMMAND testTabBoxHandler)
ecm_mark_as_test(testTabBoxHandler)