diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5f8a2a6..1ffd0a0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -195,8 +195,11 @@ if(EXISTS ${PROJECT_SOURCE_DIR}/Redis AND ENABLE_REDIS)
 add_subdirectory(Redis)
 list(APPEND Poco_COMPONENTS "Redis")
 endif()
-if(EXISTS ${PROJECT_SOURCE_DIR}/PDF AND ENABLE_PDF)
-add_subdirectory(PDF)
+if(ENABLE_PDF)
+include(SelectLibraryConfigurations)
+find_library(PocoPDF_LIBRARY_RELEASE NAMES libhpdf)
+find_library(PocoPDF_LIBRARY_DEBUG NAMES libhpdfd)
+select_library_configurations(PocoPDF)
 list(APPEND Poco_COMPONENTS "PDF")
 endif()
 
