mirror of
https://github.com/woo-j/zint.git
synced 2024-12-23 13:33:55 +03:00
Optionalize the PNG and the Qt dependencies
Expose the ability to turn these dependencies off, which results in reduced functionality. However, it enables a developer using the zint library to instruct cmake to build a libzint as deployed by e.g. build servers which don't have png/zint installed, without having to uninstall those libraries from the development system
This commit is contained in:
parent
fd656358a3
commit
9ff3f13c19
@ -23,6 +23,8 @@ option(ZINT_DEBUG "Set debug compile flag" OFF)
|
||||
option(ZINT_SANITIZE "Set sanitize compile/link flags" OFF)
|
||||
option(ZINT_TEST "Set test compile flag" OFF)
|
||||
option(ZINT_STATIC "Build static library" OFF)
|
||||
option(ZINT_USE_PNG "Build with PNG support" ON)
|
||||
option(ZINT_USE_QT "Build with QT support" ON)
|
||||
|
||||
include(SetPaths.cmake)
|
||||
|
||||
@ -90,7 +92,9 @@ ENDIF(APPLE)
|
||||
add_subdirectory(backend)
|
||||
add_subdirectory(frontend)
|
||||
|
||||
if($ENV{CMAKE_PREFIX_PATH} MATCHES "6[.][0-9][.][0-9]")
|
||||
if(NOT ZINT_USE_QT)
|
||||
message(STATUS "Qt support was disabled for this build")
|
||||
elseif($ENV{CMAKE_PREFIX_PATH} MATCHES "6[.][0-9][.][0-9]")
|
||||
set(USE_QT6 TRUE)
|
||||
message(STATUS "Using Qt6")
|
||||
cmake_policy(SET CMP0012 NEW) # Recognize constants in if()
|
||||
|
@ -5,8 +5,6 @@ project(zint)
|
||||
|
||||
configure_file(zintconfig.h.in ../../backend/zintconfig.h)
|
||||
|
||||
find_package(PNG)
|
||||
|
||||
set(zint_COMMON_SRCS common.c library.c large.c reedsol.c gs1.c eci.c general_field.c sjis.c gb2312.c gb18030.c)
|
||||
set(zint_ONEDIM_SRCS code.c code128.c 2of5.c upcean.c telepen.c medical.c plessey.c rss.c)
|
||||
set(zint_POSTAL_SRCS postal.c auspost.c imail.c mailmark.c)
|
||||
@ -37,7 +35,11 @@ endfunction()
|
||||
set_target_properties(zint PROPERTIES SOVERSION "${ZINT_VERSION_MAJOR}.${ZINT_VERSION_MINOR}"
|
||||
VERSION ${ZINT_VERSION})
|
||||
|
||||
if(PNG_FOUND)
|
||||
if(ZINT_USE_PNG)
|
||||
find_package(PNG)
|
||||
endif()
|
||||
|
||||
if(ZINT_USE_PNG AND PNG_FOUND)
|
||||
zint_target_link_libraries(PNG::PNG)
|
||||
else()
|
||||
zint_target_compile_definitions(PUBLIC NO_PNG)
|
||||
|
@ -81,7 +81,7 @@ zint_add_test(medical test_medical)
|
||||
zint_add_test(pcx test_pcx)
|
||||
zint_add_test(pdf417 test_pdf417)
|
||||
zint_add_test(plessey test_plessey)
|
||||
if(PNG_FOUND)
|
||||
if(ZINT_USE_PNG AND PNG_FOUND)
|
||||
zint_add_test(png test_png)
|
||||
endif()
|
||||
zint_add_test(postal test_postal)
|
||||
|
Loading…
Reference in New Issue
Block a user