Fix qmlcachegen invocation on Windows, part 2

Fix up the previous commit and use separate COMMAND parameters for
add_custom_command to ensure the expansion of the PATH. The injection
via -E env "/some/dir;%PATH%" does not work as the dollar expansion is
not applied when the ninja command uses cmd /C. This relies now on
undocumented behavior of cmake ;(

Change-Id: I5b5fc88e4c13f8fb6c6bba3131204c2eb35404d6
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Simon Hausmann 2019-09-04 15:47:11 +02:00
parent 18fc9e1bf8
commit 4ee762cf25
2 changed files with 7 additions and 9 deletions

View File

@ -69,9 +69,7 @@ function(qt_setup_tool_path_command)
endif()
set(bindir "${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}")
file(TO_NATIVE_PATH "${bindir}" bindir)
list(APPEND command "${CMAKE_COMMAND}")
list(APPEND command -E)
list(APPEND command env)
list(APPEND command COMMAND)
list(APPEND command set \"PATH=${bindir}$<SEMICOLON>%PATH%\")
set(QT_TOOL_PATH_SETUP_COMMAND "${command}" CACHE INTERNAL "internal command prefix for tool invocations" FORCE)
endfunction()

View File

@ -98,10 +98,10 @@ function(__qt_quick_compiler_process_resources target resource_name)
set(compiled_file "${CMAKE_CURRENT_BINARY_DIR}/qmlcache/${resource_name}/${compiled_file}.cpp")
add_custom_command(
OUTPUT ${compiled_file}
DEPENDS ${file_absolute} @QT_CMAKE_EXPORT_NAMESPACE@::qmlcachegen
DEPENDS ${file_absolute}
${QT_TOOL_PATH_SETUP_COMMAND}
COMMAND
${QT_TOOL_PATH_SETUP_COMMAND}
$<TARGET_FILE:@QT_CMAKE_EXPORT_NAMESPACE@::qmlcachegen>
@QT_CMAKE_EXPORT_NAMESPACE@::qmlcachegen
--resource-path ${file_resource_path}
-o ${compiled_file}
${file_absolute}
@ -132,10 +132,10 @@ function(__qt_quick_compiler_process_resources target resource_name)
add_custom_command(
OUTPUT ${qmlcache_loader_file}
DEPENDS ${qmlcache_loader_list} @QT_CMAKE_EXPORT_NAMESPACE@::qmlcachegen
DEPENDS ${qmlcache_loader_list}
${QT_TOOL_PATH_SETUP_COMMAND}
COMMAND
${QT_TOOL_PATH_SETUP_COMMAND}
$<TARGET_FILE:@QT_CMAKE_EXPORT_NAMESPACE@::qmlcachegen>
@QT_CMAKE_EXPORT_NAMESPACE@::qmlcachegen
${retained_args}
--resource-name "${resource_name_arg}"
-o ${qmlcache_loader_file}