XcodeIOSInstallCombinedSingleArch-install-check.cmake 869 B

1234567891011121314151617181920212223242526272829
  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. string(REGEX MATCHALL "is architecture: [^ \n\t]+" architecture "${lipo_out}")
  12. string(REGEX REPLACE "is architecture: " "" actual "${architecture}")
  13. if(XCODE_VERSION VERSION_GREATER_EQUAL 14)
  14. set(expected arm64)
  15. else()
  16. set(expected armv7)
  17. endif()
  18. if(NOT actual STREQUAL expected)
  19. message(SEND_ERROR
  20. "The actual library architecture:\n ${actual} \n"
  21. "which do not match expected ones:\n ${expected} \n"
  22. "lipo output:\n${lipo_out}")
  23. endif()
  24. endfunction()
  25. verify_architecture(lib/libfoo.dylib)