slint/api/cpp/cmake/SlintConfig.cmake.in
Simon Hausmann df2d6442d4 Make it possible to disable the slint compiler from the CMake build
This isn't always needed, for example when using only the interpreter API,
and its dependency to native libraries on Linux (namely fontconfig) makes it difficult to cross-compile with
CMake.

While cargo is invoked correctly for the native binary build, the library search paths
coming from CMake will be target specific, not host specific.

So for now this provides a way of disabling the compiler.
2022-03-22 12:59:52 +01:00

33 lines
1.3 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@)
foreach(build_type Release RelWithDebInfo MinSizeRel Debug)
string(TOUPPER "${build_type}" config_name)
if(NOT("@CMAKE_BUILD_TYPE@" STREQUAL build_type))
set_target_properties(slint-cpp-shared PROPERTIES MAP_IMPORTED_CONFIG_${config_name} "@CMAKE_BUILD_TYPE@")
endif()
endforeach()
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_DEFAULT@ CACHE STRING "The Slint widget style")