CustomCommandParallel-check.cmake 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj")
  2. if(NOT EXISTS "${vcProjectFile}")
  3. set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.")
  4. return()
  5. endif()
  6. set(found_CustomBuild_cmp0147_new 0)
  7. set(found_CustomBuild_cmp0147_old 0)
  8. set(found_BuildInParallel_cmp0147_new 0)
  9. set(found_BuildInParallel_cmp0147_old 0)
  10. set(in_CustomBuild_cmp0147 "")
  11. file(STRINGS "${vcProjectFile}" lines)
  12. foreach(line IN LISTS lines)
  13. if(line MATCHES [[<CustomBuild Include=".*\\cmp0147-old\.txt\.rule">]])
  14. set(found_CustomBuild_cmp0147_old 1)
  15. set(in_CustomBuild_cmp0147 "old")
  16. endif()
  17. if(line MATCHES [[<CustomBuild Include=".*\\cmp0147-new\.txt\.rule">]])
  18. set(found_CustomBuild_cmp0147_new 1)
  19. set(in_CustomBuild_cmp0147 "new")
  20. endif()
  21. if(line MATCHES [[</CustomBuild>]])
  22. set(in_CustomBuild_cmp0147 "")
  23. endif()
  24. if(line MATCHES [[<BuildInParallel .*>true</BuildInParallel>]] AND in_CustomBuild_cmp0147)
  25. set(found_BuildInParallel_cmp0147_${in_CustomBuild_cmp0147} 1)
  26. endif()
  27. endforeach()
  28. if(NOT found_CustomBuild_cmp0147_new)
  29. string(APPEND RunCMake_TEST_FAILED "CustomBuild for cmp0147-new.txt.rule not found in\n ${vcProjectFile}\n")
  30. endif()
  31. if(NOT found_CustomBuild_cmp0147_old)
  32. string(APPEND RunCMake_TEST_FAILED "CustomBuild for cmp0147-old.txt.rule not found in\n ${vcProjectFile}\n")
  33. endif()
  34. if(NOT found_BuildInParallel_cmp0147_new)
  35. string(APPEND RunCMake_TEST_FAILED "BuildInParallel for cmp0147-new.txt.rule not found in\n ${vcProjectFile}\n")
  36. endif()
  37. if(found_BuildInParallel_cmp0147_old)
  38. string(APPEND RunCMake_TEST_FAILED "BuildInParallel for cmp0147-old.txt.rule incorrectly found in\n ${vcProjectFile}\n")
  39. endif()