From 5d03d6e1bd87e7cc76fcc06fca9865b5a7de242d Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Sun, 25 Aug 2024 09:23:14 +0200 Subject: [PATCH] Simplify slint-compiler import location logic in SlintConfig.cmake.in Instead of detecting the suffix, just copy across the corrosion-determined file name. Amends 13975d9def7e4c1f1417340f322b8ac4f90afdbb --- api/cpp/CMakeLists.txt | 3 +++ api/cpp/cmake/SlintConfig.cmake.in | 6 +----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/api/cpp/CMakeLists.txt b/api/cpp/CMakeLists.txt index 5e4538331dc..d16da6a407a 100644 --- a/api/cpp/CMakeLists.txt +++ b/api/cpp/CMakeLists.txt @@ -431,6 +431,9 @@ if(SLINT_BUILD_RUNTIME) endforeach() get_property(_SLINT_STYLE GLOBAL PROPERTY SLINT_STYLE) + get_target_property(_slint_compiler_location slint-compiler IMPORTED_LOCATION) + cmake_path(GET _slint_compiler_location FILENAME SLINT_COMPILER_FILE_NAME) + configure_package_config_file("cmake/SlintConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/Slint/SlintConfig.cmake" INSTALL_DESTINATION lib/cmake/Slint) endfunction() diff --git a/api/cpp/cmake/SlintConfig.cmake.in b/api/cpp/cmake/SlintConfig.cmake.in index e9aad9d7465..ff940e66523 100644 --- a/api/cpp/cmake/SlintConfig.cmake.in +++ b/api/cpp/cmake/SlintConfig.cmake.in @@ -22,11 +22,7 @@ if (SLINT_COMPILER) include("${CMAKE_CURRENT_LIST_DIR}/SlintMacro.cmake") elseif (@SLINT_FEATURE_COMPILER@) add_executable(Slint::slint-compiler IMPORTED GLOBAL) - 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() + set_target_properties(Slint::slint-compiler PROPERTIES IMPORTED_LOCATION "${_IMPORT_PREFIX}/@CMAKE_INSTALL_BINDIR@/@SLINT_COMPILER_FILE_NAME@") include("${CMAKE_CURRENT_LIST_DIR}/SlintMacro.cmake") endif()