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:
Schaich
2021-03-29 23:35:57 +09:00
parent fd656358a3
commit 9ff3f13c19
3 changed files with 11 additions and 5 deletions

View File

@ -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()