Add optional QT_AUTOTOOL_EXECUTABLE_CONFIG

This addition helps when using the Visual Studio generator to build Qt 6.
This commit is contained in:
K. R. Walker 2021-11-22 10:06:11 -07:00 committed by GitHub
parent 8ce3693856
commit 6c0cdcb48c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 1 deletions

View File

@ -23,8 +23,20 @@ function(qt_enable_autogen_tool target tool enable)
if(NOT autogen_target_depends)
set(autogen_target_depends "")
endif()
set(tool_executable "$<TARGET_FILE:${QT_CMAKE_EXPORT_NAMESPACE}::${tool}>")
set(tool_target_name ${QT_CMAKE_EXPORT_NAMESPACE}::${tool})
set(tool_executable "$<TARGET_FILE:${tool_target_name}>")
# AUTO*_EXECUTABLE does not support multi-config generators as of
# CMake 3.21. Instead, we have to pick a preferred configuration.
# See: https://gitlab.kitware.com/cmake/cmake/-/issues/20074
get_property(multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(multi_config)
if(DEFINED QT_AUTOTOOL_EXECUTABLE_CONFIG)
set(config "${QT_AUTOTOOL_EXECUTABLE_CONFIG}")
else()
set(config "${QT_MULTI_CONFIG_FIRST_CONFIG}")
endif()
set(tool_executable "$<TARGET_FILE_DIR:${tool_target_name}>/${config}/$<TARGET_FILE_NAME:${tool_target_name}>")
endif()
if(enable)
list(APPEND autogen_target_depends ${tool_target_name})