Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 8 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions ports/tidy-html5/cmake_find_package_support.patch
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions ports/tidy-html5/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ vcpkg_from_github(
static-vs-shared.patch
debug-postfix.patch
fix_unsupport_func_uwp.patch
cmake_find_package_support.patch
)

string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED_LIB)
Expand All @@ -21,6 +22,7 @@ vcpkg_cmake_configure(
)
vcpkg_cmake_install()
vcpkg_fixup_pkgconfig()
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-tidy-html5 CONFIG_PATH lib/cmake/unofficial-tidy-html5)

file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
Expand Down
6 changes: 5 additions & 1 deletion ports/tidy-html5/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
{
"name": "tidy-html5",
"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.",
"homepage": "https://www.html-tidy.org",
"license": null,
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -8862,7 +8862,7 @@
},
"tidy-html5": {
"baseline": "5.8.0",
"port-version": 1
"port-version": 2
},
"tiff": {
"baseline": "4.6.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/t-/tidy-html5.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "24f53a11ec9d660daf1819fe37d6377d927695a0",
"version": "5.8.0",
"port-version": 2
},
{
"git-tree": "3ff916aaab30ac5a85e702ab9cf4e8092db79477",
"version": "5.8.0",
Expand Down