slint/api/cpp/cmake/SlintConfig.cmake.in
Jonathan Schwender 4ade9faa0d Update Corrosion to v0.3
This requires the following changes:
- Delay configuring SlintConfig.cmake:
  Corrosion sets the `IMPORTED` locations late to allow us to set
  OUTPUT_DIRECTORY target properties. The configuration of
  SlintConfig.cmake must be deferred until after Corrosion set the
  locations. Since we are writing to a config file Generator expressions
  are not an option.
- Remove BUILD_TYPE mapping from SlintConfig.cmake:
  As discussed in https://github.com/slint-ui/slint/pull/1785#issuecomment-1294630845
  remove the mapping of the build types since corrosion now always sets
  the `IMPORTED_LOCATION` property.

User facing improvements enabled by the update:
- Corrosion will not fail anymore if the user has a Rust toolchain >=1.60
  installed, but the default toolchain is < 1.60.
- Corrosion will respect OUTPUT_DIRECTORY properties and move target
  artifacts to the expected locations
2022-11-02 21:38:39 +01:00

28 lines
1.1 KiB
CMake

# Copyright © SixtyFPS GmbH <info@slint-ui.com>
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
@PACKAGE_INIT@
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
if(_IMPORT_PREFIX STREQUAL "/")
set(_IMPORT_PREFIX "")
endif()
add_library(slint-cpp-shared SHARED IMPORTED)
set_target_properties(slint-cpp-shared PROPERTIES @SLINT_LIB_PROPERTIES@)
if (@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}")
include("${CMAKE_CURRENT_LIST_DIR}/SlintMacro.cmake")
endif()
set(_IMPORT_PREFIX)
include("${CMAKE_CURRENT_LIST_DIR}/SlintTargets.cmake")
set(SLINT_STYLE @_SLINT_STYLE@ CACHE STRING "The Slint widget style")
set_property(GLOBAL PROPERTY SLINT_STYLE ${SLINT_STYLE})