2018-10-24 13:20:27 +00:00
|
|
|
@PACKAGE_INIT@
|
|
|
|
|
2020-11-30 07:46:49 +00:00
|
|
|
cmake_minimum_required(VERSION @min_new_policy_version@...@max_new_policy_version@)
|
2018-10-24 13:20:27 +00:00
|
|
|
|
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
|
|
|
|
2020-12-15 17:09:32 +00:00
|
|
|
if(NOT "${QT_HOST_PATH}" STREQUAL "")
|
|
|
|
find_package(Qt@PROJECT_VERSION_MAJOR@HostInfo
|
|
|
|
CONFIG
|
|
|
|
REQUIRED
|
|
|
|
PATHS "${QT_HOST_PATH}"
|
|
|
|
"${QT_HOST_PATH_CMAKE_DIR}"
|
|
|
|
NO_CMAKE_FIND_ROOT_PATH
|
|
|
|
NO_DEFAULT_PATH)
|
|
|
|
endif()
|
|
|
|
|
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-06-25 15:53:53 +00:00
|
|
|
if(APPLE AND (NOT CMAKE_SYSTEM_NAME OR CMAKE_SYSTEM_NAME STREQUAL "Darwin"))
|
|
|
|
# Add module directory to pick up custom Info.plist template for 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
|
|
|
list(APPEND CMAKE_MODULE_PATH "${_qt_import_prefix}/macos")
|
2021-04-14 16:16:44 +00:00
|
|
|
elseif(APPLE AND CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
|
|
|
# Add module directory to pick up custom Info.plist template for iOS
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${_qt_import_prefix}/ios")
|
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
|
|
|
endif()
|
|
|
|
|
2021-02-24 15:07:37 +00:00
|
|
|
set(QT_ADDITIONAL_PACKAGES_PREFIX_PATH "" CACHE STRING "Additional directories where find(Qt6 ...) components are searched")
|
|
|
|
file(TO_CMAKE_PATH "${QT_ADDITIONAL_PACKAGES_PREFIX_PATH}" _qt_additional_packages_prefix_path)
|
|
|
|
file(TO_CMAKE_PATH "$ENV{QT_ADDITIONAL_PACKAGES_PREFIX_PATH}" _qt_additional_packages_prefix_path_env)
|
|
|
|
|
2021-04-28 13:25:18 +00:00
|
|
|
# Public helpers available to all Qt packages.
|
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/QtFeature.cmake")
|
2021-05-19 17:46:24 +00:00
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicFinalizerHelpers.cmake")
|
2021-04-28 13:25:18 +00:00
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicPluginHelpers.cmake")
|
2021-04-29 10:47:52 +00:00
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicTargetHelpers.cmake")
|
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicWalkLibsHelpers.cmake")
|
2021-06-14 14:24:57 +00:00
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicFindPackageHelpers.cmake")
|
2021-06-17 14:18:59 +00:00
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicDependencyHelpers.cmake")
|
2021-04-28 13:25:18 +00:00
|
|
|
|
2021-06-10 17:01:35 +00:00
|
|
|
if(NOT DEFINED QT_CMAKE_EXPORT_NAMESPACE)
|
|
|
|
set(QT_CMAKE_EXPORT_NAMESPACE @QT_CMAKE_EXPORT_NAMESPACE@)
|
|
|
|
endif()
|
|
|
|
|
2021-06-24 10:30:32 +00:00
|
|
|
# Propagate sanitizer flags to both internal Qt builds and user projects.
|
|
|
|
# Allow opt-out in case if downstream projects handle it in a different way.
|
|
|
|
set(QT_CONFIGURED_SANITIZER_OPTIONS "@ECM_ENABLE_SANITIZERS@")
|
|
|
|
|
|
|
|
if(QT_CONFIGURED_SANITIZER_OPTIONS
|
|
|
|
AND NOT __qt_sanitizer_options_set
|
|
|
|
AND NOT QT_NO_ADD_SANITIZER_OPTIONS)
|
|
|
|
set(ECM_ENABLE_SANITIZERS "${QT_CONFIGURED_SANITIZER_OPTIONS}")
|
|
|
|
include(
|
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/3rdparty/extra-cmake-modules/modules/ECMEnableSanitizers.cmake")
|
|
|
|
endif()
|
|
|
|
# Mark that the current directory scope has its sanitizer flags set.
|
|
|
|
set(__qt_sanitizer_options_set TRUE)
|
|
|
|
|
2020-08-03 14:28:16 +00:00
|
|
|
# Find required dependencies, if any.
|
|
|
|
include(CMakeFindDependencyMacro)
|
|
|
|
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@Dependencies.cmake")
|
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@Dependencies.cmake")
|
2020-09-14 07:06:58 +00:00
|
|
|
if(NOT @INSTALL_CMAKE_NAMESPACE@_DEPENDENCIES_FOUND)
|
|
|
|
set(@INSTALL_CMAKE_NAMESPACE@_FOUND FALSE)
|
|
|
|
message(FATAL_ERROR "Failed to find Qt Platform dependency: "
|
|
|
|
"${@INSTALL_CMAKE_NAMESPACE@_DEPENDENCY_NOT_FOUND_MESSAGE}")
|
|
|
|
endif()
|
2020-08-03 14:28:16 +00:00
|
|
|
endif()
|
|
|
|
|
2020-09-25 18:02:56 +00:00
|
|
|
set(__qt_use_no_default_path_for_qt_packages "NO_DEFAULT_PATH")
|
|
|
|
if(QT_DISABLE_NO_DEFAULT_PATH_IN_QT_PACKAGES)
|
|
|
|
set(__qt_use_no_default_path_for_qt_packages "")
|
|
|
|
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}
|
2020-09-25 18:02:56 +00:00
|
|
|
PATHS
|
|
|
|
${_qt_cmake_dir}
|
2021-02-24 15:07:37 +00:00
|
|
|
${_qt_additional_packages_prefix_path}
|
|
|
|
${_qt_additional_packages_prefix_path_env}
|
2020-09-25 18:02:56 +00:00
|
|
|
${QT_EXAMPLES_CMAKE_PREFIX_PATH}
|
|
|
|
${__qt_use_no_default_path_for_qt_packages}
|
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()
|
2021-06-11 07:54:47 +00:00
|
|
|
|
|
|
|
__qt_internal_defer_promote_targets_in_dir_scope_to_global()
|
2021-06-29 16:00:39 +00:00
|
|
|
if(CMAKE_VERSION VERSION_LESS 3.21)
|
|
|
|
__qt_internal_check_link_order_matters()
|
|
|
|
__qt_internal_check_cmp0099_available()
|
|
|
|
endif()
|