CMake: Fix build on Windows with CMake 3.19
qt_setup_tool_path.bat did not have proper line endings on Windows with CMake 3.19, breaking the invocation of tools that use the wrapper, for example qmltyperegistrar. The reason was that file(CONFIGURE) doesn't properly write line endings with CMake 3.19. See upstream issue #21769. Use configure_file with a proper input file to work around this issue. Pick-to: 6.2 Fixes: QTBUG-98843 Change-Id: I2a4da15f306dc844cf83ca9721a77196c42af2ad Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
663c1b8827
commit
0bea727cac
@ -273,16 +273,9 @@ function(qt_internal_generate_tool_command_wrapper)
|
|||||||
set(bindir "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_BINDIR}")
|
set(bindir "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_BINDIR}")
|
||||||
file(TO_NATIVE_PATH "${bindir}" bindir)
|
file(TO_NATIVE_PATH "${bindir}" bindir)
|
||||||
set(tool_command_wrapper_path "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/qt_setup_tool_path.bat")
|
set(tool_command_wrapper_path "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/qt_setup_tool_path.bat")
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.18)
|
configure_file("${QT_CMAKE_DIR}/qt_setup_tool_path.bat.in"
|
||||||
# TODO: It doesn't make sense to generate wrapper at generator stage. Since file(CONFIGURE
|
"${tool_command_wrapper_path}" @ONLY
|
||||||
# was added in CMake 3.18, keep file(GENERATE for compatibility, until the minimum required
|
NEWLINE_STYLE WIN32)
|
||||||
# version is raised to 3.18.
|
|
||||||
file(GENERATE OUTPUT "${tool_command_wrapper_path}" CONTENT
|
|
||||||
"@echo off\r\nset PATH=${bindir}$<SEMICOLON>%PATH%\r\n%*")
|
|
||||||
else()
|
|
||||||
file(CONFIGURE OUTPUT "${tool_command_wrapper_path}" CONTENT
|
|
||||||
"@echo off\r\nset PATH=${bindir};%PATH%\r\n%*")
|
|
||||||
endif()
|
|
||||||
set(QT_TOOL_COMMAND_WRAPPER_PATH "${tool_command_wrapper_path}"
|
set(QT_TOOL_COMMAND_WRAPPER_PATH "${tool_command_wrapper_path}"
|
||||||
CACHE INTERNAL "Path to the wrapper of the tool commands")
|
CACHE INTERNAL "Path to the wrapper of the tool commands")
|
||||||
set_property(GLOBAL PROPERTY _qt_internal_generate_tool_command_wrapper_called TRUE)
|
set_property(GLOBAL PROPERTY _qt_internal_generate_tool_command_wrapper_called TRUE)
|
||||||
|
3
cmake/qt_setup_tool_path.bat.in
Normal file
3
cmake/qt_setup_tool_path.bat.in
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
@echo off
|
||||||
|
set PATH=@bindir@;%PATH%
|
||||||
|
%*
|
Loading…
Reference in New Issue
Block a user