diff --git a/Modules/CMakeDetermineSwiftCompiler.cmake b/Modules/CMakeDetermineSwiftCompiler.cmake index d1c09fc814..b8f69eea47 100644 --- a/Modules/CMakeDetermineSwiftCompiler.cmake +++ b/Modules/CMakeDetermineSwiftCompiler.cmake @@ -139,6 +139,10 @@ if(CMAKE_Swift_COMPILER_VERSION VERSION_GREATER_EQUAL 5.2) message(CONFIGURE_LOG "Swift target info:\n" "${swift_target_info}") string(JSON module_triple GET "${swift_target_info}" "target" "moduleTriple") set(CMAKE_Swift_MODULE_TRIPLE ${module_triple}) + + if(CMAKE_Swift_COMPILER_VERSION VERSION_GREATER_EQUAL 6.2) + string(JSON CMAKE_Swift_SIZEOF_DATA_PTR GET "${swift_target_info}" "target" "pointerWidthInBytes") + endif() endif() if (NOT _CMAKE_TOOLCHAIN_LOCATION) diff --git a/Modules/CMakeSwiftCompiler.cmake.in b/Modules/CMakeSwiftCompiler.cmake.in index 5e2483a02d..27139d646b 100644 --- a/Modules/CMakeSwiftCompiler.cmake.in +++ b/Modules/CMakeSwiftCompiler.cmake.in @@ -18,3 +18,8 @@ set(CMAKE_Swift_COMPILER_USE_OLD_DRIVER "@CMAKE_Swift_COMPILER_USE_OLD_DRIVER@") set(CMAKE_Swift_IMPLICIT_INCLUDE_DIRECTORIES "@CMAKE_Swift_IMPLICIT_INCLUDE_DIRECTORIES@") set(CMAKE_Swift_MODULE_TRIPLE "@CMAKE_Swift_MODULE_TRIPLE@") +set(CMAKE_Swift_SIZEOF_DATA_PTR "@CMAKE_Swift_SIZEOF_DATA_PTR@") + +if(NOT CMAKE_SIZEOF_VOID_P AND CMAKE_Swift_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_Swift_SIZEOF_DATA_PTR}") +endif()