summaryrefslogtreecommitdiffstats
path: root/cmake/QtBuild.cmake
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2019-09-24 11:42:15 +0200
committerTobias Hunger <tobias.hunger@qt.io>2019-10-21 11:28:55 +0000
commit1c2db890275f3db54242a8866c2ea50a496efb04 (patch)
tree4b0227a24c9621c98677d13f7104207996aee2f3 /cmake/QtBuild.cmake
parentf8c1909320313c8a9c03661d8fe77728bde6556a (diff)
Write out a module description file
Write out a file with some JSON data to describe a module. This file contains information on how that module has been built. Change-Id: I8a604692663cbb7b76b96b97124130e30b822e4b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'cmake/QtBuild.cmake')
-rw-r--r--cmake/QtBuild.cmake20
1 files changed, 20 insertions, 0 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index 3b9e912edb..1e00677cbe 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -35,6 +35,7 @@ set(INSTALL_SYSCONFDIR "etc/xdg" CACHE PATH
"Settings used by Qt programs [PREFIX/etc/xdg]")
set(INSTALL_EXAMPLESDIR "examples" CACHE PATH "Examples [PREFIX/examples]")
set(INSTALL_TESTSDIR "tests" CACHE PATH "Tests [PREFIX/tests]")
+set(INSTALL_DESCRIPTIONSDIR "${INSTALL_DATADIR}/modules" CACHE PATH "Module description files directory")
# The variables might have already been set in QtBuildInternalsExtra.cmake if the file is included
# while building a new module and not QtBase. In that case, stop overriding the value.
@@ -63,6 +64,23 @@ SET(CMAKE_INSTALL_RPATH "${_default_install_rpath}" CACHE PATH "RPATH for instal
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+# Generate a module description file based on the template in ModuleDescription.json.in
+function(qt_describe_module target)
+ set(path_suffix "${INSTALL_DESCRIPTIONSDIR}")
+ qt_path_join(build_dir ${QT_BUILD_DIR} ${path_suffix})
+ qt_path_join(install_dir ${QT_INSTALL_DIR} ${path_suffix})
+
+ set(descfile_in "${QT_CMAKE_DIR}/ModuleDescription.json.in")
+ set(descfile_out "${build_dir}/${target}.json")
+ set(cross_compilation "false")
+ if(CMAKE_CROSSCOMPILE)
+ set(cross_compilation "true")
+ endif()
+ configure_file("${descfile_in}" "${descfile_out}")
+
+ qt_install(FILES "${descfile_out}" DESTINATION "${install_dir}")
+endfunction()
+
function(qt_setup_tool_path_command)
if(NOT WIN32)
return()
@@ -1632,6 +1650,8 @@ set(QT_CMAKE_EXPORT_NAMESPACE ${QT_CMAKE_EXPORT_NAMESPACE})")
if(NOT ${arg_NO_PRIVATE_MODULE})
target_include_directories("${target_private}" INTERFACE ${interface_includes})
endif()
+
+ qt_describe_module(${target})
endfunction()
function(qt_export_tools module_name)