Debian Codegraph @

Tests/RunCMake/XcodeProject-Device/XcodeIOSInstallCombinedSingleArch-install-check.cmake

raw
1 function(verify_architecture file)
2 execute_process(
3 COMMAND xcrun lipo -info ${RunCMake_TEST_BINARY_DIR}/_install/${file}
4 OUTPUT_VARIABLE lipo_out
5 ERROR_VARIABLE lipo_err
6 RESULT_VARIABLE lipo_result)
7 if(NOT lipo_result EQUAL "0")
8 message(SEND_ERROR "lipo -info failed: ${lipo_err}")
9 return()
10 endif()
11
12 string(REGEX MATCHALL "is architecture: [^ \n\t]+" architecture "${lipo_out}")
13 string(REGEX REPLACE "is architecture: " "" actual "${architecture}")
14
15 if(XCODE_VERSION VERSION_GREATER_EQUAL 14)
16 set(expected arm64)
17 else()
18 set(expected armv7)
19 endif()
20
21 if(NOT actual STREQUAL expected)
22 message(SEND_ERROR
23 "The actual library architecture:\n ${actual} \n"
24 "which do not match expected ones:\n ${expected} \n"
25 "lipo output:\n${lipo_out}")
26 endif()
27 endfunction()
28
29 verify_architecture(lib/libfoo.dylib)