Add policies to build_info.cmake and write the file only once. (#38629)

This adds new policies to `build_info.cmake` in support of making all
post build checks have suppressions.

In support of WIP:
7f59eca724
This commit is contained in:
Billy O'Neal 2024-05-08 20:47:22 -07:00 committed by GitHub
parent 3dcd8bb40b
commit 77b0517c52
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,46 +1,92 @@
set(BUILD_INFO_FILE_PATH ${CURRENT_PACKAGES_DIR}/BUILD_INFO) set(Z_BUILD_INFO_FILE_CONTENTS "CRTLinkage: ${VCPKG_CRT_LINKAGE}\n")
file(WRITE ${BUILD_INFO_FILE_PATH} "CRTLinkage: ${VCPKG_CRT_LINKAGE}\n") string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "LibraryLinkage: ${VCPKG_LIBRARY_LINKAGE}\n")
file(APPEND ${BUILD_INFO_FILE_PATH} "LibraryLinkage: ${VCPKG_LIBRARY_LINKAGE}\n")
if (DEFINED VCPKG_POLICY_DLLS_WITHOUT_LIBS) if (DEFINED VCPKG_POLICY_DLLS_WITHOUT_LIBS)
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyDLLsWithoutLIBs: ${VCPKG_POLICY_DLLS_WITHOUT_LIBS}\n") string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicyDLLsWithoutLIBs: ${VCPKG_POLICY_DLLS_WITHOUT_LIBS}\n")
endif() endif()
if (DEFINED VCPKG_POLICY_DLLS_WITHOUT_EXPORTS) if (DEFINED VCPKG_POLICY_DLLS_WITHOUT_EXPORTS)
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyDLLsWithoutExports: ${VCPKG_POLICY_DLLS_WITHOUT_EXPORTS}\n") string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicyDLLsWithoutExports: ${VCPKG_POLICY_DLLS_WITHOUT_EXPORTS}\n")
endif() endif()
if (DEFINED VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY) if (DEFINED VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY)
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyDLLsInStaticLibrary: ${VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY}\n") string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicyDLLsInStaticLibrary: ${VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY}\n")
endif() endif()
if (DEFINED VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES) if (DEFINED VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES)
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyMismatchedNumberOfBinaries: ${VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES}\n") string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicyMismatchedNumberOfBinaries: ${VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES}\n")
endif() endif()
if (DEFINED VCPKG_POLICY_EMPTY_PACKAGE) if (DEFINED VCPKG_POLICY_EMPTY_PACKAGE)
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyEmptyPackage: ${VCPKG_POLICY_EMPTY_PACKAGE}\n") string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicyEmptyPackage: ${VCPKG_POLICY_EMPTY_PACKAGE}\n")
endif() endif()
if (DEFINED VCPKG_POLICY_ONLY_RELEASE_CRT) if (DEFINED VCPKG_POLICY_ONLY_RELEASE_CRT)
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyOnlyReleaseCRT: ${VCPKG_POLICY_ONLY_RELEASE_CRT}\n") string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicyOnlyReleaseCRT: ${VCPKG_POLICY_ONLY_RELEASE_CRT}\n")
endif() endif()
if (DEFINED VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT) if (DEFINED VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT)
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyAllowObsoleteMsvcrt: ${VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT}\n") string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicyAllowObsoleteMsvcrt: ${VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT}\n")
endif() endif()
if (DEFINED VCPKG_POLICY_EMPTY_INCLUDE_FOLDER) if (DEFINED VCPKG_POLICY_EMPTY_INCLUDE_FOLDER)
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyEmptyIncludeFolder: ${VCPKG_POLICY_EMPTY_INCLUDE_FOLDER}\n") string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicyEmptyIncludeFolder: ${VCPKG_POLICY_EMPTY_INCLUDE_FOLDER}\n")
endif() endif()
if (DEFINED VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS) if (DEFINED VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS)
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyAllowRestrictedHeaders: ${VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS}\n") string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicyAllowRestrictedHeaders: ${VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS}\n")
endif() endif()
if (DEFINED VCPKG_POLICY_SKIP_DUMPBIN_CHECKS) if (DEFINED VCPKG_POLICY_SKIP_DUMPBIN_CHECKS)
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicySkipDumpbinChecks: ${VCPKG_POLICY_SKIP_DUMPBIN_CHECKS}\n") string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicySkipDumpbinChecks: ${VCPKG_POLICY_SKIP_DUMPBIN_CHECKS}\n")
endif() endif()
if (DEFINED VCPKG_POLICY_SKIP_ARCHITECTURE_CHECK) if (DEFINED VCPKG_POLICY_SKIP_ARCHITECTURE_CHECK)
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicySkipArchitectureCheck: ${VCPKG_POLICY_SKIP_ARCHITECTURE_CHECK}\n") string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicySkipArchitectureCheck: ${VCPKG_POLICY_SKIP_ARCHITECTURE_CHECK}\n")
endif() endif()
if (DEFINED VCPKG_POLICY_CMAKE_HELPER_PORT) if (DEFINED VCPKG_POLICY_CMAKE_HELPER_PORT)
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyCmakeHelperPort: ${VCPKG_POLICY_CMAKE_HELPER_PORT}\n") string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicyCmakeHelperPort: ${VCPKG_POLICY_CMAKE_HELPER_PORT}\n")
endif() endif()
if (DEFINED VCPKG_POLICY_SKIP_ABSOLUTE_PATHS_CHECK) if (DEFINED VCPKG_POLICY_SKIP_ABSOLUTE_PATHS_CHECK)
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicySkipAbsolutePathsCheck: ${VCPKG_POLICY_SKIP_ABSOLUTE_PATHS_CHECK}\n") string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicySkipAbsolutePathsCheck: ${VCPKG_POLICY_SKIP_ABSOLUTE_PATHS_CHECK}\n")
endif() endif()
if (DEFINED VCPKG_POLICY_SKIP_ALL_POST_BUILD_CHECKS)
string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicySkipAllPostBuildChecks: ${VCPKG_POLICY_SKIP_ALL_POST_BUILD_CHECKS}\n")
endif()
if (DEFINED VCPKG_POLICY_SKIP_APPCONTAINER_CHECK)
string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicySkipAppcontainerCheck: ${VCPKG_POLICY_SKIP_APPCONTAINER_CHECK}\n")
endif()
if (DEFINED VCPKG_POLICY_SKIP_CRT_LINKAGE_CHECK)
string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicySkipCrtLinkageCheck: ${VCPKG_POLICY_SKIP_CRT_LINKAGE_CHECK}\n")
endif()
if (DEFINED VCPKG_POLICY_SKIP_MISPLACED_CMAKE_FILES_CHECK)
string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicySkipMisplacedCMakeFilesCheck: ${VCPKG_POLICY_SKIP_MISPLACED_CMAKE_FILES_CHECK}\n")
endif()
if (DEFINED VCPKG_POLICY_SKIP_LIB_CMAKE_MERGE_CHECK)
string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicySkipLibCMakeMergeCheck: ${VCPKG_POLICY_SKIP_LIB_CMAKE_MERGE_CHECK}\n")
endif()
if (DEFINED VCPKG_POLICY_ALLOW_DLLS_IN_LIB)
string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicyAllowDllsInLib: ${VCPKG_POLICY_ALLOW_DLLS_IN_LIB}\n")
endif()
if (DEFINED VCPKG_POLICY_SKIP_MISPLACED_REGULAR_FILES_CHECK)
string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicySkipMisplacedRegularFilesCheck: ${VCPKG_POLICY_SKIP_MISPLACED_REGULAR_FILES_CHECK}\n")
endif()
if (DEFINED VCPKG_POLICY_SKIP_COPYRIGHT_CHECK)
string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicySkipCopyrightCheck: ${VCPKG_POLICY_SKIP_COPYRIGHT_CHECK}\n")
endif()
if (DEFINED VCPKG_POLICY_ALLOW_KERNEL32_FROM_XBOX)
string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicyAllowKernel32FromXBox: ${VCPKG_POLICY_ALLOW_KERNEL32_FROM_XBOX}\n")
endif()
if (DEFINED VCPKG_POLICY_ALLOW_EXES_IN_BIN)
string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicyAllowExesInBin: ${VCPKG_POLICY_ALLOW_EXES_IN_BIN}\n")
endif()
if (DEFINED VCPKG_POLICY_SKIP_USAGE_INSTALL_CHECK)
string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicySkipUsageInstallCheck: ${VCPKG_POLICY_SKIP_USAGE_INSTALL_CHECK}\n")
endif()
if (DEFINED VCPKG_POLICY_ALLOW_EMPTY_FOLDERS)
string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicyAllowEmptyFolders: ${VCPKG_POLICY_ALLOW_EMPTY_FOLDERS}\n")
endif()
if (DEFINED VCPKG_POLICY_ALLOW_DEBUG_INCLUDE)
string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicyAllowDebugInclude: ${VCPKG_POLICY_ALLOW_DEBUG_INCLUDE}\n")
endif()
if (DEFINED VCPKG_POLICY_ALLOW_DEBUG_SHARE)
string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicyAllowDebugShare: ${VCPKG_POLICY_ALLOW_DEBUG_SHARE}\n")
endif()
if (DEFINED VCPKG_POLICY_SKIP_PKGCONFIG_CHECK)
string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "PolicySkipPkgConfigCheck: ${VCPKG_POLICY_SKIP_PKGCONFIG_CHECK}\n")
endif()
if (DEFINED VCPKG_HEAD_VERSION) if (DEFINED VCPKG_HEAD_VERSION)
file(APPEND ${BUILD_INFO_FILE_PATH} "Version: ${VCPKG_HEAD_VERSION}\n") string(APPEND "Z_BUILD_INFO_FILE_CONTENTS" "Version: ${VCPKG_HEAD_VERSION}\n")
endif() endif()
file(WRITE "${CURRENT_PACKAGES_DIR}/BUILD_INFO" "${Z_BUILD_INFO_FILE_CONTENTS}")