UI: Fix UI file changes not being picked up by CMake

Due to how CMake and generated project files are structured, just using
AUTOUIC to pick up Qt `.ui` files will lead to a situation where
changing such a file doesn't trigger a regeneration of the associated
header files and thus a re-build of the target.

Upstream fix still requires `.ui` files to be added as target sources.

CMake issue: https://gitlab.kitware.com/cmake/cmake/-/issues/17959
This commit is contained in:
PatTheMav
2022-03-19 13:04:30 +01:00
committed by Jim
parent c8b2db9760
commit 6d91c3512b
5 changed files with 95 additions and 34 deletions

View File

@@ -15,6 +15,10 @@ set_target_properties(
AUTORCC ON
AUTOUIC_SEARCH_PATHS "forms")
target_sources(
frontend-tools PRIVATE forms/auto-scene-switcher.ui forms/captions.ui
forms/output-timer.ui forms/scripts.ui)
target_sources(
frontend-tools
PRIVATE frontend-tools.c
@@ -103,4 +107,15 @@ elseif(OS_POSIX)
target_sources(frontend-tools PRIVATE auto-scene-switcher-nix.cpp)
endif()
get_target_property(_SOURCES frontend-tools SOURCES)
set(_UI ${_SOURCES})
list(FILTER _UI INCLUDE REGEX ".*\\.ui?")
source_group(
TREE "${CMAKE_CURRENT_SOURCE_DIR}/forms"
PREFIX "UI Files"
FILES ${_UI})
unset(_SOURCES)
unset(_UI)
setup_plugin_target(frontend-tools)