XcodeAttributeGenex-check.cmake 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # per target attribute with genex
  2. set(expect "TEST_HOST = \"[^;\"]*Tests/RunCMake/XcodeProject/XcodeAttributeGenex-build/[^;\"/]*/some\"")
  3. file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodeAttributeGenex.xcodeproj/project.pbxproj actual
  4. REGEX "TEST_HOST = .*;" LIMIT_COUNT 1)
  5. if(NOT "${actual}" MATCHES "${expect}")
  6. message(SEND_ERROR "The actual project contains the line:\n ${actual}\n"
  7. "which does not match expected regex:\n ${expect}\n")
  8. endif()
  9. # per target attribute with variant
  10. file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodeAttributeGenex.xcodeproj/project.pbxproj actual
  11. REGEX "CONFIG_SPECIFIC = .*;")
  12. list(REMOVE_DUPLICATES actual)
  13. set(expect "CONFIG_SPECIFIC = general")
  14. if(NOT "${actual}" MATCHES "${expect}")
  15. message(SEND_ERROR "The actual project contains the line:\n ${actual}\n"
  16. "which does not match expected regex:\n ${expect}\n")
  17. endif()
  18. set(expect "CONFIG_SPECIFIC = release")
  19. if(NOT "${actual}" MATCHES "${expect}")
  20. message(SEND_ERROR "The actual project contains the line:\n ${actual}\n"
  21. "which does not match expected regex:\n ${expect}\n")
  22. endif()
  23. # global attribute with genex
  24. set(expect "ANOTHER_GLOBAL = \"[^;\"]*Tests/RunCMake/XcodeProject/XcodeAttributeGenex-build/[^;\"/]*/another\"")
  25. file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodeAttributeGenex.xcodeproj/project.pbxproj actual
  26. REGEX "ANOTHER_GLOBAL = .*;" LIMIT_COUNT 1)
  27. if(NOT "${actual}" MATCHES "${expect}")
  28. message(SEND_ERROR "The actual project contains the line:\n ${actual}\n"
  29. "which does not match expected regex:\n ${expect}\n")
  30. endif()
  31. # global attribute with variant
  32. file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodeAttributeGenex.xcodeproj/project.pbxproj actual
  33. REGEX "ANOTHER_CONFIG = .*;" LIMIT_COUNT 4)
  34. list(REMOVE_DUPLICATES actual)
  35. set(expect "ANOTHER_CONFIG = general")
  36. if(NOT "${actual}" MATCHES "${expect}")
  37. message(SEND_ERROR "The actual project contains the line:\n ${actual}\n"
  38. "which does not match expected regex:\n ${expect}\n")
  39. endif()
  40. set(expect "ANOTHER_CONFIG = debug")
  41. if(NOT "${actual}" MATCHES "${expect}")
  42. message(SEND_ERROR "The actual project contains the line:\n ${actual}\n"
  43. "which does not match expected regex:\n ${expect}\n")
  44. endif()