XcodeIOSInstallCombinedPrune-install-check.cmake 828 B

1234567891011121314151617181920212223242526
  1. function(verify_architectures file)
  2. execute_process(
  3. COMMAND xcrun otool -vf ${RunCMake_TEST_BINARY_DIR}/_install/${file}
  4. OUTPUT_VARIABLE otool_out
  5. ERROR_VARIABLE otool_err
  6. RESULT_VARIABLE otool_result)
  7. if(NOT otool_result EQUAL "0")
  8. message(SEND_ERROR "Could not retrieve fat headers: ${otool_err}")
  9. return()
  10. endif()
  11. string(REGEX MATCHALL "architecture [^ \n\t]+" architectures ${otool_out})
  12. string(REPLACE "architecture " "" actual "${architectures}")
  13. list(SORT actual)
  14. set(expected armv7 x86_64)
  15. if(NOT actual STREQUAL expected)
  16. message(SEND_ERROR
  17. "The actual library contains the architectures:\n ${actual} \n"
  18. "which do not match expected ones:\n ${expected} \n"
  19. "otool output:\n${otool_out}")
  20. endif()
  21. endfunction()
  22. verify_architectures(lib/libfoo.dylib)