You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cmake/Tests/MFC/ValidateBuild.cmake.in

69 lines
2.2 KiB

#
# 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.")