slint/api/cpp/cmake
Joshua Goins 4324c187e9 C++: Fix build generation failing when compiling multiple .slint files
If you try to pass multiple files into slint_target_sources, some
generators may complain with a strange error like this:

ninja: error: build.ninja:226: multiple rules generate slint_generated_dialog_1.cpp

The reason for this was how the macro worked (and CMake scoping rules.)
While putting together the list of .cpp files to generate - which is 1
by default but is user-configurable - we append a list called cpp_num.
However we don't *reset* this list variable, so in each foreach
iteration we kept appending a new .cpp file and thus telling CMake we
were generating "slint_generated_dialog_1.cpp" twice, in addition to
whatever other file you had. We don't hit this issue with the other
variables like translation_domain_prop because they're set on every
iteration.

The fix for this is simple though, we can just set the variable to
empty.
2025-11-14 20:50:34 +01:00
..
SlintConfig.cmake.in Initial support for Windows ARM64 binaries 2025-06-17 09:59:50 +02:00
SlintMacro.cmake C++: Fix build generation failing when compiling multiple .slint files 2025-11-14 20:50:34 +01:00