From 42bc49b89ae25b35f8edf21f539c51bccccb2b1e Mon Sep 17 00:00:00 2001 From: Lephenixnoir Date: Sun, 11 Apr 2021 20:27:25 +0200 Subject: [PATCH] cmake: use PkgConfig to find libpng The FindPNG module fails catastrophically on Mac OS because it searches for the library and header independently, and ends up pulling a completely unrelated header from a random framework. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 468e647..ea9ce75 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ project(fxSDK VERSION 2.3.1 LANGUAGES C) option(FXLINK_DISABLE_UDISKS2 "Do not build the UDisks2-based features of fxlink") find_package(PkgConfig REQUIRED) -find_package(PNG REQUIRED) +pkg_check_modules(libpng REQUIRED libpng16 IMPORTED_TARGET) pkg_check_modules(libusb REQUIRED libusb-1.0 IMPORTED_TARGET) # pkg_check_modules(libudev libudev IMPORTED_TARGET) if(NOT FXLINK_DISABLE_UDISKS2) @@ -23,7 +23,7 @@ add_compile_options(-Wall -Wextra -std=c11 -Og -g -D_GNU_SOURCE) add_executable(fxg1a fxg1a/dump.c fxg1a/edit.c fxg1a/file.c fxg1a/icon.c fxg1a/main.c fxg1a/util.c) target_include_directories(fxg1a PUBLIC fxg1a/) -target_link_libraries(fxg1a PNG::PNG) +target_link_libraries(fxg1a PkgConfig::libpng) # fxsdk add_custom_command(OUTPUT "${BIN}/fxsdk.sh"