diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-03-20 10:03:59 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-03-23 09:54:52 +0100 |
commit | 16df037f9dcced9b3efc7457e50491ce0363e125 (patch) | |
tree | 79fa3662e5146594f43b5f3015c5a996a0f7a428 | |
parent | 1f442c684fa68ff9ebbc8ffd1b92a6c1d5f87b83 (diff) |
CMake: Fix metatype file generation not to happen in the source dir
When building qtdeclarative in a non-prefix configuration,
metatypes.json files were created in the source dir. This happened
because the default arg_INSTALL_DIR value is relative in
qt6_generate_meta_types_json_file, and thus a file(TOUCH) with a
relative path creats it in the source dir.
The fix is to check if it's relative during a non-prefix build,
and make it absolute (relative to the install prefix, which is the
qtbase build dir).
Change-Id: Ie9abbd5d93a64e79184d77655d8d8399e894fde5
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
-rw-r--r-- | src/corelib/Qt6CoreMacros.cmake | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake index 4940eaa44d..4a1e4a6821 100644 --- a/src/corelib/Qt6CoreMacros.cmake +++ b/src/corelib/Qt6CoreMacros.cmake @@ -768,6 +768,13 @@ function(qt6_generate_meta_types_json_file target) file(MAKE_DIRECTORY "${target_binary_dir}/meta_types") file(TOUCH ${metatypes_file}) endif() + + # Need to make the path absolute during a Qt non-prefix build, otherwise files are written + # to the source dir because the paths are relative to the source dir when using file(TOUCH). + if(arg_COPY_OVER_INSTALL AND NOT IS_ABSOLUTE "${arg_INSTALL_DIR}/${metatypes_file_name}") + set(arg_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${arg_INSTALL_DIR}") + endif() + if (arg_COPY_OVER_INSTALL AND NOT EXISTS ${arg_INSTALL_DIR}/${metatypes_file_name}) file(MAKE_DIRECTORY "${arg_INSTALL_DIR}") file(TOUCH "${arg_INSTALL_DIR}/${metatypes_file_name}") |