CMake/Tests/MFC/ValidateBuild.cmake.in
David Cole 537020f958 Tests: Nudge MFC test to pass on VS 6 dashboards (#11213)
InstallRequiredSystemLibraries does not install any dlls when
used with VS 6 dashboards. Modify the ValidateBuild script to
expect only 1 file when building with VS 6.

Using "-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>" does not work when
<INSTALL_DIR> evaluates to a long enough string. However, using
"-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>" does work, even with
the longer strings. So: make sure to include the ":PATH" when using
this construct with ExternalProject calls so that they may install
to the proper location on VS 6 builds. All existing calls that match
"CMAKE_INSTALL_PREFIX.*INSTALL_DIR" include the ":PATH" after this
commit.

By the way: https://twitter.com/DLRdave/status/134339505397309440
2011-11-09 13:35:28 -05:00

69 lines
2.2 KiB
CMake

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