summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtModuleHelpers.cmake182
-rw-r--r--cmake/QtPostProcessHelpers.cmake10
-rw-r--r--cmake/QtPriHelpers.cmake3
-rw-r--r--cmake/QtSyncQtHelpers.cmake18
4 files changed, 161 insertions, 52 deletions
diff --git a/cmake/QtModuleHelpers.cmake b/cmake/QtModuleHelpers.cmake
index 19ce27d912..4bc001ee44 100644
--- a/cmake/QtModuleHelpers.cmake
+++ b/cmake/QtModuleHelpers.cmake
@@ -120,6 +120,14 @@ function(qt_internal_add_module target)
message(FATAL_ERROR "Invalid target type '${target_type}' for Qt module '${target}'")
endif()
+ if(NOT arg_NO_SYNC_QT AND NOT arg_NO_MODULE_HEADERS AND arg_MODULE_INCLUDE_NAME)
+ # qt_internal_module_info uses this property if it's set, so it must be
+ # specified before the qt_internal_module_info call.
+ set_target_properties(${target} PROPERTIES
+ _qt_module_include_name ${arg_MODULE_INCLUDE_NAME}
+ )
+ endif()
+
set_target_properties(${target} PROPERTIES
_qt_module_interface_name "${arg_MODULE_INTERFACE_NAME}"
)
@@ -264,19 +272,15 @@ function(qt_internal_add_module target)
endif()
endif()
- if(arg_MODULE_INCLUDE_NAME)
- set(module_include_name ${arg_MODULE_INCLUDE_NAME})
- else()
- set(module_include_name ${module})
- endif()
-
# Module headers:
set_property(TARGET "${target}" APPEND PROPERTY EXPORT_PROPERTIES _qt_module_has_headers)
if(${arg_NO_MODULE_HEADERS} OR ${arg_NO_SYNC_QT})
set_target_properties("${target}" PROPERTIES
_qt_module_has_headers OFF)
else()
- set_target_properties("${target}" PROPERTIES INTERFACE_MODULE_INCLUDE_NAME "${module_include_name}")
+ set_property(TARGET ${target} APPEND PROPERTY EXPORT_PROPERTIES _qt_module_include_name)
+ set_target_properties("${target}" PROPERTIES
+ _qt_module_include_name "${module_include_name}")
# Use QT_BUILD_DIR for the syncqt call.
# So we either write the generated files into the qtbase non-prefix build root, or the
@@ -300,9 +304,9 @@ function(qt_internal_add_module target)
_qt_module_has_headers ON)
### FIXME: Can we replace headers.pri?
- set(module_include_dir "${QT_BUILD_DIR}/include/${module_include_name}")
- qt_read_headers_pri("${module_include_dir}" "module_headers")
- set(module_depends_header "${module_include_dir}/${module_include_name}Depends")
+ qt_read_headers_pri("${module_build_interface_include_dir}" "module_headers")
+ set(module_depends_header
+ "${module_build_interface_include_dir}/${module_include_name}Depends")
if(is_framework)
if(NOT is_interface_lib)
set(public_headers_to_copy "${module_headers_public}" "${module_depends_header}")
@@ -315,7 +319,8 @@ function(qt_internal_add_module target)
set_property(TARGET ${target} APPEND PROPERTY PRIVATE_HEADER "${module_headers_private}")
endif()
if (NOT ${arg_HEADER_MODULE})
- set_property(TARGET "${target}" PROPERTY MODULE_HEADER "${module_include_dir}/${module_include_name}")
+ set_property(TARGET "${target}" PROPERTY MODULE_HEADER
+ "${module_build_interface_include_dir}/${module_include_name}")
endif()
if(module_headers_qpa)
@@ -324,7 +329,7 @@ function(qt_internal_add_module target)
else()
qt_install(
FILES ${module_headers_qpa}
- DESTINATION ${INSTALL_INCLUDEDIR}/${module}/${PROJECT_VERSION}/${module_include_name}/qpa)
+ DESTINATION "${module_install_interface_versioned_inner_include_dir}/qpa")
endif()
endif()
endif()
@@ -376,20 +381,20 @@ function(qt_internal_add_module target)
# Make sure to create such paths for both the the BUILD_INTERFACE and the INSTALL_INTERFACE.
#
# Only add syncqt headers if they exist.
- # This handles cases like QmlDevTools which do not have their own headers, but borrow them
+ # This handles cases like QmlDevToolsPrivate which do not have their own headers, but borrow them
# from another module.
if(NOT arg_NO_SYNC_QT AND NOT arg_NO_MODULE_HEADERS)
# Don't include private headers unless they exist, aka syncqt created them.
if(module_headers_private)
list(APPEND private_includes
- "$<BUILD_INTERFACE:${module_include_dir}/${PROJECT_VERSION}>"
- "$<BUILD_INTERFACE:${module_include_dir}/${PROJECT_VERSION}/${module}>")
+ "$<BUILD_INTERFACE:${module_build_interface_versioned_include_dir}>"
+ "$<BUILD_INTERFACE:${module_build_interface_versioned_inner_include_dir}>")
endif()
list(APPEND public_includes
# For the syncqt headers
- "$<BUILD_INTERFACE:${module_repo_include_dir}>"
- "$<BUILD_INTERFACE:${module_include_dir}>")
+ "$<BUILD_INTERFACE:${repo_build_interface_include_dir}>"
+ "$<BUILD_INTERFACE:${module_build_interface_include_dir}>")
endif()
if(is_framework)
@@ -412,7 +417,8 @@ function(qt_internal_add_module target)
if(NOT arg_NO_MODULE_HEADERS AND NOT arg_NO_SYNC_QT)
# For the syncqt headers
- list(APPEND ${public_headers_list} "$<INSTALL_INTERFACE:${INSTALL_INCLUDEDIR}/${module}>")
+ list(APPEND ${public_headers_list}
+ "$<INSTALL_INTERFACE:${module_install_interface_include_dir}>")
# To support finding Qt module includes that are not installed into the main Qt prefix.
# Use case: A Qt module built by Conan installed into a prefix other than the main prefix.
@@ -642,8 +648,8 @@ set(QT_LIBINFIX \"${QT_LIBINFIX}\")")
LIBRARY DESTINATION ${INSTALL_LIBDIR}
ARCHIVE DESTINATION ${INSTALL_LIBDIR}
FRAMEWORK DESTINATION ${INSTALL_LIBDIR}
- PUBLIC_HEADER DESTINATION ${INSTALL_INCLUDEDIR}/${module_include_name}
- PRIVATE_HEADER DESTINATION ${INSTALL_INCLUDEDIR}/${module_include_name}/${PROJECT_VERSION}/${module}/private
+ PUBLIC_HEADER DESTINATION "${module_install_interface_include_dir}"
+ PRIVATE_HEADER DESTINATION "${module_install_interface_private_include_dir}"
)
if(BUILD_SHARED_LIBS)
@@ -681,7 +687,7 @@ set(QT_LIBINFIX \"${QT_LIBINFIX}\")")
set(interface_includes "")
- # Handle cases like QmlDevTools which do not have their own headers, but rather borrow them
+ # Handle cases like QmlDevToolsPrivate which do not have their own headers, but rather borrow them
# from another module.
if(NOT arg_NO_SYNC_QT)
list(APPEND interface_includes "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>")
@@ -692,10 +698,10 @@ set(QT_LIBINFIX \"${QT_LIBINFIX}\")")
# consumers of the module will fail at CMake generation time stating that
# INTERFACE_INCLUDE_DIRECTORIES contains a non-existent path.
if(NOT arg_NO_MODULE_HEADERS
- AND EXISTS "${module_include_dir}/${PROJECT_VERSION}/${module}")
+ AND EXISTS "${module_build_interface_versioned_inner_include_dir}")
list(APPEND interface_includes
- "$<BUILD_INTERFACE:${module_include_dir}/${PROJECT_VERSION}>"
- "$<BUILD_INTERFACE:${module_include_dir}/${PROJECT_VERSION}/${module}>")
+ "$<BUILD_INTERFACE:${module_build_interface_versioned_include_dir}>"
+ "$<BUILD_INTERFACE:${module_build_interface_versioned_inner_include_dir}>")
if(is_framework)
set(fw_install_private_header_dir "${INSTALL_LIBDIR}/${fw_private_header_dir}")
@@ -705,8 +711,8 @@ set(QT_LIBINFIX \"${QT_LIBINFIX}\")")
"$<INSTALL_INTERFACE:${fw_install_private_module_header_dir}>")
else()
list(APPEND interface_includes
- "$<INSTALL_INTERFACE:${INSTALL_INCLUDEDIR}/${module}/${PROJECT_VERSION}>"
- "$<INSTALL_INTERFACE:${INSTALL_INCLUDEDIR}/${module}/${PROJECT_VERSION}/${module}>")
+ "$<INSTALL_INTERFACE:${module_install_interface_versioned_include_dir}>"
+ "$<INSTALL_INTERFACE:${module_install_interface_versioned_inner_include_dir}>")
endif()
endif()
endif()
@@ -756,36 +762,136 @@ function(qt_finalize_module target)
endfunction()
# Get a set of Qt module related values based on the target.
-# When doing qt_internal_module_info(foo Core) this method will set
-# the following variables in the caller's scope:
+#
+# The function uses the _qt_module_interface_name and _qt_module_include_name target properties to
+# preform values for the output variables. _qt_module_interface_name it's the basic name of module
+# without "Qtfication" and the "Private" suffix if we speak about INTERNAL_MODULEs. Typical value of
+# the _qt_module_interface_name is the provided to qt_internal_add_module ${target} name, e.g. Core.
+# _qt_module_interface_name is used to preform all the include paths unless the
+# _qt_module_include_name property is specified. _qt_module_include_name is legacy property that
+# replaces the module name in include paths and has a higher priority than the
+# _qt_module_interface_name property.
+#
+# When doing qt_internal_module_info(foo Core) this method will set the following variables in
+# the caller's scope:
# * foo with the value "QtCore"
# * foo_versioned with the value "Qt6Core" (based on major Qt version)
# * foo_upper with the value "CORE"
# * foo_lower with the value "core"
-# * foo_repo_include_dir with the module's include directory
-# e.g for QtQuick it would be qtdeclarative_build_dir/include for a prefix build or
-# qtbase_build_dir/include for a non-prefix build
-# * foo_include_dir with the module's include directory
-# e.g for QtQuick it would be qtdeclarative_build_dir/include/QtQuick for a prefix build or
-# qtbase_build_dir/include/QtQuick for a non-prefix build
+# * foo_include_name with the value"QtCore"
+# Usually the module name from ${foo} is used, but the name might be different if the
+# MODULE_INCLUDE_NAME argument is set when creating the module.
+# * foo_versioned_include_dir with the value "QtCore/6.2.0"
+# * foo_versioned_inner_include_dir with the value "QtCore/6.2.0/QtCore"
+# * foo_private_include_dir with the value "QtCore/6.2.0/QtCore/private"
# * foo_interface_name the interface name of the module stored in _qt_module_interface_name
-# property.
+# property, e.g. Core.
+#
+# The function also sets a bunch of module include paths for the build and install interface.
+# Variables that contains these paths start with foo_build_interface_ and foo_install_interface_
+# accordingly.
+# The following variables are set in the caller's scope:
+# * foo_<build|install>_interface_include_dir with
+# qtbase_build_dir/include/QtCore for build interface and
+# include/QtCore for install interface.
+# * foo_<build|install>_interface_versioned_include_dir with
+# qtbase_build_dir/include/QtCore/6.2.0 for build interface and
+# include/QtCore/6.2.0 for install interface.
+# * foo_<build|install>_versioned_inner_include_dir with
+# qtbase_build_dir/include/QtCore/6.2.0/QtCore for build interface and
+# include/QtCore/6.2.0/QtCore for install interface.
+# * foo_<build|install>_private_include_dir with
+# qtbase_build_dir/include/QtCore/6.2.0/QtCore/private for build interface and
+# include/QtCore/6.2.0/QtCore/private for install interface.
+# The following values are set by the function and might be useful in caller's scope:
+# * repo_install_interface_include_dir contains path to the top-level repository include directory,
+# e.g. qtbase_build_dir/include
+# * repo_install_interface_include_dir contains path to the non-prefixed top-level include
+# directory is used for the installation, e.g. include
+# Note: that for non-prefixed Qt configurations the build interface paths will start with
+# <build_directory>/qtbase/include, e.g foo_build_interface_include_dir of the Qml module looks
+# like qt_toplevel_build_dir/qtbase/include/QtQml
function(qt_internal_module_info result target)
+ if(result STREQUAL "repo")
+ message(FATAL_ERROR "'repo' keyword is reserved for internal use, please specify \
+the different base name for the module info variables.")
+ endif()
+
get_target_property(module_interface_name ${target} _qt_module_interface_name)
if(NOT module_interface_name)
message(FATAL_ERROR "${target} is not a module.")
endif()
qt_internal_qtfy_target(module ${module_interface_name})
+
+ get_target_property("${result}_include_name" ${target} _qt_module_include_name)
+ if(NOT ${result}_include_name)
+ set("${result}_include_name" "${module}")
+ endif()
+
+ set("${result}_versioned_include_dir"
+ "${${result}_include_name}/${PROJECT_VERSION}")
+ set("${result}_versioned_inner_include_dir"
+ "${${result}_versioned_include_dir}/${${result}_include_name}")
+ set("${result}_private_include_dir"
+ "${${result}_versioned_inner_include_dir}/private")
+
+ # Module build interface directories
+ set(repo_build_interface_include_dir "${QT_BUILD_DIR}/include")
+ set("${result}_build_interface_include_dir"
+ "${repo_build_interface_include_dir}/${${result}_include_name}")
+ set("${result}_build_interface_versioned_include_dir"
+ "${repo_build_interface_include_dir}/${${result}_versioned_include_dir}")
+ set("${result}_build_interface_versioned_inner_include_dir"
+ "${repo_build_interface_include_dir}/${${result}_versioned_inner_include_dir}")
+ set("${result}_build_interface_private_include_dir"
+ "${repo_build_interface_include_dir}/${${result}_private_include_dir}")
+
+ # Module install interface direcotries
+ set(repo_install_interface_include_dir "${INSTALL_INCLUDEDIR}")
+ set("${result}_install_interface_include_dir"
+ "${repo_install_interface_include_dir}/${${result}_include_name}")
+ set("${result}_install_interface_versioned_include_dir"
+ "${repo_install_interface_include_dir}/${${result}_versioned_include_dir}")
+ set("${result}_install_interface_versioned_inner_include_dir"
+ "${repo_install_interface_include_dir}/${${result}_versioned_inner_include_dir}")
+ set("${result}_install_interface_private_include_dir"
+ "${repo_install_interface_include_dir}/${${result}_private_include_dir}")
+
set("${result}" "${module}" PARENT_SCOPE)
set("${result}_versioned" "${module_versioned}" PARENT_SCOPE)
string(TOUPPER "${module_interface_name}" upper)
- string(TOLOWER "${module_interface_name}" lower)# * foo_upper with the value "CORE"
+ string(TOLOWER "${module_interface_name}" lower)
set("${result}_upper" "${upper}" PARENT_SCOPE)
set("${result}_lower" "${lower}" PARENT_SCOPE)
- set("${result}_repo_include_dir" "${QT_BUILD_DIR}/include" PARENT_SCOPE)
- set("${result}_include_dir" "${QT_BUILD_DIR}/include/${module}" PARENT_SCOPE)
+ set("${result}_include_name" "${${result}_include_name}" PARENT_SCOPE)
+ set("${result}_versioned_include_dir" "${${result}_versioned_include_dir}" PARENT_SCOPE)
+ set("${result}_versioned_inner_include_dir"
+ "${${result}_versioned_inner_include_dir}" PARENT_SCOPE)
+ set("${result}_private_include_dir" "${${result}_private_include_dir}" PARENT_SCOPE)
set("${result}_interface_name" "${module_interface_name}" PARENT_SCOPE)
+
+ # Setting module build interface directories in parent scope
+ set(repo_build_interface_include_dir "${repo_build_interface_include_dir}" PARENT_SCOPE)
+ set("${result}_build_interface_include_dir"
+ "${${result}_build_interface_include_dir}" PARENT_SCOPE)
+ set("${result}_build_interface_versioned_include_dir"
+ "${${result}_build_interface_versioned_include_dir}" PARENT_SCOPE)
+ set("${result}_build_interface_versioned_inner_include_dir"
+ "${${result}_build_interface_versioned_inner_include_dir}" PARENT_SCOPE)
+ set("${result}_build_interface_private_include_dir"
+ "${${result}_build_interface_private_include_dir}" PARENT_SCOPE)
+
+ # Setting module install interface directories in parent scope
+ set(repo_install_interface_include_dir "${repo_install_interface_include_dir}" PARENT_SCOPE)
+ set("${result}_install_interface_include_dir"
+ "${${result}_install_interface_include_dir}" PARENT_SCOPE)
+ set("${result}_install_interface_versioned_include_dir"
+ "${${result}_install_interface_versioned_include_dir}" PARENT_SCOPE)
+ set("${result}_install_interface_versioned_inner_include_dir"
+ "${${result}_install_interface_versioned_inner_include_dir}" PARENT_SCOPE)
+ set("${result}_install_interface_private_include_dir"
+ "${${result}_install_interface_private_include_dir}" PARENT_SCOPE)
endfunction()
# Generate a module description file based on the template in ModuleDescription.json.in
diff --git a/cmake/QtPostProcessHelpers.cmake b/cmake/QtPostProcessHelpers.cmake
index 15cb45b6b4..35ca6eabee 100644
--- a/cmake/QtPostProcessHelpers.cmake
+++ b/cmake/QtPostProcessHelpers.cmake
@@ -1,6 +1,6 @@
-function(qt_internal_write_depends_file module)
- set(outfile "${QT_BUILD_DIR}/include/${module}/${module}Depends")
- set(contents "/* This file was generated by cmake with the info from ${module} target. */\n")
+function(qt_internal_write_depends_file target module_include_name)
+ set(outfile "${QT_BUILD_DIR}/include/${module_include_name}/${module_include_name}Depends")
+ set(contents "/* This file was generated by cmake with the info from ${target} target. */\n")
string(APPEND contents "#ifdef __cplusplus /* create empty PCH in C mode */\n")
foreach (m ${ARGN})
string(APPEND contents "# include <${m}/${m}>\n")
@@ -249,8 +249,8 @@ function(qt_internal_create_module_depends_file target)
get_target_property(hasModuleHeaders "${target}" _qt_module_has_headers)
if (${hasModuleHeaders})
- get_target_property(module_include_name "${target}" INTERFACE_MODULE_INCLUDE_NAME)
- qt_internal_write_depends_file(${module_include_name} ${qtdeps})
+ get_target_property(module_include_name "${target}" _qt_module_include_name)
+ qt_internal_write_depends_file(${target} ${module_include_name} ${qtdeps})
endif()
if(third_party_deps OR main_module_tool_deps OR target_deps)
diff --git a/cmake/QtPriHelpers.cmake b/cmake/QtPriHelpers.cmake
index cb20cfcf43..85767fadbe 100644
--- a/cmake/QtPriHelpers.cmake
+++ b/cmake/QtPriHelpers.cmake
@@ -340,7 +340,8 @@ ${framework_base_path}/${fw_private_module_header_dir}")
else()
set(public_module_includes "$$QT_MODULE_INCLUDE_BASE $$QT_MODULE_INCLUDE_BASE/${module}")
set(public_module_frameworks "")
- set(private_module_includes "$$QT_MODULE_INCLUDE_BASE/${module}/${PROJECT_VERSION} $$QT_MODULE_INCLUDE_BASE/${module}/${PROJECT_VERSION}/${module}")
+ set(private_module_includes "$$QT_MODULE_INCLUDE_BASE/${module_versioned_include_dir} \
+$$QT_MODULE_INCLUDE_BASE/${module_versioned_inner_include_dir}")
endif()
if(arg_HEADER_MODULE)
diff --git a/cmake/QtSyncQtHelpers.cmake b/cmake/QtSyncQtHelpers.cmake
index 5b851c778a..84a8e93d80 100644
--- a/cmake/QtSyncQtHelpers.cmake
+++ b/cmake/QtSyncQtHelpers.cmake
@@ -77,14 +77,14 @@ function(qt_install_injections target build_dir install_dir)
# This describes a concrete example for easier comprehension:
# A file 'qtqml-config.h' is generated by qt_internal_feature_write_file into
- # ${qtdeclarative_build_dir}/src/{module}/qtqml-config.h (part 1).
+ # ${qtdeclarative_build_dir}/src/{module_include_name}/qtqml-config.h (part 1).
#
# Generate a lower case forwarding header (part 2) 'qtqml-config.h' at the following
# location:
- # ${some_prefix}/include/${module}/qtqml-config.h.
+ # ${some_prefix}/include/${module_include_name}/qtqml-config.h.
#
# Inside this file, we #include the originally generated file,
- # ${qtdeclarative_build_dir}/src/{module}/qtqml-config.h.
+ # ${qtdeclarative_build_dir}/src/{module_include_name}/qtqml-config.h.
#
# ${some_prefix}'s value depends on the build type.
# If doing a prefix build, it should point to
@@ -93,7 +93,7 @@ function(qt_install_injections target build_dir install_dir)
# ${qtbase_build_dir}.
#
# In the code below, ${some_prefix} == ${build_dir}.
- set(lower_case_forwarding_header_path "${build_dir}/include/${module}")
+ set(lower_case_forwarding_header_path "${build_dir}/include/${module_include_name}")
if(destinationdir)
string(APPEND lower_case_forwarding_header_path "/${destinationdir}")
endif()
@@ -120,7 +120,8 @@ function(qt_install_injections target build_dir install_dir)
# to its install location when doing a prefix build. In an non-prefix build, the qt_install
# will be a no-op.
qt_path_join(install_destination
- ${install_dir} ${INSTALL_INCLUDEDIR} ${module} ${destinationdir})
+ ${install_dir} ${INSTALL_INCLUDEDIR}
+ ${module_include_name} ${destinationdir})
qt_install(FILES ${current_repo_build_dir}/${file}
DESTINATION ${install_destination}
RENAME ${destinationname} OPTIONAL)
@@ -128,7 +129,7 @@ function(qt_install_injections target build_dir install_dir)
# Generate UpperCaseNamed forwarding headers (part 3).
foreach(fwd_hdr ${fwd_hdrs})
- set(upper_case_forwarding_header_path "include/${module}")
+ set(upper_case_forwarding_header_path "include/${module_include_name}")
if(destinationdir)
string(APPEND upper_case_forwarding_header_path "/${destinationdir}")
endif()
@@ -143,7 +144,8 @@ function(qt_install_injections target build_dir install_dir)
"${build_dir}/${upper_case_forwarding_header_path}/${fwd_hdr}")
else()
# Install the forwarding header.
- qt_path_join(install_destination "${install_dir}" "${INSTALL_INCLUDEDIR}" ${module})
+ qt_path_join(install_destination "${install_dir}" "${INSTALL_INCLUDEDIR}"
+ ${module_include_name})
qt_install(FILES "${build_dir}/${upper_case_forwarding_header_path}/${fwd_hdr}"
DESTINATION ${install_destination} OPTIONAL)
endif()
@@ -191,7 +193,7 @@ function(qt_compute_injection_forwarding_header target)
file(RELATIVE_PATH relpath "${PROJECT_BINARY_DIR}" "${source_absolute_path}")
if (arg_PRIVATE)
- set(fwd "${PROJECT_VERSION}/${module}/private/${file_name}")
+ set(fwd "${PROJECT_VERSION}/${module_include_name}/private/${file_name}")
else()
set(fwd "${file_name}")
endif()