From 7b1500da2a7e249fba258d3de83c1915f165f2fc Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sat, 13 Jun 2020 17:18:57 -0400 Subject: [PATCH] extern/libpng: Use find_library --- hecl/extern/libpng/CMakeLists.txt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/hecl/extern/libpng/CMakeLists.txt b/hecl/extern/libpng/CMakeLists.txt index 2fa64a1bf..8ac6df1c4 100644 --- a/hecl/extern/libpng/CMakeLists.txt +++ b/hecl/extern/libpng/CMakeLists.txt @@ -1,7 +1,8 @@ -find_package(PNG) -if(NOT PNG_FOUND) +if(NOT WIN32) # remove when specter/freetype is gone +find_library(PNG_LIB NAMES png libpng) +endif() +if(NOT PNG_LIB) message(STATUS "Using HECL's built-in libpng") -include_directories(${ZLIB_INCLUDE_DIR}) add_library(png png.h pngconf.h @@ -26,11 +27,11 @@ add_library(png pngwrite.c pngwtran.c pngwutil.c) - -set(PNG_LIBRARIES png CACHE PATH "PNG library" FORCE) +target_link_libraries(png PUBLIC ${ZLIB_LIBRARIES}) +target_include_directories(png PUBLIC ${ZLIB_INCLUDE_DIR}) +set(PNG_LIBRARIES png CACHE PATH "PNG libraries" FORCE) set(PNG_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "PNG include path" FORCE) - else() +set(PNG_LIBRARIES ${PNG_LIB} CACHE PATH "PNG libraries" FORCE) find_path(PNG_INCLUDE_DIR png.h) -set(PNG_LIBRARIES ${PNG_LIBRARIES} CACHE PATH "PNG library" FORCE) endif() \ No newline at end of file