1.15.0 CMake build failure with -DENABLE_PDF:BOOL=FALSE
envgap__pocoproject__poco-5196
01 / FAILURE SIGNATURE
As reported upstream
Target "_BUNDLED_HPDF" links to:
Not a benchmark task.
- The project already builds and runs before the fix, so there is nothing to repair.
02 / ENVIRONMENT RECIPE
- Base commit
52c558fbcda0578467e4f59c96961eb629ed3c77- Manifest
CMakeLists.txt- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
pocoproject/poco #5196 · read the original issue
**Describe the bug**
Trying to build poco 1.15.0 with `-DENABLE_PDF:BOOL=FALSE` and not having libpng available fails with:
```
[...]
CMake Error at dependencies/hpdf/CMakeLists.txt:21 (target_link_libraries):
Target "_BUNDLED_HPDF" links to:
PNG::PNG
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.
CMake Generate step failed. Build files cannot be regenerated correctly.
```
**To Reproduce**
Pass `-DENABLE_PDF:BOOL=FALSE` and do not have libpng installed.
**Expected behavior**
Build without failing like the previous version 1.14.2 does.
**Logs**
[poco-poco-1.15.0-release_build_job.log](https://github.com/user-attachments/files/25221959/poco-poco-1.15.0-release_build_job.log)
**Please add relevant environment information:**
- OS Type and Version: Exherbo Linux
- POCO Version: 1.15.0
- Third-party product: -
**Additional context**
* should probably also not check for sqlite when building with `-DENABLE_DATA_SQLITE:BOOL=FALSE` which can also be seen in the attached log.
* https://github.com/pocoproject/poco/blob/main/CMakeLists.txt#L279-L288 is quite misleading as well when not using the bundled deps at all as it reads using `Using internal zlib, pcre2, expat, libpng, ...` but still (correctly) checks for the external/unbundled ones:
```
-- Using external sqlite
-- Using internal zlib, pcre2, expat, libpng, ...
-- Found OpenSSL: /usr/x86_64-pc-linux-gnu/lib/openssl-3/lib/libcrypto.so (found suitable version "3.5.5", minimum required is "1.1.1")
-- Found ZLIB: /usr/x86_64-pc-linux-gnu/lib/libz.so (found version "1.3.1")
-- Found PCRE2: /usr/x86_64-pc-linux-gnu/lib/libpcre2-8.so
-- Found Utf8Proc: /usr/x86_64-pc-linux-gnu/lib/libutf8proc.so
-- Found SQLite3: /usr/x86_64-pc-linux-gnu/include (found version "3.51.2")
CMake Warning at dependencies/sqlite3/CMakeLists.txt:11 (message):
Unbundled SQLite3: Assuming that it was compiled with SQLITE_THREADSAFE=1
-- Found EXPAT: /usr/x86_64-pc-linux-gnu/lib/libexpat.so (found version "2.7.4")
-- Could NOT find PNG (missing: PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
```
04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]