mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 02:39:28 +00:00
Fix build of CMake package inside Yocto build
When building against a Yocto SDK, CFLAGS isn't set, only CC. When
building inside Yocto, CC is set to just the target compiler and CFLAGS
contains the target specific options. Just like with commit
5bc56a3924
we need to cover also
HOST_CFLAGS by making them empty.
This commit is contained in:
parent
f7ed7cc3fc
commit
c69437fe8f
1 changed files with 8 additions and 2 deletions
|
@ -168,11 +168,11 @@ endif(SLINT_STYLE)
|
|||
# so cc.rs will first look for CC_<triplet> and then HOST_CC.
|
||||
# When cross-compiling, CMake doesn't really know what the host compiler is. Corrosion will set
|
||||
# HOST_CC to $CC, which is a good bet. Unfortunately in Yocto environments, CC will be set to
|
||||
# the cross-compiler.
|
||||
# the cross-compiler. The same applies to CFLAGS, which may contain target specific options.
|
||||
# So the hack to solve this is two-fold:
|
||||
# * We look for clang or gcc in PATH - unprefixed those are usually host compilers.
|
||||
# * Through corrosion we know the correct host value of CC_<triplet>.
|
||||
# Finally, we set CC_<host triplet> to clang or gcc.
|
||||
# Finally, we set CC_<host triplet> to clang or gcc and empty CFLAGS_<host triplet>
|
||||
if(SLINT_FEATURE_RENDERER_SKIA AND CMAKE_CROSSCOMPILING AND Rust_CARGO_HOST_TARGET)
|
||||
find_program(CLANG clang)
|
||||
if(CLANG)
|
||||
|
@ -191,6 +191,12 @@ if(SLINT_FEATURE_RENDERER_SKIA AND CMAKE_CROSSCOMPILING AND Rust_CARGO_HOST_TARG
|
|||
PROPERTY CORROSION_ENVIRONMENT_VARIABLES
|
||||
CC_${cargo_host_target_underscore}=${host_cc}
|
||||
)
|
||||
set_property(
|
||||
TARGET slint-cpp
|
||||
APPEND
|
||||
PROPERTY CORROSION_ENVIRONMENT_VARIABLES
|
||||
CFLAGS_${cargo_host_target_underscore}=""
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue