Skip to content

Commit

Permalink
Fix locating the slint-compiler.exe on cmake cross-compiled packages
Browse files Browse the repository at this point in the history
When cross-compiling CMAKE_EXECUTABLE_SUFFIX may not be set to .exe even
though the host is Windows, because this variable always refers to the
target. This is a missing feature in cmake, so work around it for now.
See also https://gitlab.kitware.com/cmake/cmake/-/issues/17553 I made a
similar workaround in Corrosion long time ago with commit
b8a6b26a0f2d526e0492df9fd88c0495b0b8a64f

The target prop line is duplicated in favor of introducing a variable,
that would otherwise be at risk of being visible in the user scope.
  • Loading branch information
tronical committed Aug 23, 2024
1 parent 47028bc commit 13975d9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion api/cpp/cmake/SlintConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ if (SLINT_COMPILER)
include("${CMAKE_CURRENT_LIST_DIR}/SlintMacro.cmake")
elseif (@SLINT_FEATURE_COMPILER@)
add_executable(Slint::slint-compiler IMPORTED GLOBAL)
set_target_properties(Slint::slint-compiler PROPERTIES IMPORTED_LOCATION "${_IMPORT_PREFIX}/@CMAKE_INSTALL_BINDIR@/slint-compiler${CMAKE_EXECUTABLE_SUFFIX}")
if(CMAKE_HOST_WIN32)
set_target_properties(Slint::slint-compiler PROPERTIES IMPORTED_LOCATION "${_IMPORT_PREFIX}/@CMAKE_INSTALL_BINDIR@/slint-compiler.exe")
else()
set_target_properties(Slint::slint-compiler PROPERTIES IMPORTED_LOCATION "${_IMPORT_PREFIX}/@CMAKE_INSTALL_BINDIR@/slint-compiler")
endif()
include("${CMAKE_CURRENT_LIST_DIR}/SlintMacro.cmake")
endif()

Expand Down

0 comments on commit 13975d9

Please sign in to comment.