Skip to content

[wt] fix HPDF::HPDF link error#49495

Merged
BillyONeal merged 2 commits intomicrosoft:masterfrom
toge:wt-fix-hpdf-link
Jan 30, 2026
Merged

[wt] fix HPDF::HPDF link error#49495
BillyONeal merged 2 commits intomicrosoft:masterfrom
toge:wt-fix-hpdf-link

Conversation

@toge
Copy link
Contributor

@toge toge commented Jan 19, 2026

  • Changes comply with the maintainer guide.
  • SHA512s are updated for each updated download.
  • The "supports" clause reflects platforms that may be fixed by this new version.
  • Any fixed CI baseline entries are removed from that file.
  • Any patches that are no longer applied are deleted from the port's directory.
  • The version database is fixed by rerunning ./vcpkg x-add-version --all and committing the result.
  • Only one version is added to each modified port's versions file.

I met compilation errors on linking wt.
This PR tries to fix it.

CMake Error at build/vcpkg_installed/x64-linux/share/wt/wt-target-wt.cmake:61 (set_target_properties):
  The link interface of target "Wt::Wt" contains:

    HPDF::HPDF

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Comment on lines 5 to 36
@@ -275,8 +275,7 @@ find_package(GLEW)

find_package(Asciidoctor)

-set(HPDF_ROOT ${HARU_PREFIX})
-find_package(HPDF)
+find_package(unofficial-libharu CONFIG REQUIRED)

set(OPENSSL_ROOT_DIR ${SSL_PREFIX})
find_package(OpenSSL)
@@ -578,7 +577,7 @@ IF(NOT EXISTS ${CONFIGDIR}/wt_config.xml)
INSTALL(FILES ${WT_BINARY_DIR}/wt_config.xml DESTINATION ${CONFIGDIR})
ENDIF (NOT EXISTS ${CONFIGDIR}/wt_config.xml)

-if(ENABLE_HARU AND HPDF_FOUND)
+if(ENABLE_HARU)
set(HAVE_HARU ON)
set(WT_HAS_WPDFIMAGE true)
endif()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4033d78..939d8aa 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -654,7 +654,7 @@ if(HAVE_HARU)
# Even though WPdfImage.h exposes <hpdf.h>, we mark it as private here, because most users of Wt don't need it.
# We don't want to include it in the INTERFACE_LINK_LIBRARIES in the generated wt-target-wt.cmake file, since
# FindHPDF.cmake is not a standard find module.
- target_link_libraries(wt PRIVATE HPDF::HPDF)
+ target_link_libraries(wt PRIVATE unofficial::libharu::hpdf)
else()
message("** Disabling PDF support (WPdfImage, WPdfRenderer): requires libharu.")
if(ENABLE_HARU)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would prefer to collapse the three chunks to a single:

Suggested change
@@ -275,8 +275,7 @@ find_package(GLEW)
find_package(Asciidoctor)
-set(HPDF_ROOT ${HARU_PREFIX})
-find_package(HPDF)
+find_package(unofficial-libharu CONFIG REQUIRED)
set(OPENSSL_ROOT_DIR ${SSL_PREFIX})
find_package(OpenSSL)
@@ -578,7 +577,7 @@ IF(NOT EXISTS ${CONFIGDIR}/wt_config.xml)
INSTALL(FILES ${WT_BINARY_DIR}/wt_config.xml DESTINATION ${CONFIGDIR})
ENDIF (NOT EXISTS ${CONFIGDIR}/wt_config.xml)
-if(ENABLE_HARU AND HPDF_FOUND)
+if(ENABLE_HARU)
set(HAVE_HARU ON)
set(WT_HAS_WPDFIMAGE true)
endif()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4033d78..939d8aa 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -654,7 +654,7 @@ if(HAVE_HARU)
# Even though WPdfImage.h exposes <hpdf.h>, we mark it as private here, because most users of Wt don't need it.
# We don't want to include it in the INTERFACE_LINK_LIBRARIES in the generated wt-target-wt.cmake file, since
# FindHPDF.cmake is not a standard find module.
- target_link_libraries(wt PRIVATE HPDF::HPDF)
+ target_link_libraries(wt PRIVATE unofficial::libharu::hpdf)
else()
message("** Disabling PDF support (WPdfImage, WPdfRenderer): requires libharu.")
if(ENABLE_HARU)
@@ -275,8 +275,8 @@ find_package(GLEW)
find_package(Asciidoctor)
-set(HPDF_ROOT ${HARU_PREFIX})
-find_package(HPDF)
+find_package(HPDF NAMES unofficial-libharu CONFIG REQUIRED)
+add_library(HPDF::HPDF ALIAS unofficial::libharu::hpdf)
set(OPENSSL_ROOT_DIR ${SSL_PREFIX})
find_package(OpenSSL)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dg0yt
Thanks lot!
It has become very simple and easier to maintain.

endif()
-
+if(@ENABLE_HARU@)
+ find_package(unofficial-libharu QUIET)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some day they will use find_dependency() ;-)

Copy link
Member

@vicroms vicroms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please apply dg0yt's suggestions

@vicroms vicroms marked this pull request as draft January 25, 2026 08:26
@toge toge marked this pull request as ready for review January 29, 2026 15:47
Copy link
Member

@BillyONeal BillyONeal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@BillyONeal BillyONeal dismissed vicroms’s stale review January 30, 2026 02:04

Suggestions were applied

@BillyONeal BillyONeal merged commit 3895230 into microsoft:master Jan 30, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants