clean up to work with manifest files better.

This commit is contained in:
Bill Hoffman 2009-10-28 10:29:24 -04:00
parent 95038439ea
commit bc3cab3634

View File

@ -40,7 +40,7 @@ function(crt_version file list_var)
foreach(s ${strings}) foreach(s ${strings})
set(has_match 1) set(has_match 1)
string(REGEX string(REGEX
REPLACE ".*version=.([^\"]*). (.*)$" "\\1" REPLACE ".*<assembly.*\"Microsoft.VC...CRT\".*version=\"([^\"]*)\".*</assembly>.*$" "\\1"
version "${s}") version "${s}")
if(NOT "${version}" STREQUAL "") if(NOT "${version}" STREQUAL "")
list(APPEND version_list ${version}) list(APPEND version_list ${version})
@ -72,7 +72,7 @@ function(check_version file manifest_versions)
foreach(ver ${file_versions}) foreach(ver ${file_versions})
list(FIND manifest_versions "${ver}" found_version) list(FIND manifest_versions "${ver}" found_version)
if("${found_version}" EQUAL -1) if("${found_version}" EQUAL -1)
message("ERROR: ${file} uses ${ver} not found in shipped manifest.") message("ERROR: ${file} uses ${ver} not found in shipped manifests:[${manifest_versions}].")
set(fatal_error TRUE PARENT_SCOPE) set(fatal_error TRUE PARENT_SCOPE)
endif() endif()
endforeach(ver) endforeach(ver)
@ -104,12 +104,12 @@ file(GLOB_RECURSE exe_files "*.exe")
file(GLOB_RECURSE dll_files "*.dll") file(GLOB_RECURSE dll_files "*.dll")
set(exe_files ${exe_files} ${dll_files}) set(exe_files ${exe_files} ${dll_files})
foreach(f ${exe_files}) foreach(f ${exe_files})
check_version(${f} ${manifest_version_list}) check_version(${f} "${manifest_version_list}")
endforeach() endforeach()
# report a fatal error if there were any so that cmake will return # report a fatal error if there were any so that cmake will return
# a non zero value # a non zero value
if(fatal_error) if(fatal_error)
message(FATAL_ERROR "This distribution has mis-matched dll" message(FATAL_ERROR "This distribution embeds dll "
" versions and may not work on other machines.") " versions that it does not ship, and may not work on other machines.")
endif() endif()