aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-03-24 12:49:08 -0700
committerAlexander Karatarakis <alkarata@microsoft.com>2017-03-24 12:49:08 -0700
commit3b511adfe483ebde8a3680fefbd96723201a6667 (patch)
tree5a449ab0e1a86eca83621cf9a14ec4a762da0a43 /toolsrc/src
parentcbfc4c0e54bd70f38b8b82d426d7a7291c5f2c0d (diff)
downloadvcpkg-3b511adfe483ebde8a3680fefbd96723201a6667.tar.gz
vcpkg-3b511adfe483ebde8a3680fefbd96723201a6667.zip
Add EMPTY_INCLUDE_FOLDER policy. Resolves #816
Diffstat (limited to 'toolsrc/src')
-rw-r--r--toolsrc/src/PostBuildLint.cpp34
-rw-r--r--toolsrc/src/PostBuildLint_BuildPolicies.cpp11
2 files changed, 31 insertions, 14 deletions
diff --git a/toolsrc/src/PostBuildLint.cpp b/toolsrc/src/PostBuildLint.cpp
index 9032a3c11..5f271d84f 100644
--- a/toolsrc/src/PostBuildLint.cpp
+++ b/toolsrc/src/PostBuildLint.cpp
@@ -7,6 +7,7 @@
#include "coff_file_reader.h"
#include "PostBuildLint_BuildInfo.h"
#include "PostBuildLint_BuildType.h"
+#include "PostBuildLint.h"
namespace vcpkg::PostBuildLint
{
@@ -52,8 +53,25 @@ namespace vcpkg::PostBuildLint
return v;
}
- static lint_status check_for_files_in_include_directory(const fs::path& package_dir)
+ template <class T>
+ static bool contains_and_enabled(const std::map<T, opt_bool_t> map, const T& key)
+ {
+ auto it = map.find(key);
+ if (it != map.cend() && it->second == opt_bool_t::ENABLED)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ static lint_status check_for_files_in_include_directory(const std::map<BuildPolicies::type, opt_bool_t>& policies, const fs::path& package_dir)
{
+ if (contains_and_enabled(policies, BuildPolicies::EMPTY_INCLUDE_FOLDER))
+ {
+ return lint_status::SUCCESS;
+ }
+
const fs::path include_dir = package_dir / "include";
if (!fs::exists(include_dir) || fs::is_empty(include_dir))
{
@@ -601,18 +619,6 @@ namespace vcpkg::PostBuildLint
left += static_cast<size_t>(right);
}
- template <class T>
- static bool contains_and_enabled(const std::map<T, opt_bool_t> map, const T& key)
- {
- auto it = map.find(key);
- if (it != map.cend() && it->second == opt_bool_t::ENABLED)
- {
- return true;
- }
-
- return false;
- }
-
static size_t perform_all_checks_and_return_error_count(const package_spec& spec, const vcpkg_paths& paths)
{
const fs::path dumpbin_exe = Environment::get_dumpbin_exe(paths);
@@ -627,7 +633,7 @@ namespace vcpkg::PostBuildLint
return error_count;
}
- error_count += check_for_files_in_include_directory(package_dir);
+ error_count += check_for_files_in_include_directory(build_info.policies, package_dir);
error_count += check_for_files_in_debug_include_directory(package_dir);
error_count += check_for_files_in_debug_share_directory(package_dir);
error_count += check_folder_lib_cmake(package_dir, spec);
diff --git a/toolsrc/src/PostBuildLint_BuildPolicies.cpp b/toolsrc/src/PostBuildLint_BuildPolicies.cpp
index b7ebf5380..dab27b72a 100644
--- a/toolsrc/src/PostBuildLint_BuildPolicies.cpp
+++ b/toolsrc/src/PostBuildLint_BuildPolicies.cpp
@@ -10,6 +10,7 @@ namespace vcpkg::PostBuildLint::BuildPolicies
static const std::string NAME_EMPTY_PACKAGE = "PolicyEmptyPackage";
static const std::string NAME_DLLS_WITHOUT_LIBS = "PolicyDLLsWithoutLIBs";
static const std::string NAME_ONLY_RELEASE_CRT = "PolicyOnlyReleaseCRT";
+ static const std::string NAME_EMPTY_INCLUDE_FOLDER = "PolicyEmptyIncludeFolder";
const std::string& type::toString() const
{
@@ -21,6 +22,8 @@ namespace vcpkg::PostBuildLint::BuildPolicies
return NAME_DLLS_WITHOUT_LIBS;
case ONLY_RELEASE_CRT:
return NAME_ONLY_RELEASE_CRT;
+ case EMPTY_INCLUDE_FOLDER:
+ return NAME_EMPTY_INCLUDE_FOLDER;
case NULLVALUE:
return NULLVALUE_STRING;
default:
@@ -33,6 +36,7 @@ namespace vcpkg::PostBuildLint::BuildPolicies
static const std::string CMAKE_VARIABLE_EMPTY_PACKAGE = "VCPKG_POLICY_EMPTY_PACKAGE";
static const std::string CMAKE_VARIABLE_DLLS_WITHOUT_LIBS = "VCPKG_POLICY_DLLS_WITHOUT_LIBS";
static const std::string CMAKE_VARIABLE_ONLY_RELEASE_CRT = "VCPKG_POLICY_ONLY_RELEASE_CRT";
+ static const std::string CMAKE_VARIABLE_EMPTY_INCLUDE_FOLDER = "VCPKG_POLICY_EMPTY_INCLUDE_FOLDER";
switch (this->backing_enum)
{
@@ -42,6 +46,8 @@ namespace vcpkg::PostBuildLint::BuildPolicies
return CMAKE_VARIABLE_DLLS_WITHOUT_LIBS;
case ONLY_RELEASE_CRT:
return CMAKE_VARIABLE_ONLY_RELEASE_CRT;
+ case EMPTY_INCLUDE_FOLDER:
+ return CMAKE_VARIABLE_EMPTY_INCLUDE_FOLDER;
case NULLVALUE:
Enums::nullvalue_used(VCPKG_LINE_INFO, ENUM_NAME);
default:
@@ -66,6 +72,11 @@ namespace vcpkg::PostBuildLint::BuildPolicies
return BuildPolicies::ONLY_RELEASE_CRT;
}
+ if (s == NAME_EMPTY_INCLUDE_FOLDER)
+ {
+ return BuildPolicies::EMPTY_INCLUDE_FOLDER;
+ }
+
return BuildPolicies::NULLVALUE;
}
}