C++: don't force the SLINT_STYLE cmake variable

Keep the default if unset, otherwise use whatever SLINT_STYLE was passed
This commit is contained in:
Olivier Goffart 2022-07-20 11:34:56 +02:00 committed by Olivier Goffart
parent ced9504635
commit 29d28dc73e
3 changed files with 12 additions and 5 deletions

View file

@ -5,7 +5,7 @@ function(SLINT_TARGET_SOURCES target)
foreach (it IN ITEMS ${ARGN})
get_filename_component(_SLINT_BASE_NAME ${it} NAME_WE)
get_filename_component(_SLINT_ABSOLUTE ${it} REALPATH BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
get_property(_SLINT_STYLE GLOBAL PROPERTY SLINT_STYLE)
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
@ -16,7 +16,7 @@ function(SLINT_TARGET_SOURCES target)
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
--style ${SLINT_STYLE}
--style ${_SLINT_STYLE}
DEPENDS Slint::slint-compiler ${_SLINT_ABSOLUTE}
COMMENT "Generating ${_SLINT_BASE_NAME}.h"
DEPFILE ${CMAKE_CURRENT_BINARY_DIR}/${_SLINT_BASE_NAME}.d
@ -29,7 +29,7 @@ function(SLINT_TARGET_SOURCES target)
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_SLINT_BASE_NAME}.h
COMMAND Slint::slint-compiler ${_SLINT_ABSOLUTE}
-o ${CMAKE_CURRENT_BINARY_DIR}/${_SLINT_BASE_NAME}.h
--style ${SLINT_STYLE}
--style ${_SLINT_STYLE}
DEPENDS Slint::slint-compiler ${_SLINT_ABSOLUTE} ${ALL_SLINTS}
COMMENT "Generating ${_SLINT_BASE_NAME}.h"
)