diff --git a/ports/rapidjson/CONTROL b/ports/rapidjson/CONTROL
index d5b9791856d54a..7fa48bcee34ccb 100644
--- a/ports/rapidjson/CONTROL
+++ b/ports/rapidjson/CONTROL
@@ -1,4 +1,5 @@
Source: rapidjson
Version: 2020-02-08
+Port-Version: 1
Description: A fast JSON parser/generator for C++ with both SAX/DOM style API
Homepage: http://rapidjson.org/
\ No newline at end of file
diff --git a/ports/rapidjson/portfile.cmake b/ports/rapidjson/portfile.cmake
index ed29ddddd5b396..5ebb9160f05110 100644
--- a/ports/rapidjson/portfile.cmake
+++ b/ports/rapidjson/portfile.cmake
@@ -1,6 +1,4 @@
#header-only library
-include(vcpkg_common_functions)
-
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Tencent/rapidjson
@@ -21,13 +19,13 @@ vcpkg_configure_cmake(
)
vcpkg_install_cmake()
-vcpkg_fixup_cmake_targets(CONFIG_PATH cmake)
+vcpkg_fixup_cmake_targets(CONFIG_PATH cmake TARGET_PATH share/RapidJSON)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib ${CURRENT_PACKAGES_DIR}/debug ${CURRENT_PACKAGES_DIR}/share/doc)
-file(READ "${CURRENT_PACKAGES_DIR}/share/rapidjson/RapidJSONConfig.cmake" _contents)
+file(READ "${CURRENT_PACKAGES_DIR}/share/RapidJSON/RapidJSONConfig.cmake" _contents)
string(REPLACE "\${RapidJSON_SOURCE_DIR}" "\${RapidJSON_CMAKE_DIR}/../.." _contents "${_contents}")
-file(WRITE "${CURRENT_PACKAGES_DIR}/share/rapidjson/RapidJSONConfig.cmake" "${_contents}\nset(RAPIDJSON_INCLUDE_DIRS \"\${RapidJSON_INCLUDE_DIRS}\")\n")
+file(WRITE "${CURRENT_PACKAGES_DIR}/share/RapidJSON/RapidJSONConfig.cmake" "${_contents}\nset(RAPIDJSON_INCLUDE_DIRS \"\${RapidJSON_INCLUDE_DIRS}\")\n")
file(INSTALL ${SOURCE_PATH}/license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
diff --git a/toolsrc/src/vcpkg/postbuildlint.cpp b/toolsrc/src/vcpkg/postbuildlint.cpp
index a067b8fc0adfd2..a58fdaf990742c 100644
--- a/toolsrc/src/vcpkg/postbuildlint.cpp
+++ b/toolsrc/src/vcpkg/postbuildlint.cpp
@@ -416,6 +416,59 @@ namespace vcpkg::PostBuildLint
return LintStatus::SUCCESS;
}
+ static LintStatus check_for_cmake_files(const Files::Filesystem& fs, const fs::path& share_dir)
+ {
+ static StringLiteral UPPER_CONFIG = "Config.cmake";
+ static StringLiteral LOWER_CONFIG = "-config.cmake";
+ std::vector shareFolders = fs.get_files_non_recursive(share_dir);
+ for (const auto folder : shareFolders)
+ {
+ if (!fs.is_directory(folder))
+ {
+ continue;
+ }
+
+ const auto files = fs.get_files_non_recursive(folder);
+ fs::path cmake_file;
+ std::string config_prefix;
+ for (const auto file_path : files)
+ {
+ auto filename = fs::u8string(file_path.filename());
+ if (Strings::ends_with(filename, UPPER_CONFIG))
+ {
+ config_prefix = filename.substr(0, filename.size() - UPPER_CONFIG.size());
+ cmake_file = file_path;
+ break;
+ }
+ else if (Strings::ends_with(filename, LOWER_CONFIG))
+ {
+ config_prefix = filename.substr(0, filename.size() - LOWER_CONFIG.size());
+ cmake_file = file_path;
+ break;
+ }
+ }
+
+ auto containing_directory = fs::u8string(cmake_file.parent_path().filename());
+ if (!cmake_file.empty() && config_prefix != containing_directory)
+ {
+ System::printf(System::Color::warning,
+ "The following cmake file %s was found in %s: the config prefix %s did not match the "
+ "containing directory's name %s.\n",
+ cmake_file.filename().string().c_str(),
+ cmake_file.parent_path().string().c_str(),
+ config_prefix.c_str(),
+ cmake_file.parent_path().filename().string().c_str());
+ System::print2(System::Color::warning, "Please add the following code to portfile.cmake:\n");
+ System::printf(System::Color::warning,
+ " vcpkg_fixup_cmake_targets(... TARGET_PATH share/%s).\n",
+ config_prefix);
+ return LintStatus::ERROR_DETECTED;
+ }
+ }
+
+ return LintStatus::SUCCESS;
+ }
+
static LintStatus check_uwp_bit_of_dlls(const std::string& expected_system_name,
const std::vector& dlls,
const fs::path dumpbin_exe)
@@ -860,6 +913,7 @@ namespace vcpkg::PostBuildLint
error_count += check_for_copyright_file(fs, spec, paths);
error_count += check_for_exes(fs, package_dir);
error_count += check_for_exes(fs, package_dir / "debug");
+ error_count += check_for_cmake_files(fs, package_dir / "share");
const fs::path debug_lib_dir = package_dir / "debug" / "lib";
const fs::path release_lib_dir = package_dir / "lib";