build: add CMake options for system library linking
Partial fix for #1718
Adds CMake options for system library linking as foundation for full implementation:
- USE_SYSTEM_ZLIB - Use system zlib instead of bundled
- USE_SYSTEM_LIBPNG - Use system libpng instead of bundled
- USE_SYSTEM_FREETYPE - Use system freetype instead of bundled
Current behaviour: Options are OFF by default, existing bundled libraries still used Future work: Implement actual system library detection and linking
This is phase 1 of addressing #1718 - adding the configuration framework before implementing the full system library support.
Fixed the CMake conditional nesting and cleaned up how the existing USE_SYSTEM_* options are handled. Defaults remain unchanged.
Thanks for the detailed review — all points addressed Removed duplicate USE_SYSTEM_ZLIB option Fixed misplaced source directories in ZLIB logic Completed USE_SYSTEM_FREETYPE with proper system/bundled switching Deduplicated macOS arm64 libpng handling Cleaned up formatting and conditionals Please take another look