AddPackageToDefault-check.cmake 828 B

1234567891011121314151617181920212223242526272829
  1. set(vcSlnFile "${RunCMake_TEST_BINARY_DIR}/AddPackageToDefault.sln")
  2. if(NOT EXISTS "${vcSlnFile}")
  3. set(RunCMake_TEST_FAILED "Project file ${vcSlnFile} does not exist.")
  4. return()
  5. endif()
  6. set(packageGuidFound FALSE)
  7. set(packageGuid "")
  8. set(packageInBuild FALSE)
  9. file(STRINGS "${vcSlnFile}" lines)
  10. foreach(line IN LISTS lines)
  11. if(NOT packageGuidFound)
  12. if(line MATCHES "^Project.*\"PACKAGE.vcx?proj\".*\"{([A-F0-9-]+)}\"$")
  13. set(packageGuidFound TRUE)
  14. set(packageGuid ${CMAKE_MATCH_1})
  15. endif()
  16. else()
  17. if(line MATCHES ".*{${packageGuid}}.*")
  18. if(line MATCHES "^[ \t]*{${packageGuid}}\\..*\\.Build.0 = .*$")
  19. set(packageInBuild TRUE)
  20. endif()
  21. endif()
  22. endif()
  23. endforeach()
  24. if(NOT packageInBuild)
  25. set(RunCMake_TEST_FAILED "PACKAGE is not in default build")
  26. return()
  27. endif()