RunCPackVerifyResult.cmake 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. message(STATUS "=============================================================")
  2. message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
  3. message(STATUS "")
  4. if(NOT CPackNSISGenerator_BINARY_DIR)
  5. message(FATAL_ERROR "CPackNSISGenerator_BINARY_DIR not set")
  6. endif()
  7. message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}")
  8. message(STATUS "CMAKE_CPACK_COMMAND: ${CMAKE_CPACK_COMMAND}")
  9. message(STATUS "CPackNSISGenerator_BINARY_DIR: ${CPackNSISGenerator_BINARY_DIR}")
  10. if(config)
  11. set(_C_config -C ${config})
  12. endif()
  13. execute_process(COMMAND "${CMAKE_CPACK_COMMAND}"
  14. ${_C_config}
  15. RESULT_VARIABLE CPack_result
  16. OUTPUT_VARIABLE CPack_output
  17. ERROR_VARIABLE CPack_error
  18. WORKING_DIRECTORY "${CPackNSISGenerator_BINARY_DIR}")
  19. if(CPack_result)
  20. message(FATAL_ERROR "CPack execution went wrong!, CPack_output=${CPack_output}, CPack_error=${CPack_error}")
  21. else ()
  22. message(STATUS "CPack_output=${CPack_output}")
  23. endif()
  24. set(expected_file_mask "${CPackNSISGenerator_BINARY_DIR}/_CPack_Packages/*/NSIS/*.nsi")
  25. file(GLOB project_file "${expected_file_mask}")
  26. message(STATUS "project_file='${project_file}'")
  27. message(STATUS "expected_file_mask='${expected_file_mask}'")
  28. if(NOT project_file)
  29. message(FATAL_ERROR "project_file does not exist.")
  30. endif()
  31. # should match !define MUI_HEADERIMAGE_BITMAP "${PROJECT_SOURCE_DIR}\header-image.bmp"
  32. file(STRINGS "${project_file}" line REGEX "^!define MUI_HEADERIMAGE_BITMAP")
  33. string(FIND "${line}" "header-image.bmp" output_index)
  34. message(STATUS "Found the bitmap at index ${output_index}")
  35. if("${output_index}" EQUAL "-1")
  36. message(FATAL_ERROR "MUI_HEADERIMAGE_BITMAP not found in the project")
  37. endif()
  38. file(STRINGS "${project_file}" line REGEX "^ManifestDPIAware true")
  39. string(FIND "${line}" "true" output_index)
  40. if("${output_index}" EQUAL "-1")
  41. message(FATAL_ERROR "ManifestDPIAware true not found in the project")
  42. else()
  43. message(STATUS "Found DPI-aware")
  44. endif()
  45. file(STRINGS "${project_file}" line REGEX "^BrandingText /TRIMRIGHT \"CMake branding text\"")
  46. string(FIND "${line}" "TRIMRIGHT" output_index)
  47. if("${output_index}" EQUAL "-1")
  48. message(FATAL_ERROR "BrandingText not found in the project")
  49. else()
  50. message(STATUS "Found BrandingText")
  51. endif()
  52. # license page should not be present
  53. file(STRINGS "${project_file}" line REGEX "!insertmacro MUI_PAGE_LICENSE")
  54. string(FIND "${line}" "MUI_PAGE_LICENSE" output_index)
  55. if("${output_index}" EQUAL "-1")
  56. message(STATUS "License not found in the project")
  57. else()
  58. message(FATAL_ERROR "License found in the project")
  59. endif()
  60. file(STRINGS "${project_file}" line REGEX [[\\_CON\\]])
  61. string(FIND "${line}" [[\_CON\]] output_index)
  62. message(STATUS "Found CON component reserved directory name as _CON")
  63. if("${output_index}" EQUAL "-1")
  64. message(FATAL_ERROR "CON component reserved directory name not found as _CON in the project")
  65. endif()
  66. file(STRINGS "${project_file}" line REGEX [[\\Console\\]])
  67. string(FIND "${line}" [[\Console\]] output_index)
  68. message(STATUS "Found Console component directory name as Console")
  69. if("${output_index}" EQUAL "-1")
  70. message(FATAL_ERROR "Console component directory name not found as Console in the project")
  71. endif()
  72. file(STRINGS "${project_file}" line REGEX [[\\EndsWithDot._\\]])
  73. string(FIND "${line}" [[\EndsWithDot._\]] output_index)
  74. message(STATUS "Found EndsWithDot. component directory name as EndsWithDot._")
  75. if("${output_index}" EQUAL "-1")
  76. message(FATAL_ERROR "EndsWithDot. component directory name not found as EndsWithDot._ in the project")
  77. endif()
  78. file(STRINGS "${project_file}" line REGEX "^CRCCheck off")
  79. string(FIND "${line}" "off" output_index)
  80. if("${output_index}" EQUAL "-1")
  81. message(FATAL_ERROR "CRCCheck off not found in the project")
  82. else()
  83. message(STATUS "Found CRCCheck")
  84. endif()