2018-10-24 13:20:27 +00:00
|
|
|
@PACKAGE_INIT@
|
|
|
|
|
2020-03-25 12:43:33 +00:00
|
|
|
if (CMAKE_CROSSCOMPILING AND CMAKE_SYSROOT)
|
|
|
|
# When cross compiling with CMake any calls to pkg_check_modules() will
|
|
|
|
# search into the host system instead of the target sysroot.
|
|
|
|
# The current work around is based on the discussion found at
|
|
|
|
# https://gitlab.kitware.com/cmake/cmake/-/merge_requests/4478
|
|
|
|
set(ENV{PKG_CONFIG_DIR} "")
|
|
|
|
set(ENV{PKG_CONFIG_LIBDIR} "${CMAKE_SYSROOT}/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig")
|
|
|
|
set(ENV{PKG_CONFIG_SYSROOT_DIR} ${CMAKE_SYSROOT})
|
|
|
|
endif()
|
|
|
|
|
2019-06-14 10:59:07 +00:00
|
|
|
# Slightly amended version of ./src/corelib/Qt6Config.cmake.in
|
2018-10-24 13:20:27 +00:00
|
|
|
if (CMAKE_VERSION VERSION_LESS 3.1.0)
|
|
|
|
message(FATAL_ERROR "Qt requires at least CMake version 3.1.0")
|
|
|
|
endif()
|
|
|
|
|
2019-02-11 10:34:35 +00:00
|
|
|
get_filename_component(_qt_cmake_dir "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE)
|
2019-09-19 11:46:37 +00:00
|
|
|
set(_qt_@PROJECT_VERSION_MAJOR@_config_cmake_dir "${CMAKE_CURRENT_LIST_DIR}")
|
2018-10-24 13:20:27 +00:00
|
|
|
|
2019-06-04 15:08:47 +00:00
|
|
|
if (NOT QT_NO_CREATE_TARGETS)
|
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@Targets.cmake")
|
2019-12-05 12:54:07 +00:00
|
|
|
if(NOT QT_NO_CREATE_VERSIONLESS_TARGETS)
|
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@VersionlessTargets.cmake")
|
|
|
|
endif()
|
2019-06-04 15:08:47 +00:00
|
|
|
else()
|
|
|
|
# For examples using `find_package(...)` inside their CMakeLists.txt files:
|
|
|
|
# Make CMake's AUTOGEN detect this Qt version properly
|
|
|
|
set_directory_properties(PROPERTIES
|
|
|
|
QT_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
|
2019-12-11 15:14:22 +00:00
|
|
|
QT_VERSION_MINOR @PROJECT_VERSION_MINOR@
|
|
|
|
QT_VERSION_PATCH @PROJECT_VERSION_PATCH@)
|
2019-06-04 15:08:47 +00:00
|
|
|
endif()
|
2019-05-03 10:30:09 +00:00
|
|
|
|
2019-02-11 10:34:35 +00:00
|
|
|
# if (NOT @INSTALL_CMAKE_NAMESPACE@_FIND_COMPONENTS)
|
|
|
|
# set(@INSTALL_CMAKE_NAMESPACE@_NOT_FOUND_MESSAGE "The Qt package requires at least one component")
|
|
|
|
# set(@INSTALL_CMAKE_NAMESPACE@_FOUND False)
|
2018-10-24 13:20:27 +00:00
|
|
|
# return()
|
|
|
|
# endif()
|
|
|
|
|
2019-09-30 11:22:15 +00:00
|
|
|
get_filename_component(_qt_import_prefix "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
|
|
|
get_filename_component(_qt_import_prefix "${_qt_import_prefix}" REALPATH)
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${_qt_import_prefix}")
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${_qt_import_prefix}/3rdparty/extra-cmake-modules/find-modules")
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${_qt_import_prefix}/3rdparty/kwin")
|
|
|
|
|
2020-03-16 12:36:47 +00:00
|
|
|
if(MACOS)
|
cmake: Add default Info.plist for macOS with some important keys
The default Info.plist shipped with CMake lacks an NSPrincipalClass
entry, which is crucial for making macOS apps run in full resolution
on retina screens.
We make sure the file is only picked up on macOS, not iOS and friends,
since those platforms require another principal class. If needed we can
extract the value out as a CMake variable and use the same file for all
Apple platforms. Doing so would assume all keys are single-platform
only, so if that's not the case we need platform-specific files.
We should probably extract the package type out as a variable too,
so that the file can be used for both apps, plugins, and frameworks,
but doing so requires setting up that variable somewhere based on
the target type, which CMake doesn't allow in an easy way.
The file itself is based on the file CMake ships, combined with
keys inherited from Qt's existing plist templates for qmake, and
adjusted to match what Xcode generates by default these days.
Change-Id: I3f5109e5fff63cdbd109a99d4008948d4bd2102b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-11 20:45:50 +00:00
|
|
|
# Add module directory to pick up custom Info.plist template
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${_qt_import_prefix}/macos")
|
|
|
|
endif()
|
|
|
|
|
2019-02-11 10:34:35 +00:00
|
|
|
foreach(module ${@INSTALL_CMAKE_NAMESPACE@_FIND_COMPONENTS})
|
|
|
|
find_package(@INSTALL_CMAKE_NAMESPACE@${module}
|
|
|
|
${_@INSTALL_CMAKE_NAMESPACE@_FIND_PARTS_QUIET}
|
|
|
|
${_@INSTALL_CMAKE_NAMESPACE@_FIND_PARTS_REQUIRED}
|
2019-09-19 11:46:37 +00:00
|
|
|
PATHS ${_qt_cmake_dir} ${QT_EXAMPLES_CMAKE_PREFIX_PATH} NO_DEFAULT_PATH
|
2018-10-24 13:20:27 +00:00
|
|
|
)
|
2019-02-11 10:34:35 +00:00
|
|
|
if (NOT @INSTALL_CMAKE_NAMESPACE@${module}_FOUND)
|
2018-10-24 13:20:27 +00:00
|
|
|
string(CONFIGURE ${_qt5_module_location_template} _expected_module_location @ONLY)
|
|
|
|
|
2019-02-11 10:34:35 +00:00
|
|
|
if (@INSTALL_CMAKE_NAMESPACE@_FIND_REQUIRED_${module})
|
2018-10-24 13:20:27 +00:00
|
|
|
set(_Qt_NOTFOUND_MESSAGE "${_Qt_NOTFOUND_MESSAGE}Failed to find Qt component \"${module}\" config file at \"${_expected_module_location}\"\n")
|
2019-06-03 18:47:37 +00:00
|
|
|
elseif(NOT @INSTALL_CMAKE_NAMESPACE@_FIND_QUIETLY)
|
2018-10-24 13:20:27 +00:00
|
|
|
message(WARNING "Failed to find Qt component \"${module}\" config file at \"${_expected_module_location}\"")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
unset(_expected_module_location)
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
if (_Qt_NOTFOUND_MESSAGE)
|
2019-02-11 10:34:35 +00:00
|
|
|
set(@INSTALL_CMAKE_NAMESPACE@_NOT_FOUND_MESSAGE "${_Qt_NOTFOUND_MESSAGE}")
|
|
|
|
set(@INSTALL_CMAKE_NAMESPACE@_FOUND False)
|
2018-10-24 13:20:27 +00:00
|
|
|
endif()
|