#213 Use PNG::PNG for libpng, require cmake 3.5, props Schaich Alonso

This commit is contained in:
gitlost 2020-11-30 15:51:14 +00:00
parent 8e0078695c
commit 6322c0c2b0
2 changed files with 23 additions and 22 deletions

View File

@ -1,7 +1,7 @@
# (c) 2008 by BogDan Vatra < bogdan@licentia.eu > # (c) 2008 by BogDan Vatra < bogdan@licentia.eu >
# vim: set ts=4 sw=4 et : # vim: set ts=4 sw=4 et :
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.5)
project(zint-package) project(zint-package)
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)

View File

@ -1,4 +1,5 @@
# (c) 2008 by BogDan Vatra < bogdan@licentia.eu > # (c) 2008 by BogDan Vatra < bogdan@licentia.eu >
# vim: set ts=4 sw=4 et :
project(zint) 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_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}) set(zint_SRCS ${zint_OUTPUT_SRCS} ${zint_COMMON_SRCS} ${zint_ONEDIM_SRCS} ${zint_POSTAL_SRCS} ${zint_TWODIM_SRCS})
if(PNG_FOUND) if(NOT PNG_FOUND)
include_directories( ${PNG_INCLUDES} ) add_definitions(-DNO_PNG)
else(PNG_FOUND) endif()
add_definitions (-DNO_PNG)
endif(PNG_FOUND)
add_library(zint SHARED ${zint_SRCS}) 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}" if(ZINT_STATIC)
VERSION ${ZINT_VERSION}) 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) if(PNG_FOUND)
target_link_libraries(zint ${PNG_LIBRARIES} ) target_link_libraries(zint PNG::PNG)
endif(PNG_FOUND) endif()
if(NOT MSVC) if(NOT MSVC)
# Link with standard C math library. # Link with standard C math library.
target_link_libraries(zint m) target_link_libraries(zint m)
endif(NOT MSVC) endif()
if(MSVC) if(MSVC)
# "BUILD_SHARED_LIBS" is a CMake defined variable, see documentation. # "BUILD_SHARED_LIBS" is a CMake defined variable, see documentation.
if(BUILD_SHARED_LIBS) if(BUILD_SHARED_LIBS)
add_definitions("-DDLL_EXPORT") add_definitions("-DDLL_EXPORT")
endif(BUILD_SHARED_LIBS) endif()
endif(MSVC) 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) install(FILES zint.h DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)