diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2017-01-31 18:31:19 -0800 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2017-02-01 11:42:41 -0800 |
| commit | cd0b7d644b2ba61618b70ae58f50d2e880dbe509 (patch) | |
| tree | d6a730f3bc567170ce4ab555396aa682acafd39d | |
| parent | 459999786960483f6d46229524500543459968ed (diff) | |
| download | vcpkg-cd0b7d644b2ba61618b70ae58f50d2e880dbe509.tar.gz vcpkg-cd0b7d644b2ba61618b70ae58f50d2e880dbe509.zip | |
Add PolicyDLLsWithoutLIBs policy
| -rw-r--r-- | scripts/ports.cmake | 6 | ||||
| -rw-r--r-- | toolsrc/src/post_build_lint.cpp | 15 |
2 files changed, 17 insertions, 4 deletions
diff --git a/scripts/ports.cmake b/scripts/ports.cmake index 4e28cbb67..cc01a0619 100644 --- a/scripts/ports.cmake +++ b/scripts/ports.cmake @@ -74,7 +74,11 @@ if(CMD MATCHES "^BUILD$") set(BUILD_INFO_FILE_PATH ${CURRENT_PACKAGES_DIR}/BUILD_INFO) file(WRITE ${BUILD_INFO_FILE_PATH} "CRTLinkage: ${VCPKG_CRT_LINKAGE}\n") - file(APPEND ${BUILD_INFO_FILE_PATH} "LibraryLinkage: ${VCPKG_LIBRARY_LINKAGE}") + file(APPEND ${BUILD_INFO_FILE_PATH} "LibraryLinkage: ${VCPKG_LIBRARY_LINKAGE}\n") + + if (DEFINED VCPKG_POLICY_DLLS_WITHOUT_LIBS) + file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyDLLsWithoutLIBs: ${VCPKG_POLICY_DLLS_WITHOUT_LIBS}\n") + endif() elseif(CMD MATCHES "^CREATE$") file(TO_NATIVE_PATH ${VCPKG_ROOT_DIR} NATIVE_VCPKG_ROOT_DIR) file(TO_NATIVE_PATH ${DOWNLOADS} NATIVE_DOWNLOADS) diff --git a/toolsrc/src/post_build_lint.cpp b/toolsrc/src/post_build_lint.cpp index daf6f49ee..009f8019c 100644 --- a/toolsrc/src/post_build_lint.cpp +++ b/toolsrc/src/post_build_lint.cpp @@ -368,11 +368,20 @@ namespace vcpkg::PostBuildLint return lint_status::ERROR_DETECTED; } - static lint_status check_lib_files_are_available_if_dlls_are_available(const size_t lib_count, const size_t dll_count, const fs::path& lib_dir) + static lint_status check_lib_files_are_available_if_dlls_are_available(const std::map<BuildPolicies::type, opt_bool_t>& policies, const size_t lib_count, const size_t dll_count, const fs::path& lib_dir) { + auto it = policies.find(BuildPolicies::DLLS_WITHOUT_LIBS); + if (it != policies.cend() && it->second == opt_bool_t::DISABLED) + { + return lint_status::SUCCESS; + } + if (lib_count == 0 && dll_count != 0) { System::println(System::color::warning, "Import libs were not present in %s", lib_dir.generic_string()); + System::println(System::color::warning, + "If this is intended, add the following line in the portfile:\n" + " SET(%s disabled)", BuildPolicies::DLLS_WITHOUT_LIBS.cmake_variable()); return lint_status::ERROR_DETECTED; } @@ -616,8 +625,8 @@ namespace vcpkg::PostBuildLint error_count += check_matching_debug_and_release_binaries(debug_dlls, release_dlls); - error_count += check_lib_files_are_available_if_dlls_are_available(debug_libs.size(), debug_dlls.size(), debug_lib_dir); - error_count += check_lib_files_are_available_if_dlls_are_available(release_libs.size(), release_dlls.size(), release_lib_dir); + error_count += check_lib_files_are_available_if_dlls_are_available(build_info.policies, debug_libs.size(), debug_dlls.size(), debug_lib_dir); + error_count += check_lib_files_are_available_if_dlls_are_available(build_info.policies, release_libs.size(), release_dlls.size(), release_lib_dir); std::vector<fs::path> dlls; dlls.insert(dlls.cend(), debug_dlls.cbegin(), debug_dlls.cend()); |
