[tidy-html5] cmake find_package() support (#41258)

This commit is contained in:
SuperCodeHero 2024-10-03 03:04:17 +08:00 committed by GitHub
parent de32b967d0
commit 54e7ce04c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 56 additions and 2 deletions

View File

@ -0,0 +1,43 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8efec25..3fedb02 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -407,10 +407,12 @@ else ()
OUTPUT_NAME ${LIB_NAME} )
endif ()
+set_target_properties(${name} PROPERTIES EXPORT_NAME tidy)
+target_include_directories( ${name} PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>)
if (NOT TIDY_CONSOLE_SHARED) # user wants default static linkage
list ( APPEND add_LIBS ${name} )
endif ()
-install(TARGETS ${name}
+install(TARGETS ${name} EXPORT unofficial-tidy-html5Config
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
@@ -440,7 +442,9 @@ if (BUILD_SHARED_LIB)
NO_SONAME ${NO_SONAME} )
set_target_properties( ${name} PROPERTIES
COMPILE_FLAGS "-DBUILD_SHARED_LIB -DBUILDING_SHARED_LIB")
- install(TARGETS ${name}
+ set_target_properties(${name} PROPERTIES EXPORT_NAME tidy)
+ target_include_directories( ${name} PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>)
+ install(TARGETS ${name} EXPORT unofficial-tidy-html5Config
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
@@ -450,6 +454,13 @@ if (BUILD_SHARED_LIB)
endif ()
endif ()
+#------------------------------------------------------------------------
+# CMake FIND_PACKAGE() Support
+#------------------------------------------------------------------------
+install(EXPORT unofficial-tidy-html5Config
+ DESTINATION ${LIB_INSTALL_DIR}/cmake/unofficial-tidy-html5
+ NAMESPACE unofficial::tidy-html5::)
+
#------------------------------------------------------------------------
# Main Executable

View File

@ -9,6 +9,7 @@ vcpkg_from_github(
static-vs-shared.patch static-vs-shared.patch
debug-postfix.patch debug-postfix.patch
fix_unsupport_func_uwp.patch fix_unsupport_func_uwp.patch
cmake_find_package_support.patch
) )
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED_LIB) string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED_LIB)
@ -21,6 +22,7 @@ vcpkg_cmake_configure(
) )
vcpkg_cmake_install() vcpkg_cmake_install()
vcpkg_fixup_pkgconfig() vcpkg_fixup_pkgconfig()
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-tidy-html5 CONFIG_PATH lib/cmake/unofficial-tidy-html5)
file(REMOVE_RECURSE file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/include"

View File

@ -1,7 +1,7 @@
{ {
"name": "tidy-html5", "name": "tidy-html5",
"version": "5.8.0", "version": "5.8.0",
"port-version": 1, "port-version": 2,
"description": "Tidy tidies HTML and XML. It can tidy your documents by itself, and developers can easily integrate its features into even more powerful tools.", "description": "Tidy tidies HTML and XML. It can tidy your documents by itself, and developers can easily integrate its features into even more powerful tools.",
"homepage": "https://www.html-tidy.org", "homepage": "https://www.html-tidy.org",
"license": null, "license": null,
@ -9,6 +9,10 @@
{ {
"name": "vcpkg-cmake", "name": "vcpkg-cmake",
"host": true "host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
} }
] ]
} }

View File

@ -8862,7 +8862,7 @@
}, },
"tidy-html5": { "tidy-html5": {
"baseline": "5.8.0", "baseline": "5.8.0",
"port-version": 1 "port-version": 2
}, },
"tiff": { "tiff": {
"baseline": "4.6.0", "baseline": "4.6.0",

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "24f53a11ec9d660daf1819fe37d6377d927695a0",
"version": "5.8.0",
"port-version": 2
},
{ {
"git-tree": "3ff916aaab30ac5a85e702ab9cf4e8092db79477", "git-tree": "3ff916aaab30ac5a85e702ab9cf4e8092db79477",
"version": "5.8.0", "version": "5.8.0",