File: RunCPackVerifyResult.cmake

package info (click to toggle)
cmake 3.0.2-1%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 44,060 kB
  • ctags: 30,180
  • sloc: cpp: 160,392; ansic: 149,082; yacc: 3,254; sh: 2,825; xml: 2,427; lex: 1,234; python: 449; lisp: 267; objc: 134; f90: 105; fortran: 101; perl: 99; makefile: 71; tcl: 55; asm: 28; php: 25; ruby: 22; java: 20
file content (72 lines) | stat: -rw-r--r-- 2,343 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
message(STATUS "=============================================================")
message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
message(STATUS "")

if(NOT CPackWiXGenerator_BINARY_DIR)
  message(FATAL_ERROR "CPackWiXGenerator_BINARY_DIR not set")
endif()

message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}")
message(STATUS "CMAKE_CPACK_COMMAND: ${CMAKE_CPACK_COMMAND}")
message(STATUS "CPackWiXGenerator_BINARY_DIR: ${CPackWiXGenerator_BINARY_DIR}")

execute_process(COMMAND "${CMAKE_CPACK_COMMAND}"
  RESULT_VARIABLE CPack_result
  OUTPUT_VARIABLE CPack_output
  ERROR_VARIABLE CPack_error
  WORKING_DIRECTORY "${CPackWiXGenerator_BINARY_DIR}")

if(CPack_result)
  message(FATAL_ERROR "CPack execution went wrong!, CPack_output=${CPack_output}, CPack_error=${CPack_error}")
else ()
  message(STATUS "CPack_output=${CPack_output}")
endif()

set(expected_file_mask "*.msi")
file(GLOB installer_file "${expected_file_mask}")

message(STATUS "installer_file='${installer_file}'")
message(STATUS "expected_file_mask='${expected_file_mask}'")

if(NOT installer_file)
  message(FATAL_ERROR "installer_file does not exist.")
endif()

function(run_wix_command command)
  file(TO_CMAKE_PATH "$ENV{WIX}" WIX_ROOT)
  set(WIX_PROGRAM "${WIX_ROOT}/bin/${command}.exe")

  if(NOT EXISTS "${WIX_PROGRAM}")
    message(FATAL_ERROR "Failed to find WiX Tool: ${WIX_PROGRAM}")
  endif()

  message(STATUS "Running WiX Tool: ${command} ${ARGN}")

  execute_process(COMMAND "${WIX_PROGRAM}" ${ARGN}
    RESULT_VARIABLE WIX_result
    OUTPUT_VARIABLE WIX_output
    ERROR_VARIABLE WIX_output
    WORKING_DIRECTORY "${CPackWiXGenerator_BINARY_DIR}")

  message(STATUS "${command} Output: \n${WIX_output}")

  if(WIX_result)
    message(FATAL_ERROR "WiX ${command} failed: ${WIX_result}")
  endif()
endfunction()

file(GLOB WXS_SOURCE_FILES
  "${CPackWiXGenerator_BINARY_DIR}/_CPack_Packages/*/WIX/*.wxs")

if(NOT WXS_SOURCE_FILES)
  message(FATAL_ERROR "Failed finding WiX source files to validate.")
endif()

foreach(WXS_SOURCE_FILE IN LISTS WXS_SOURCE_FILES)
  run_wix_command(wixcop "${WXS_SOURCE_FILE}")
endforeach()

# error SMOK1076 : ICE61: This product should remove only older
# versions of itself. The Maximum version is not less
# than the current product. (1.0.0 1.0.0)
run_wix_command(smoke -nologo -wx -sw1076 "${installer_file}")