From a037d826492039db9d58af47a1e1248037d15f40 Mon Sep 17 00:00:00 2001 From: Jesse Towner Date: Sat, 20 Feb 2021 21:29:35 -0800 Subject: [vcpkg] vcpkg_configure_meson: cross-compile fixes for Android (#16260) * [vcpkg] vcpkg_configure_meson: cross-compile fixes This change includes two fixes to the meson cross-compile config. The first change fixes the regex used to partition linker flag options so that it supports double-hyphen prefixes. The second change ensures that the cross file is always generated when the target platform is either Android or iOS, even if the host and target CPU architectures are the same. * Use helper function instead of regex replace Use vcpkg_internal_meson_convert_compiler_flags_to_list to partition compiler flags into a list, instead of string(REGEX REPLACE ...). --- scripts/cmake/vcpkg_configure_meson.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_configure_meson.cmake b/scripts/cmake/vcpkg_configure_meson.cmake index 194c0709d..0616d68ac 100644 --- a/scripts/cmake/vcpkg_configure_meson.cmake +++ b/scripts/cmake/vcpkg_configure_meson.cmake @@ -128,7 +128,7 @@ function(vcpkg_internal_meson_generate_native_file_config _config) #https://meso else() set(LINKER_FLAGS_${_config} "${VCPKG_DETECTED_CMAKE_STATIC_LINKER_FLAGS_${_config}}") endif() - string(REGEX REPLACE "( |^)(-|/)" ";\\2" LINKER_FLAGS_${_config} "${LINKER_FLAGS_${_config}}") + vcpkg_internal_meson_convert_compiler_flags_to_list(LINKER_FLAGS_${_config} "${LINKER_FLAGS_${_config}}") list(TRANSFORM LINKER_FLAGS_${_config} APPEND "'") list(TRANSFORM LINKER_FLAGS_${_config} PREPEND "'") list(APPEND LINKER_FLAGS_${_config} "${LIBPATH_${_config}}") @@ -277,8 +277,8 @@ function(vcpkg_internal_meson_generate_cross_file _additional_binaries) #https:/ endif() string(APPEND CROSS "cpu_family = '${BUILD_CPU_FAM}'\n") string(APPEND CROSS "cpu = '${BUILD_CPU}'\n") - - if(NOT BUILD_CPU_FAM STREQUAL HOST_CPU_FAM) + + if(NOT BUILD_CPU_FAM STREQUAL HOST_CPU_FAM OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_IOS) set(_file "${CURRENT_BUILDTREES_DIR}/meson-cross-${TARGET_TRIPLET}.log") set(VCPKG_MESON_CROSS_FILE "${_file}" PARENT_SCOPE) file(WRITE "${_file}" "${CROSS}") @@ -316,7 +316,7 @@ function(vcpkg_internal_meson_generate_cross_file_config _config) #https://meson else() set(LINKER_FLAGS_${_config} "${VCPKG_DETECTED_CMAKE_STATIC_LINKER_FLAGS_${_config}}") endif() - string(REGEX REPLACE "( |^)(-|/)" ";\\2" LINKER_FLAGS_${_config} "${LINKER_FLAGS_${_config}}") + vcpkg_internal_meson_convert_compiler_flags_to_list(LINKER_FLAGS_${_config} "${LINKER_FLAGS_${_config}}") list(TRANSFORM LINKER_FLAGS_${_config} APPEND "'") list(TRANSFORM LINKER_FLAGS_${_config} PREPEND "'") list(APPEND LINKER_FLAGS_${_config} "${LIBPATH_${_config}}") -- cgit v1.2.3