2008-09-19 02:44:52 +12:00
|
|
|
# (c) 2008 by BogDan Vatra < bogdan@licentia.eu >
|
2020-12-01 04:51:14 +13:00
|
|
|
# vim: set ts=4 sw=4 et :
|
2008-09-19 02:44:52 +12:00
|
|
|
|
|
|
|
project(zint)
|
|
|
|
|
2020-11-24 20:03:03 +13:00
|
|
|
configure_file(zintconfig.h.in ../../backend/zintconfig.h)
|
2020-11-23 00:29:45 +13:00
|
|
|
|
2019-12-09 05:15:34 +13:00
|
|
|
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)
|
2008-09-19 02:44:52 +12:00
|
|
|
set(zint_ONEDIM_SRCS code.c code128.c 2of5.c upcean.c telepen.c medical.c plessey.c rss.c)
|
2018-02-07 09:57:01 +13:00
|
|
|
set(zint_POSTAL_SRCS postal.c auspost.c imail.c mailmark.c)
|
2019-03-21 22:14:24 +13:00
|
|
|
set(zint_TWODIM_SRCS code16k.c codablock.c dmatrix.c pdf417.c qr.c maxicode.c composite.c aztec.c code49.c code1.c gridmtx.c hanxin.c dotcode.c ultra.c)
|
2020-05-22 05:22:28 +12:00
|
|
|
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)
|
2016-07-20 10:02:39 +12:00
|
|
|
set(zint_SRCS ${zint_OUTPUT_SRCS} ${zint_COMMON_SRCS} ${zint_ONEDIM_SRCS} ${zint_POSTAL_SRCS} ${zint_TWODIM_SRCS})
|
2008-09-19 02:44:52 +12:00
|
|
|
|
|
|
|
add_library(zint SHARED ${zint_SRCS})
|
2020-12-01 04:51:14 +13:00
|
|
|
|
2020-03-30 22:54:21 +13:00
|
|
|
if(ZINT_STATIC)
|
2020-12-01 04:51:14 +13:00
|
|
|
add_library(zint-static STATIC ${zint_SRCS})
|
|
|
|
endif()
|
2008-09-19 02:44:52 +12:00
|
|
|
|
2021-03-23 00:20:44 +13:00
|
|
|
function(zint_target_link_libraries library)
|
|
|
|
target_link_libraries(zint ${library})
|
|
|
|
if(ZINT_STATIC)
|
|
|
|
target_link_libraries(zint-static ${library})
|
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
function(zint_target_compile_definitions scope definition)
|
|
|
|
target_compile_definitions(zint ${scope} ${definition})
|
|
|
|
if(ZINT_STATIC)
|
|
|
|
target_compile_definitions(zint-static ${scope} ${definition})
|
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
2020-12-01 04:51:14 +13:00
|
|
|
set_target_properties(zint PROPERTIES SOVERSION "${ZINT_VERSION_MAJOR}.${ZINT_VERSION_MINOR}"
|
|
|
|
VERSION ${ZINT_VERSION})
|
2008-09-19 02:44:52 +12:00
|
|
|
|
2021-03-30 03:35:57 +13:00
|
|
|
if(ZINT_USE_PNG)
|
|
|
|
find_package(PNG)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ZINT_USE_PNG AND PNG_FOUND)
|
2021-03-23 00:20:44 +13:00
|
|
|
zint_target_link_libraries(PNG::PNG)
|
2021-03-22 23:33:05 +13:00
|
|
|
else()
|
2021-03-23 00:20:44 +13:00
|
|
|
zint_target_compile_definitions(PUBLIC NO_PNG)
|
2021-03-22 23:33:05 +13:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ZINT_TEST)
|
2021-03-23 00:20:44 +13:00
|
|
|
zint_target_compile_definitions(PUBLIC ZINT_TEST)
|
2020-12-01 04:51:14 +13:00
|
|
|
endif()
|
|
|
|
|
2018-12-12 21:37:56 +13:00
|
|
|
if(NOT MSVC)
|
2020-12-01 04:51:14 +13:00
|
|
|
# Link with standard C math library.
|
2021-03-23 00:20:44 +13:00
|
|
|
zint_target_link_libraries(m)
|
2020-12-01 04:51:14 +13:00
|
|
|
endif()
|
2018-12-12 21:37:56 +13:00
|
|
|
|
|
|
|
if(MSVC)
|
2020-12-01 04:51:14 +13:00
|
|
|
# "BUILD_SHARED_LIBS" is a CMake defined variable, see documentation.
|
|
|
|
if(BUILD_SHARED_LIBS)
|
2021-03-23 00:20:44 +13:00
|
|
|
zint_target_compile_definitions(zint PRIVATE DLL_EXPORT)
|
2020-12-01 04:51:14 +13:00
|
|
|
endif()
|
|
|
|
endif()
|
2008-09-19 02:44:52 +12:00
|
|
|
|
2020-12-01 04:51:14 +13:00
|
|
|
install(TARGETS zint ${INSTALL_TARGETS_DEFAULT_ARGS})
|
2008-09-24 21:00:44 +12:00
|
|
|
install(FILES zint.h DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)
|
2021-03-22 23:44:05 +13:00
|
|
|
|
|
|
|
if(ZINT_TEST)
|
|
|
|
add_subdirectory(tests)
|
|
|
|
endif(ZINT_TEST)
|