ValidateBuild.cmake.in 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #
  2. # This code validates that the install trees of the shared and static builds
  3. # of "mfc1" have the expected contents:
  4. #
  5. set(binary_dir "@binary_dir@")
  6. message("binary_dir='${binary_dir}'")
  7. # There should be exactly one file in the static install tree "bin" directory
  8. # and it should be named "mfc1.exe"
  9. #
  10. message(STATUS "===== mfcStatic install tree =====")
  11. file(GLOB_RECURSE files "${binary_dir}/mfcStatic-prefix/bin/*.*")
  12. message(STATUS "mfcStatic files='${files}'")
  13. list(LENGTH files len)
  14. if(NOT len EQUAL 1)
  15. message(FATAL_ERROR
  16. "len='${len}' is not '1' (count of static 'bin' files)")
  17. endif()
  18. get_filename_component(name "${files}" NAME)
  19. string(TOLOWER "${name}" name)
  20. if(NOT "${name}" STREQUAL "mfc1.exe")
  21. message(FATAL_ERROR "unexpected mfcStatic file name '${name}'")
  22. endif()
  23. # There should be at least 3 files in the shared install tree "bin"
  24. # directory: mfc1.exe, the main MFC dll and the C runtime dll. With more
  25. # recent versions of VS, there will also be an MFC language dll and a
  26. # manifest file.
  27. #
  28. message(STATUS "===== mfcShared install tree =====")
  29. file(GLOB_RECURSE files "${binary_dir}/mfcShared-prefix/bin/*.*")
  30. message(STATUS "mfcShared files='${files}'")
  31. list(LENGTH files len)
  32. if(len LESS 3)
  33. message(FATAL_ERROR
  34. "len='${len}' is less than '3' (count of shared 'bin' files)")
  35. endif()
  36. foreach(f ${files})
  37. message(STATUS "file '${f}'")
  38. get_filename_component(ext "${f}" EXT)
  39. string(TOLOWER "${ext}" ext)
  40. if("${ext}" MATCHES "\\.exe$")
  41. message(STATUS " exe file")
  42. get_filename_component(name "${f}" NAME)
  43. string(TOLOWER "${name}" name)
  44. if(NOT "${name}" STREQUAL "mfc1.exe")
  45. message(FATAL_ERROR "unexpected mfcShared .exe file name '${name}'")
  46. endif()
  47. elseif("${ext}" MATCHES "\\.dll$")
  48. message(STATUS " dll file")
  49. elseif("${ext}" MATCHES "\\.manifest$")
  50. message(STATUS " manifest file")
  51. else()
  52. message(STATUS " unknown file")
  53. message(FATAL_ERROR "unexpected mfcShared ${ext} file name '${f}'")
  54. endif()
  55. endforeach()
  56. message(STATUS "All mfc1 build validation tests pass.")