diff options
author | Michal Klocek <michal.klocek@qt.io> | 2021-09-17 16:13:54 +0200 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2021-09-28 06:15:14 +0000 |
commit | 405007644edc3473bb1eec4cf2c3d15e9431da21 (patch) | |
tree | 101faf51d76b38612038cdb698b30c84c896f450 | |
parent | 9f7c426568bf01bd8ab3dbe29233240c8bfd0850 (diff) |
Fix gn moc path pointing to debug moc for super build
In 53e99bd we used genex to get moc path, this works well,
but not for mulitconifg build where genex will output path
to debug moc in case of superbuild.
To fix issues like that cmake 3.20 introduces
$<OUTPUT_CONFIG:...> and $<COMMAND_CONFIG:...>
generator-expressions, however it will not help much since
they do not work with file(GENERATE), moreover minimal
current version is 3.19
Use target property to query moc location or recreate
path in case of superbuild.
Fixes: QTBUG-96375
Pick-to: 6.2
Change-Id: Ief0fc32d57a36191694102ed010314b5d3395334
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r-- | cmake/Functions.cmake | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake index c66e65e71..37fd593a9 100644 --- a/cmake/Functions.cmake +++ b/cmake/Functions.cmake @@ -76,6 +76,11 @@ function(get_qt_features outList module) endfunction() function(create_cxx_config cmakeTarget arch configFileName) + if(NOT QT_SUPERBUILD) + get_target_property(mocFilePath Qt6::moc IMPORTED_LOCATION) + else() + set(mocFilePath "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/moc${CMAKE_EXECUTABLE_SUFFIX}") + endif() file(GENERATE OUTPUT $<CONFIG>/${arch}/${configFileName} CONTENT "\ @@ -83,7 +88,7 @@ function(create_cxx_config cmakeTarget arch configFileName) set(GN_DEFINES \"$<TARGET_PROPERTY:COMPILE_DEFINITIONS>\")\n\ set(GN_LINK_OPTIONS \"$<TARGET_PROPERTY:LINK_OPTIONS>\")\n\ set(GN_CXX_COMPILE_OPTIONS \"$<TARGET_PROPERTY:COMPILE_OPTIONS>\")\n\ - set(GN_MOC_PATH \"$<TARGET_FILE:Qt::moc>\")" + set(GN_MOC_PATH \"${mocFilePath}\")" # set(GN_LIBS $<TARGET_PROPERTY:LINK_LIBRARIES>) CONDITION $<COMPILE_LANGUAGE:CXX> TARGET ${cmakeTarget} |