InheritedParameters-check.cmake 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. set(xcProjectFile "${RunCMake_TEST_BINARY_DIR}/InheritedParameters.xcodeproj/project.pbxproj")
  2. if(NOT EXISTS "${xcProjectFile}")
  3. set(RunCMake_TEST_FAILED "Project file ${xcProjectFile} does not exist.")
  4. return()
  5. endif()
  6. set(found_inherited_GCC_PREPROCESSOR_DEFINITIONS 1)
  7. set(found_inherited_OTHER_CFLAGS 1)
  8. set(found_inherited_OTHER_LDFLAGS 1)
  9. file(STRINGS "${xcProjectFile}" lines)
  10. foreach(line IN LISTS lines)
  11. if(line MATCHES [[GCC_PREPROCESSOR_DEFINITIONS]])
  12. if(NOT line MATCHES [["\$\(inherited\)"]])
  13. string(APPEND relevant_lines " ${line}\n")
  14. set(found_inherited_GCC_PREPROCESSOR_DEFINITIONS 0)
  15. endif()
  16. endif()
  17. if(line MATCHES [[OTHER_CFLAGS]])
  18. if(NOT line MATCHES [["\$\(inherited\)"]])
  19. string(APPEND relevant_lines " ${line}\n")
  20. set(found_inherited_OTHER_CFLAGS 0)
  21. endif()
  22. endif()
  23. if(line MATCHES [[OTHER_LDFLAGS]])
  24. if(NOT line MATCHES [["\$\(inherited\)"]])
  25. string(APPEND relevant_lines " ${line}\n")
  26. set(found_inherited_OTHER_LDFLAGS 0)
  27. endif()
  28. endif()
  29. endforeach()
  30. if(NOT found_inherited_GCC_PREPROCESSOR_DEFINITIONS)
  31. string(APPEND RunCMake_TEST_FAILED "Found missing inherited value for GCC_PREPROCESSOR_DEFINITIONS in\n ${xcProjectFile}\n")
  32. endif()
  33. if(NOT found_inherited_OTHER_CFLAGS)
  34. string(APPEND RunCMake_TEST_FAILED "Found missing inherited value for OTHER_CFLAGS in\n ${xcProjectFile}\n")
  35. endif()
  36. if(NOT found_inherited_OTHER_LDFLAGS)
  37. string(APPEND RunCMake_TEST_FAILED "Found missing inherited value for OTHER_LDFLAGS in\n ${xcProjectFile}\n")
  38. endif()
  39. if(RunCMake_TEST_FAILED)
  40. string(APPEND RunCMake_TEST_FAILED "Relevant lines include\n${relevant_lines}")
  41. endif()