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
|
|
|
|
2021-07-22 14:23:51 +00:00
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@ConfigExtras.cmake")
|
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicCMakeVersionHelpers.cmake")
|
|
|
|
__qt_internal_require_suitable_cmake_version_for_using_qt()
|
|
|
|
|
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-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
|
2021-07-15 14:20:20 +00:00
|
|
|
set(__qt_internal_cmake_ios_support_files_path "${_qt_import_prefix}/ios")
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${__qt_internal_cmake_ios_support_files_path}")
|
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-04-28 13:25:18 +00:00
|
|
|
# Public helpers available to all Qt packages.
|
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/QtFeature.cmake")
|
2022-08-24 15:57:00 +00:00
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicAppleHelpers.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")
|
2022-08-15 12:12:08 +00:00
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicTestHelpers.cmake")
|
2022-01-27 15:28:47 +00:00
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicToolHelpers.cmake")
|
2021-12-29 17:00:52 +00:00
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicCMakeHelpers.cmake")
|
2021-04-28 13:25:18 +00:00
|
|
|
|
2022-09-13 15:27:42 +00:00
|
|
|
set(QT_ADDITIONAL_PACKAGES_PREFIX_PATH "" CACHE STRING
|
|
|
|
"Additional directories where find(Qt6 ...) components are searched")
|
|
|
|
set(QT_ADDITIONAL_HOST_PACKAGES_PREFIX_PATH "" CACHE STRING
|
|
|
|
"Additional directories where find(Qt6 ...) host Qt components are searched")
|
|
|
|
|
|
|
|
__qt_internal_collect_additional_prefix_paths(_qt_additional_packages_prefix_paths
|
|
|
|
QT_ADDITIONAL_PACKAGES_PREFIX_PATH)
|
|
|
|
__qt_internal_collect_additional_prefix_paths(_qt_additional_host_packages_prefix_paths
|
|
|
|
QT_ADDITIONAL_HOST_PACKAGES_PREFIX_PATH)
|
|
|
|
|
2022-09-13 15:23:55 +00:00
|
|
|
__qt_internal_prefix_paths_to_roots(_qt_additional_host_packages_root_paths
|
|
|
|
"${_qt_additional_host_packages_prefix_paths}")
|
|
|
|
|
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")
|
2022-07-14 13:28:12 +00:00
|
|
|
|
2022-07-14 15:00:56 +00:00
|
|
|
_qt_internal_suggest_dependency_debugging(@INSTALL_CMAKE_NAMESPACE@
|
2022-07-14 13:28:12 +00:00
|
|
|
__qt_@INSTALL_CMAKE_NAMESPACE@_pkg ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE)
|
|
|
|
|
2022-07-13 15:44:55 +00:00
|
|
|
if(NOT @INSTALL_CMAKE_NAMESPACE@_FOUND)
|
|
|
|
# Clear the components, no need to look for them if dependencies were not found, otherwise
|
|
|
|
# you get a wall of recursive error messages.
|
|
|
|
set(@INSTALL_CMAKE_NAMESPACE@_FIND_COMPONENTS "")
|
2020-09-14 07:06:58 +00:00
|
|
|
endif()
|
2020-08-03 14:28:16 +00:00
|
|
|
endif()
|
|
|
|
|
2021-08-04 10:23:14 +00:00
|
|
|
set(_@INSTALL_CMAKE_NAMESPACE@_FIND_PARTS_QUIET)
|
|
|
|
if(@INSTALL_CMAKE_NAMESPACE@_FIND_QUIETLY)
|
|
|
|
set(_@INSTALL_CMAKE_NAMESPACE@_FIND_PARTS_QUIET QUIET)
|
|
|
|
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})
|
2021-08-04 15:36:22 +00:00
|
|
|
if(NOT "${QT_HOST_PATH}" STREQUAL ""
|
|
|
|
AND "${module}" MATCHES "Tools$"
|
2022-01-26 13:33:31 +00:00
|
|
|
AND NOT "${module}" MATCHES "UiTools$"
|
2021-08-04 15:36:22 +00:00
|
|
|
AND NOT "${module}" MATCHES "ShaderTools$"
|
|
|
|
AND NOT "${module}" MATCHES "^Tools$"
|
|
|
|
AND NOT QT_NO_FIND_HOST_TOOLS_PATH_MANIPULATION)
|
|
|
|
# Make sure that a Qt*Tools package is also looked up in QT_HOST_PATH.
|
|
|
|
# But don't match QtShaderTools and QtTools which are cross-compiled target package names.
|
|
|
|
# Allow opt out just in case.
|
2021-10-20 15:52:00 +00:00
|
|
|
get_filename_component(__qt_find_package_host_qt_path
|
|
|
|
"${Qt@PROJECT_VERSION_MAJOR@HostInfo_DIR}/.." ABSOLUTE)
|
2021-08-04 15:36:22 +00:00
|
|
|
set(__qt_backup_cmake_prefix_path "${CMAKE_PREFIX_PATH}")
|
|
|
|
set(__qt_backup_cmake_find_root_path "${CMAKE_FIND_ROOT_PATH}")
|
2022-01-11 16:44:10 +00:00
|
|
|
list(PREPEND CMAKE_PREFIX_PATH "${__qt_find_package_host_qt_path}"
|
|
|
|
${_qt_additional_host_packages_prefix_paths})
|
|
|
|
list(PREPEND CMAKE_FIND_ROOT_PATH "${QT_HOST_PATH}"
|
|
|
|
${_qt_additional_host_packages_root_paths})
|
2021-08-04 15:36:22 +00:00
|
|
|
endif()
|
|
|
|
|
2022-07-14 15:00:56 +00:00
|
|
|
_qt_internal_save_find_package_context_for_debugging(@INSTALL_CMAKE_NAMESPACE@${module})
|
|
|
|
|
2022-07-19 16:37:04 +00:00
|
|
|
if(NOT @INSTALL_CMAKE_NAMESPACE@${module}_FOUND)
|
|
|
|
find_package(@INSTALL_CMAKE_NAMESPACE@${module}
|
|
|
|
${@INSTALL_CMAKE_NAMESPACE@_FIND_VERSION}
|
|
|
|
${_@INSTALL_CMAKE_NAMESPACE@_FIND_PARTS_QUIET}
|
|
|
|
PATHS
|
|
|
|
${_qt_cmake_dir}
|
|
|
|
${_qt_additional_packages_prefix_paths}
|
|
|
|
${QT_EXAMPLES_CMAKE_PREFIX_PATH}
|
|
|
|
${__qt_find_package_host_qt_path}
|
|
|
|
${_qt_additional_host_packages_prefix_paths}
|
|
|
|
${__qt_use_no_default_path_for_qt_packages}
|
|
|
|
)
|
|
|
|
endif()
|
2021-08-04 15:36:22 +00:00
|
|
|
|
|
|
|
if(NOT "${__qt_find_package_host_qt_path}" STREQUAL "")
|
|
|
|
set(CMAKE_PREFIX_PATH "${__qt_backup_cmake_prefix_path}")
|
|
|
|
set(CMAKE_FIND_ROOT_PATH "${__qt_backup_cmake_find_root_path}")
|
|
|
|
unset(__qt_backup_cmake_prefix_path)
|
|
|
|
unset(__qt_backup_cmake_find_root_path)
|
|
|
|
unset(__qt_find_package_host_qt_path)
|
|
|
|
endif()
|
|
|
|
|
2019-02-11 10:34:35 +00:00
|
|
|
if (NOT @INSTALL_CMAKE_NAMESPACE@${module}_FOUND)
|
2021-08-02 14:02:04 +00:00
|
|
|
set(_qt_expected_component_config_path
|
|
|
|
"${_qt_cmake_dir}/@INSTALL_CMAKE_NAMESPACE@${module}/@INSTALL_CMAKE_NAMESPACE@${module}Config.cmake")
|
|
|
|
get_filename_component(
|
|
|
|
_qt_expected_component_dir_path "${_qt_expected_component_config_path}" DIRECTORY)
|
|
|
|
|
|
|
|
set(_qt_component_not_found_msg
|
|
|
|
"\nExpected Config file at \"${_qt_expected_component_config_path}\"")
|
|
|
|
|
|
|
|
if(EXISTS "${_qt_expected_component_config_path}")
|
|
|
|
string(APPEND _qt_component_not_found_msg " exists \n")
|
|
|
|
else()
|
|
|
|
string(APPEND _qt_component_not_found_msg " does NOT exist\n")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(_qt_candidate_component_dir_path "${@INSTALL_CMAKE_NAMESPACE@${module}_DIR}")
|
|
|
|
|
|
|
|
if(_qt_candidate_component_dir_path AND
|
|
|
|
NOT _qt_expected_component_dir_path STREQUAL _qt_candidate_component_dir_path)
|
|
|
|
string(APPEND _qt_component_not_found_msg
|
|
|
|
"\n@INSTALL_CMAKE_NAMESPACE@${module}_DIR was computed by CMake or specified on the "
|
|
|
|
"command line by the user: \"${_qt_candidate_component_dir_path}\" "
|
|
|
|
"\nThe expected and computed paths are different, which might be the reason for "
|
|
|
|
"the package not to be found.")
|
|
|
|
endif()
|
2018-10-24 13:20:27 +00:00
|
|
|
|
2021-08-02 14:02:04 +00:00
|
|
|
if(@INSTALL_CMAKE_NAMESPACE@_FIND_REQUIRED_${module})
|
2022-07-14 13:28:12 +00:00
|
|
|
set(@INSTALL_CMAKE_NAMESPACE@_FOUND False)
|
2021-08-02 14:02:04 +00:00
|
|
|
set(_Qt_NOTFOUND_MESSAGE
|
2022-07-13 17:24:52 +00:00
|
|
|
"${_Qt_NOTFOUND_MESSAGE}Failed to find required Qt component \"${module}\". ${_qt_component_not_found_msg}")
|
2022-07-14 13:28:12 +00:00
|
|
|
set(_qt_full_component_name "@INSTALL_CMAKE_NAMESPACE@${module}")
|
2022-07-14 15:00:56 +00:00
|
|
|
_qt_internal_suggest_dependency_debugging(${_qt_full_component_name}
|
|
|
|
_qt_full_component_name _Qt_NOTFOUND_MESSAGE)
|
2022-07-14 13:28:12 +00:00
|
|
|
unset(_qt_full_component_name)
|
2022-07-13 16:11:54 +00:00
|
|
|
break()
|
2019-06-03 18:47:37 +00:00
|
|
|
elseif(NOT @INSTALL_CMAKE_NAMESPACE@_FIND_QUIETLY)
|
2021-08-02 14:02:04 +00:00
|
|
|
message(WARNING
|
2022-07-13 17:24:52 +00:00
|
|
|
"Failed to find optional Qt component \"${module}\". ${_qt_component_not_found_msg}")
|
2018-10-24 13:20:27 +00:00
|
|
|
endif()
|
|
|
|
|
2021-08-02 14:02:04 +00:00
|
|
|
unset(_qt_expected_component_config_path)
|
|
|
|
unset(_qt_expected_component_dir_path)
|
|
|
|
unset(_qt_candidate_component_dir_path)
|
|
|
|
unset(_qt_component_not_found_msg)
|
2018-10-24 13:20:27 +00:00
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
2021-08-02 14:02:04 +00:00
|
|
|
if(@INSTALL_CMAKE_NAMESPACE@_FIND_COMPONENTS AND _Qt_NOTFOUND_MESSAGE)
|
2019-02-11 10:34:35 +00:00
|
|
|
set(@INSTALL_CMAKE_NAMESPACE@_NOT_FOUND_MESSAGE "${_Qt_NOTFOUND_MESSAGE}")
|
2021-08-02 14:02:04 +00:00
|
|
|
unset(_Qt_NOTFOUND_MESSAGE)
|
2018-10-24 13:20:27 +00:00
|
|
|
endif()
|
2021-06-11 07:54:47 +00:00
|
|
|
|
2022-07-26 13:51:02 +00:00
|
|
|
if(@INSTALL_CMAKE_NAMESPACE@_FOUND
|
|
|
|
AND COMMAND _qt_internal_override_example_install_dir_to_dot
|
|
|
|
AND NOT _qt_internal_example_dir_set_to_dot)
|
|
|
|
_qt_internal_override_example_install_dir_to_dot()
|
|
|
|
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()
|