comparison mupdf-source/thirdparty/zint/backend/CMakeLists.txt @ 2:b50eed0cc0ef upstream

ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4. The directory name has changed: no version number in the expanded directory now.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:43:07 +0200
parents
children
comparison
equal deleted inserted replaced
1:1d09e1dec1d9 2:b50eed0cc0ef
1 # Copyright (C) 2008 by BogDan Vatra < bogdan@licentia.eu >
2 # Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
3 # vim: set ts=4 sw=4 et :
4
5 cmake_minimum_required(VERSION 3.10)
6 project(zint)
7
8 if(ZINT_USE_PNG)
9 find_package(PNG)
10 endif()
11
12 set(zint_COMMON_SRCS common.c library.c large.c reedsol.c gs1.c eci.c filemem.c general_field.c)
13 set(zint_ONEDIM_SRCS bc412.c code.c code128.c 2of5.c upcean.c telepen.c medical.c plessey.c rss.c dxfilmedge.c)
14 set(zint_POSTAL_SRCS postal.c auspost.c imail.c mailmark.c)
15 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)
16 if(ZINT_USE_PNG AND PNG_FOUND)
17 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)
18 else()
19 set(zint_OUTPUT_SRCS vector.c ps.c svg.c emf.c bmp.c pcx.c gif.c tif.c raster.c output.c)
20 endif()
21 set(zint_SRCS ${zint_OUTPUT_SRCS} ${zint_COMMON_SRCS} ${zint_ONEDIM_SRCS} ${zint_POSTAL_SRCS} ${zint_TWODIM_SRCS})
22
23 if(ZINT_SHARED)
24 add_library(zint SHARED ${zint_SRCS})
25
26 if(WIN32)
27 target_sources(${PROJECT_NAME} PRIVATE libzint.rc)
28 endif()
29 endif()
30
31 if(ZINT_STATIC)
32 add_library(zint-static STATIC ${zint_SRCS})
33 if(WIN32)
34 set_target_properties(zint-static PROPERTIES OUTPUT_NAME zint-static)
35 else()
36 set_target_properties(zint-static PROPERTIES OUTPUT_NAME zint)
37 endif()
38 endif()
39
40 function(zint_target_link_libraries library)
41 if(ZINT_SHARED)
42 target_link_libraries(zint ${library})
43 endif()
44 if(ZINT_STATIC)
45 target_link_libraries(zint-static ${library})
46 endif()
47 endfunction()
48
49 function(zint_target_compile_definitions scope definition)
50 if(ZINT_SHARED)
51 target_compile_definitions(zint ${scope} ${definition})
52 endif()
53 if(ZINT_STATIC)
54 target_compile_definitions(zint-static ${scope} ${definition})
55 endif()
56 endfunction()
57
58 function(zint_target_compile_options scope option)
59 if(ZINT_SHARED)
60 target_compile_options(zint ${scope} ${option})
61 endif()
62 if(ZINT_STATIC)
63 target_compile_options(zint-static ${scope} ${option})
64 endif()
65 endfunction()
66
67 function(zint_target_include_directories)
68 if(ZINT_SHARED)
69 target_include_directories(zint ${ARGN})
70 endif()
71 if(ZINT_STATIC)
72 target_include_directories(zint-static ${ARGN})
73 endif()
74 endfunction()
75
76 if(ZINT_SHARED)
77 set_target_properties(zint PROPERTIES SOVERSION "${ZINT_VERSION_MAJOR}.${ZINT_VERSION_MINOR}"
78 VERSION ${ZINT_VERSION})
79 endif()
80
81 if(ZINT_USE_PNG AND PNG_FOUND)
82 zint_target_link_libraries(PNG::PNG)
83 message(STATUS "Using PNG")
84 else()
85 zint_target_compile_definitions(PRIVATE ZINT_NO_PNG)
86 message(STATUS "Not using PNG")
87 endif()
88
89 if(ZINT_TEST)
90 zint_target_compile_definitions(PUBLIC ZINT_TEST)
91 endif()
92
93 check_c_compiler_flag("-Wc90-c99-compat" C_COMPILER_FLAG_WC90_C99_COMPAT)
94 if(C_COMPILER_FLAG_WC90_C99_COMPAT)
95 zint_target_compile_options(PRIVATE "-Wc90-c99-compat")
96 endif()
97
98 if(NOT MSVC)
99 # Link with standard C math library.
100 zint_target_link_libraries(m)
101 endif()
102
103 if(MSVC)
104 if(ZINT_SHARED)
105 target_compile_definitions(zint PRIVATE DLL_EXPORT)
106 endif()
107 endif()
108
109 zint_target_include_directories(PUBLIC
110 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
111 $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
112 )
113
114 # Adapted from old (2008) KDE "SetPaths.cmake" to use GNUInstallDirs
115 set(INSTALL_TARGETS_DEFAULT_ARGS RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
116 LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
117 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT Devel)
118
119 if(ZINT_SHARED)
120 install(TARGETS zint EXPORT zint-targets ${INSTALL_TARGETS_DEFAULT_ARGS})
121 endif()
122 if(ZINT_STATIC)
123 install(TARGETS zint-static EXPORT zint-targets ${INSTALL_TARGETS_DEFAULT_ARGS})
124 endif()
125 install(EXPORT zint-targets NAMESPACE zint:: DESTINATION "${CMAKE_INSTALL_DATADIR}/zint")
126 install(FILES zint.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT Devel)
127
128 if(ZINT_TEST)
129 add_subdirectory(tests)
130 endif()