post build check: Always allow .pc files in lib/pkgconfig and debug/lib/pkgconfig (#906)

This commit is contained in:
autoantwort 2023-02-16 00:08:41 +01:00 коммит произвёл GitHub
Родитель 931d8045a8
Коммит 874159ce4a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 14 добавлений и 3 удалений

Просмотреть файл

@ -3,9 +3,12 @@ set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)
if("header-only-good" IN_LIST FEATURES)
configure_file("${CMAKE_CURRENT_LIST_DIR}/wrong-pkgconfig.pc.in" "${CURRENT_PACKAGES_DIR}/share/pkgconfig/wrong-pkgconfig.pc" @ONLY)
endif()
if("header-only-bad" IN_LIST FEATURES)
if("header-only-in-lib" IN_LIST FEATURES)
configure_file("${CMAKE_CURRENT_LIST_DIR}/wrong-pkgconfig.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/wrong-pkgconfig.pc" @ONLY)
endif()
if("header-only-bad" IN_LIST FEATURES)
configure_file("${CMAKE_CURRENT_LIST_DIR}/wrong-pkgconfig.pc.in" "${CURRENT_PACKAGES_DIR}/share/configs/wrong-pkgconfig.pc" @ONLY)
endif()
set(LIBS "Libs: \"-L${libdir}\" -lwrong-pkgconfig")
if("lib-good" IN_LIST FEATURES)
configure_file("${CMAKE_CURRENT_LIST_DIR}/wrong-pkgconfig.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/wrong-pkgconfig.pc" @ONLY)

Просмотреть файл

@ -6,6 +6,9 @@
"header-only-good": {
"description": ""
},
"header-only-in-lib": {
"description": ""
},
"header-only-bad": {
"description": ""
},

Просмотреть файл

@ -8,6 +8,10 @@ Run-Vcpkg @commonArgs install "wrong-pkgconfig[header-only-good]"
Throw-IfFailed
Remove-Item -Recurse -Force $installRoot
Run-Vcpkg @commonArgs install "wrong-pkgconfig[header-only-in-lib]"
Throw-IfFailed
Remove-Item -Recurse -Force $installRoot
Run-Vcpkg @commonArgs install "wrong-pkgconfig[header-only-bad]"
Throw-IfNotFailed
Remove-Item -Recurse -Force $installRoot

Просмотреть файл

@ -837,6 +837,9 @@ namespace vcpkg
{
if (!Strings::ends_with(path, ".pc")) continue;
const auto parent_path = Path(path.parent_path());
// Always allow .pc files at 'lib/pkgconfig' and 'debug/lib/pkgconfig'
if (parent_path == lib_dir || parent_path == debug_dir) continue;
const bool contains_libs =
Util::any_of(fs.read_lines(path).value_or_exit(VCPKG_LINE_INFO), [](const std::string& line) {
if (Strings::starts_with(line, "Libs"))
@ -860,13 +863,11 @@ namespace vcpkg
const bool is_debug = Strings::starts_with(path, Path(dir) / "debug");
if (is_debug)
{
if (parent_path == debug_dir) continue;
misplaced_pkgconfig_files.push_back({std::move(path), MisplacedFile::Type::Debug});
contains_debug = true;
}
else
{
if (parent_path == lib_dir) continue;
misplaced_pkgconfig_files.push_back({std::move(path), MisplacedFile::Type::Release});
contains_release = true;
}