diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2022-10-06 10:04:54 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2022-10-07 18:18:23 +0200 |
commit | f7a34630a1c13c054cf06199bbb907ddc718e48c (patch) | |
tree | 4c5958c98af0b9e8ae3741ecc0b939d2320f5abc /cmake | |
parent | 21991a1278d4c3c9857d6da3317cf053dfb1756c (diff) |
CMake: Use unix paths in android xml files
We aim to allow building Qt for Android on one host, and make it
usable on any host.
Previously when built on a Windows host, we embedded windows style
paths into the android -dependencies.xml files, which caused
androideployqt to fail deployment when building a project on a unix
host.
In Qt 5, the dependencies xml files for Windows Android packages had
unix style paths. Thus switch to always using unix styles paths on
all platforms.
Amends a9d2c5b6d7fa6b7365db8690f57aa78002c8bc4b.
Fixes: QTBUG-107249
Change-Id: I851d3e0b08415b4c7f0d22baf43c10c715879ee7
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtAndroidHelpers.cmake | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/cmake/QtAndroidHelpers.cmake b/cmake/QtAndroidHelpers.cmake index 3ab841f608..70200d675c 100644 --- a/cmake/QtAndroidHelpers.cmake +++ b/cmake/QtAndroidHelpers.cmake @@ -130,8 +130,9 @@ function(qt_internal_android_dependencies_content target file_content_out) if (init_class) set(init_class "initClass=\"${init_class}\"") endif() - file(TO_NATIVE_PATH ${jar_file} jar_file_native) - string(APPEND file_contents "<jar file=\"${jar_file_native}\" ${init_class} />\n") + # Use unix path to allow using files on any host platform. + file(TO_CMAKE_PATH ${jar_file} jar_file_unix_path) + string(APPEND file_contents "<jar file=\"${jar_file_unix_path}\" ${init_class} />\n") endforeach() endif() @@ -142,8 +143,10 @@ function(qt_internal_android_dependencies_content target file_content_out) if (init_class) set(init_class "initClass=\"${init_class}\"") endif() - file(TO_NATIVE_PATH ${bundle_file} jar_bundle_native) - string(APPEND file_contents "<jar bundling=\"1\" file=\"${jar_bundle_native}\" ${init_class} />\n") + # Use unix path to allow using files on any host platform. + file(TO_CMAKE_PATH ${bundle_file} jar_bundle_unix_path) + string(APPEND file_contents + "<jar bundling=\"1\" file=\"${jar_bundle_unix_path}\" ${init_class} />\n") endforeach() endif() @@ -155,8 +158,9 @@ function(qt_internal_android_dependencies_content target file_content_out) if (lib_extends) set(lib_extends "extends=\"${lib_extends}\"") endif() - file(TO_NATIVE_PATH ${lib_file} lib_file_native) - string(APPEND file_contents "<lib file=\"${lib_file_native}\" ${lib_extends} />\n") + # Use unix path to allow using files on any host platform. + file(TO_CMAKE_PATH ${lib_file} lib_file_unix_path) + string(APPEND file_contents "<lib file=\"${lib_file_unix_path}\" ${lib_extends} />\n") endforeach() endif() @@ -166,19 +170,23 @@ function(qt_internal_android_dependencies_content target file_content_out) string(REPLACE ".so" "_${CMAKE_ANDROID_ARCH_ABI}.so" lib ${lib}) section(${lib} ":" lib_file lib_replacement) if (lib_replacement) - file(TO_NATIVE_PATH ${lib_replacement} lib_replacement_native) - set(lib_replacement "replaces=\"${lib_replacement_native}\"") + # Use unix path to allow using files on any host platform. + file(TO_CMAKE_PATH ${lib_replacement} lib_replacement_unix_path) + set(lib_replacement "replaces=\"${lib_replacement_unix_path}\"") endif() - file(TO_NATIVE_PATH ${lib_file} lib_file_native) - string(APPEND file_contents "<lib file=\"${lib_file_native}\" ${lib_replacement} />\n") + # Use unix path to allow using files on any host platform. + file(TO_CMAKE_PATH ${lib_file} lib_file_unix_path) + string(APPEND file_contents + "<lib file=\"${lib_file_unix_path}\" ${lib_replacement} />\n") endforeach() endif() # Bundled files if(arg_BUNDLED_FILES) foreach(bundled_file IN LISTS arg_BUNDLED_FILES) - file(TO_NATIVE_PATH ${bundled_file} file_native) - string(APPEND file_contents "<bundled file=\"${file_native}\" />\n") + # Use unix path to allow using files on any host platform. + file(TO_CMAKE_PATH ${bundled_file} file_unix_path) + string(APPEND file_contents "<bundled file=\"${file_unix_path}\" />\n") endforeach() endif() |