diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2019-09-04 10:52:18 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2019-09-04 13:18:08 +0000 |
commit | 18fc9e1bf821130f0cfe45dc7d5c05b70458e7c0 (patch) | |
tree | c9238ca197310c0af8db494b385932d118bbd4f8 /cmake | |
parent | 85e3bb7aeaed157526a84f5860260a1dd0df1afb (diff) |
Fix qtdeclarative build on Windows
Our tools are typically installed into the Qt bin directory, after which
they are useable right away on Windows, since the Qt dlls are located
there, too. An exception to the rule are tools that are built within a
module and used right away. At that point they are in the top-level
bin dir of the build directory, along with "local" DLLS they might need,
but with the Qt dlls out of reach. To cover this case, we need to
prepend a PATH adjusting command when using these with
add_custom_command.
Change-Id: I7f58581f5060c8004b5d1fa1f6f17297256783de
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtBuild.cmake | 14 | ||||
-rw-r--r-- | cmake/QtResource.cmake.in | 10 |
2 files changed, 20 insertions, 4 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index 3f26e82821..dcbe764643 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -63,6 +63,20 @@ SET(CMAKE_INSTALL_RPATH "${_default_install_rpath}" CACHE PATH "RPATH for instal # which point to directories outside the build tree to the install RPATH SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) +function(qt_setup_tool_path_command) + if(NOT WIN32) + return() + 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 set \"PATH=${bindir}$<SEMICOLON>%PATH%\") + set(QT_TOOL_PATH_SETUP_COMMAND "${command}" CACHE INTERNAL "internal command prefix for tool invocations" FORCE) +endfunction() +qt_setup_tool_path_command() + # Platform define path, etc. set(QT_QMAKE_TARGET_MKSPEC "") if(WIN32) diff --git a/cmake/QtResource.cmake.in b/cmake/QtResource.cmake.in index 8474183882..3f33ba50e5 100644 --- a/cmake/QtResource.cmake.in +++ b/cmake/QtResource.cmake.in @@ -98,9 +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} + DEPENDS ${file_absolute} @QT_CMAKE_EXPORT_NAMESPACE@::qmlcachegen COMMAND - @QT_CMAKE_EXPORT_NAMESPACE@::qmlcachegen + ${QT_TOOL_PATH_SETUP_COMMAND} + $<TARGET_FILE:@QT_CMAKE_EXPORT_NAMESPACE@::qmlcachegen> --resource-path ${file_resource_path} -o ${compiled_file} ${file_absolute} @@ -131,9 +132,10 @@ function(__qt_quick_compiler_process_resources target resource_name) add_custom_command( OUTPUT ${qmlcache_loader_file} - DEPENDS ${qmlcache_loader_list} + DEPENDS ${qmlcache_loader_list} @QT_CMAKE_EXPORT_NAMESPACE@::qmlcachegen COMMAND - @QT_CMAKE_EXPORT_NAMESPACE@::qmlcachegen + ${QT_TOOL_PATH_SETUP_COMMAND} + $<TARGET_FILE:@QT_CMAKE_EXPORT_NAMESPACE@::qmlcachegen> ${retained_args} --resource-name "${resource_name_arg}" -o ${qmlcache_loader_file} |