123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- function(crt_version file list_var)
- file(STRINGS "${file}" strings REGEX "Microsoft.VC...CRT" NEWLINE_CONSUME)
- foreach(s ${strings})
- set(has_match 1)
- string(REGEX
- REPLACE ".*<assembly.*\"Microsoft.VC...CRT\".*version=\"([^\"]*)\".*</assembly>.*$" "\\1"
- version "${s}")
- if(NOT "${version}" STREQUAL "")
- list(APPEND version_list ${version})
- else()
- message(FATAL_ERROR "Parse error could not find version in [${s}]")
- endif()
- endforeach()
- if(NOT DEFINED has_match)
- message("Information: no embedded manifest in: ${file}")
- return()
- endif()
- list(APPEND version_list ${${list_var}})
- list(REMOVE_DUPLICATES version_list)
- if(version_list)
- set(${list_var} ${version_list} PARENT_SCOPE)
- endif()
- endfunction()
- set(fatal_error FALSE)
- function(check_version file manifest_versions)
- set(manifest_versions ${manifest_versions} ${allow_versions})
-
- crt_version(${file} file_versions)
-
- foreach(ver ${file_versions})
- list(FIND manifest_versions "${ver}" found_version)
- if("${found_version}" EQUAL -1)
- message("ERROR: ${file} uses ${ver} not found in shipped manifests:[${manifest_versions}].")
- set(fatal_error TRUE PARENT_SCOPE)
- endif()
- endforeach()
- list(LENGTH file_versions len)
- if(${len} GREATER 1)
- message("WARNING: found more than one version of MICROSOFT.VC80.CRT referenced in ${file}: [${file_versions}]")
- endif()
- endfunction()
- set(manifest_version_list )
- file(GLOB_RECURSE manifest_files "*.manifest")
- foreach(f ${manifest_files})
- crt_version("${f}" manifest_version_list)
- endforeach()
- list(LENGTH manifest_version_list LEN)
- if(LEN EQUAL 0)
- message(FATAL_ERROR "No .manifest files found, no version check can be done.")
- endif()
- message("Versions found in ${manifest_files}: ${manifest_version_list}")
- if(DEFINED allow_versions)
- message("Extra versions allowed: ${allow_versions}")
- endif()
- file(GLOB_RECURSE exe_files "*.exe")
- file(GLOB_RECURSE dll_files "*.dll")
- set(exe_files ${exe_files} ${dll_files})
- foreach(f ${exe_files})
- check_version(${f} "${manifest_version_list}")
- endforeach()
- if(fatal_error)
- message(FATAL_ERROR "This distribution embeds dll "
- " versions that it does not ship, and may not work on other machines.")
- endif()
|