meson.build 769 B

12345678910111213141516171819202122
  1. project('has member', 'c', 'cpp')
  2. compilers = [meson.get_compiler('c'), meson.get_compiler('cpp')]
  3. foreach cc : compilers
  4. if not cc.has_member('struct tm', 'tm_sec', prefix : '#include<time.h>')
  5. error('Did not detect member of "struct tm" that exists: "tm_sec"')
  6. endif
  7. if cc.has_member('struct tm', 'tm_nonexistent', prefix : '#include<time.h>')
  8. error('Not existing member "tm_nonexistent" found.')
  9. endif
  10. if not cc.has_members('struct tm', 'tm_sec', 'tm_min', prefix : '#include<time.h>')
  11. error('Did not detect members of "struct tm" that exist: "tm_sec" "tm_min"')
  12. endif
  13. if cc.has_members('struct tm', 'tm_sec', 'tm_nonexistent2', prefix : '#include<time.h>')
  14. error('Not existing member "tm_nonexistent2" found.')
  15. endif
  16. endforeach