mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 10:50:00 +00:00
C++: Fix ninja always rebuilding the .slint file
two bugs: - If the .slint file did not contain any import, the depfile would have no dependencies, and as a result, ninja would consider that it is always dirty. - In case the binary dir is a sub directory, the dependencies were relative to the wrong directory. Thgis is because the behavior changed in some version of cmake (see https://cmake.org/cmake/help/latest/policy/CMP0116.html) to avoid any problem, use the absolute paths Fixes #3261
This commit is contained in:
parent
4ad5b1f6d6
commit
de0836d1a0
2 changed files with 3 additions and 7 deletions
|
@ -21,15 +21,11 @@ function(SLINT_TARGET_SOURCES target)
|
|||
set(embed "$<IF:$<STREQUAL:${t_prop},>,${global_fallback},${t_prop}>")
|
||||
|
||||
if(CMAKE_GENERATOR STREQUAL "Ninja")
|
||||
# this code is inspired from the llvm source
|
||||
# https://github.com/llvm/llvm-project/blob/a00290ed10a6b4e9f6e9be44ceec367562f270c6/llvm/cmake/modules/TableGen.cmake#L13
|
||||
|
||||
file(RELATIVE_PATH _SLINT_BASE_NAME_REL ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${_SLINT_BASE_NAME})
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_SLINT_BASE_NAME}.h
|
||||
COMMAND Slint::slint-compiler ${_SLINT_ABSOLUTE}
|
||||
-o ${_SLINT_BASE_NAME_REL}.h --depfile ${_SLINT_BASE_NAME_REL}.d
|
||||
-o ${CMAKE_CURRENT_BINARY_DIR}/${_SLINT_BASE_NAME}.h
|
||||
--depfile ${CMAKE_CURRENT_BINARY_DIR}/${_SLINT_BASE_NAME}.d
|
||||
--style ${_SLINT_STYLE}
|
||||
--embed-resources=${embed}
|
||||
--translation-domain="${target}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue