ValidateBuild.cmake.in 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. set(msvc6 "@MSVC60@")
  33. if("${msvc6}" STREQUAL "1")
  34. set(expected_minimum_file_count 1)
  35. else()
  36. set(expected_minimum_file_count 3)
  37. endif()
  38. if(len LESS ${expected_minimum_file_count})
  39. message(FATAL_ERROR
  40. "len='${len}' is less than '${expected_minimum_file_count}' (count of shared 'bin' files)")
  41. endif()
  42. foreach(f ${files})
  43. message(STATUS "file '${f}'")
  44. get_filename_component(ext "${f}" EXT)
  45. string(TOLOWER "${ext}" ext)
  46. if("${ext}" MATCHES "\\.exe$")
  47. message(STATUS " exe file")
  48. get_filename_component(name "${f}" NAME)
  49. string(TOLOWER "${name}" name)
  50. if(NOT "${name}" STREQUAL "mfc1.exe")
  51. message(FATAL_ERROR "unexpected mfcShared .exe file name '${name}'")
  52. endif()
  53. elseif("${ext}" MATCHES "\\.dll$")
  54. message(STATUS " dll file")
  55. elseif("${ext}" MATCHES "\\.manifest$")
  56. message(STATUS " manifest file")
  57. else()
  58. message(STATUS " unknown file")
  59. message(FATAL_ERROR "unexpected mfcShared ${ext} file name '${f}'")
  60. endif()
  61. endforeach()
  62. message(STATUS "All mfc1 build validation tests pass.")