summaryrefslogtreecommitdiff
path: root/Tests/MFC/ValidateBuild.cmake.in
blob: ed923f5e7229c4b0536ff9ef107179b451273cb2 (plain)
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
#
# This code validates that the install trees of the shared and static builds
# of "mfc1" have the expected contents:
#
set(binary_dir "@binary_dir@")
message("binary_dir='${binary_dir}'")

# There should be exactly one file in the static install tree "bin" directory
# and it should be named "mfc1.exe"
#
message(STATUS "===== mfcStatic install tree =====")
file(GLOB_RECURSE files "${binary_dir}/mfcStatic-prefix/bin/*.*")
message(STATUS "mfcStatic files='${files}'")
list(LENGTH files len)
if(NOT len EQUAL 1)
  message(FATAL_ERROR
    "len='${len}' is not '1' (count of static 'bin' files)")
endif()
get_filename_component(name "${files}" NAME)
string(TOLOWER "${name}" name)
if(NOT "${name}" STREQUAL "mfc1.exe")
  message(FATAL_ERROR "unexpected mfcStatic file name '${name}'")
endif()

# There should be at least 3 files in the shared install tree "bin"
# directory: mfc1.exe, the main MFC dll and the C runtime dll. With more
# recent versions of VS, there will also be an MFC language dll and a
# manifest file.
#
message(STATUS "===== mfcShared install tree =====")
file(GLOB_RECURSE files "${binary_dir}/mfcShared-prefix/bin/*.*")
message(STATUS "mfcShared files='${files}'")
list(LENGTH files len)

set(msvc6 "@MSVC60@")
if("${msvc6}" STREQUAL "1")
  set(expected_minimum_file_count 1)
else()
  set(expected_minimum_file_count 3)
endif()

if(len LESS ${expected_minimum_file_count})
  message(FATAL_ERROR
    "len='${len}' is less than '${expected_minimum_file_count}' (count of shared 'bin' files)")
endif()
foreach(f ${files})
  message(STATUS "file '${f}'")
  get_filename_component(ext "${f}" EXT)
  string(TOLOWER "${ext}" ext)

  if("${ext}" MATCHES "\\.exe$")
    message(STATUS "  exe file")
    get_filename_component(name "${f}" NAME)
    string(TOLOWER "${name}" name)
    if(NOT "${name}" STREQUAL "mfc1.exe")
      message(FATAL_ERROR "unexpected mfcShared .exe file name '${name}'")
    endif()
  elseif("${ext}" MATCHES "\\.dll$")
    message(STATUS "  dll file")
  elseif("${ext}" MATCHES "\\.manifest$")
    message(STATUS "  manifest file")
  else()
    message(STATUS "  unknown file")
    message(FATAL_ERROR "unexpected mfcShared ${ext} file name '${f}'")
  endif()
endforeach()

message(STATUS "All mfc1 build validation tests pass.")