From 6391c31dec339bcd1a402133c19ac6907ea6fbdd Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 10 Nov 2020 15:31:11 +0100 Subject: [PATCH] CMake: Potentially use INSTALL_LIBDIR in qt6_extract_metatypes The INSTALL_LIBDIR value is only set when doing a Qt build. Use it when available, otherwise default to a more 'hardcoded' value. Change-Id: I96b7b8094c699de59ffaff00cd677d8322c474c3 Reviewed-by: Christophe Giboudeaux Reviewed-by: Joerg Bornemann --- src/corelib/Qt6CoreMacros.cmake | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake index 288c2437cd1..cc5f58771fc 100644 --- a/src/corelib/Qt6CoreMacros.cmake +++ b/src/corelib/Qt6CoreMacros.cmake @@ -580,7 +580,7 @@ endif() # the --output-json parameter. # Params: # INSTALL_DIR: Location where to install the metatypes file. For public consumption, -# defaults to a ${CMAKE_INSTALL_PREFIX}/lib/metatypes directory. +# defaults to a ${CMAKE_INSTALL_PREFIX}/${INSTALL_LIBDIR}/metatypes directory. # Executable metatypes files are never installed. # COPY_OVER_INSTALL: (Qt Internal) When present will install the file via a post build step # copy rather than using install. @@ -614,7 +614,12 @@ function(qt6_extract_metatypes target) # Automatically fill default install args when not specified. if (NOT arg_INSTALL_DIR) - set(arg_INSTALL_DIR "lib/metatypes") + # INSTALL_LIBDIR is not set when QtBuildInternals is not loaded (when not doing a Qt build). + if(INSTALL_LIBDIR) + set(arg_INSTALL_DIR "${INSTALL_LIBDIR}/metatypes") + else() + set(arg_INSTALL_DIR "lib/metatypes") + endif() endif() get_target_property(target_binary_dir ${target} BINARY_DIR)