From 6322c0c2b09897c8b4598c51802bb9249b73eb45 Mon Sep 17 00:00:00 2001 From: gitlost Date: Mon, 30 Nov 2020 15:51:14 +0000 Subject: [PATCH] #213 Use PNG::PNG for libpng, require cmake 3.5, props Schaich Alonso --- CMakeLists.txt | 2 +- backend/CMakeLists.txt | 43 +++++++++++++++++++++--------------------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 25c015d4..36697d71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # (c) 2008 by BogDan Vatra < bogdan@licentia.eu > # vim: set ts=4 sw=4 et : -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.5) project(zint-package) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/backend/CMakeLists.txt b/backend/CMakeLists.txt index 6d0377f7..7d4a6433 100644 --- a/backend/CMakeLists.txt +++ b/backend/CMakeLists.txt @@ -1,4 +1,5 @@ # (c) 2008 by BogDan Vatra < bogdan@licentia.eu > +# vim: set ts=4 sw=4 et : project(zint) @@ -13,34 +14,34 @@ set(zint_TWODIM_SRCS code16k.c codablock.c dmatrix.c pdf417.c qr.c maxicode.c co set(zint_OUTPUT_SRCS vector.c ps.c svg.c emf.c bmp.c pcx.c gif.c png.c tif.c raster.c output.c) set(zint_SRCS ${zint_OUTPUT_SRCS} ${zint_COMMON_SRCS} ${zint_ONEDIM_SRCS} ${zint_POSTAL_SRCS} ${zint_TWODIM_SRCS}) -if(PNG_FOUND) - include_directories( ${PNG_INCLUDES} ) -else(PNG_FOUND) - add_definitions (-DNO_PNG) -endif(PNG_FOUND) +if(NOT PNG_FOUND) + add_definitions(-DNO_PNG) +endif() add_library(zint SHARED ${zint_SRCS}) -if(ZINT_STATIC) - add_library(zint-static STATIC ${zint_SRCS}) -endif(ZINT_STATIC) -set_target_properties(zint PROPERTIES SOVERSION "${ZINT_VERSION_MAJOR}.${ZINT_VERSION_MINOR}" - VERSION ${ZINT_VERSION}) +if(ZINT_STATIC) + add_library(zint-static STATIC ${zint_SRCS}) +endif() + +set_target_properties(zint PROPERTIES SOVERSION "${ZINT_VERSION_MAJOR}.${ZINT_VERSION_MINOR}" + VERSION ${ZINT_VERSION}) if(PNG_FOUND) - target_link_libraries(zint ${PNG_LIBRARIES} ) -endif(PNG_FOUND) + target_link_libraries(zint PNG::PNG) +endif() + if(NOT MSVC) - # Link with standard C math library. - target_link_libraries(zint m) -endif(NOT MSVC) + # Link with standard C math library. + target_link_libraries(zint m) +endif() if(MSVC) - # "BUILD_SHARED_LIBS" is a CMake defined variable, see documentation. - if(BUILD_SHARED_LIBS) - add_definitions("-DDLL_EXPORT") - endif(BUILD_SHARED_LIBS) -endif(MSVC) + # "BUILD_SHARED_LIBS" is a CMake defined variable, see documentation. + if(BUILD_SHARED_LIBS) + add_definitions("-DDLL_EXPORT") + endif() +endif() -install(TARGETS zint ${INSTALL_TARGETS_DEFAULT_ARGS} ) +install(TARGETS zint ${INSTALL_TARGETS_DEFAULT_ARGS}) install(FILES zint.h DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)