mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Bind macro definitions to the zint library target
The libpng dependency is exported to consumers, while the ZINT_TEST option affects the build output. Both are therefore marked public
This commit is contained in:
parent
3b7bdcaf90
commit
83bac8c8a5
@ -63,10 +63,6 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ZINT_TEST)
|
||||
add_definitions("-DZINT_TEST")
|
||||
endif()
|
||||
|
||||
IF(APPLE)
|
||||
IF (UNIVERSAL) # TODO: make universal binary
|
||||
IF(NOT ZINT_HAS_BEEN_RUN_BEFORE)
|
||||
|
@ -14,10 +14,6 @@ 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_SRCS ${zint_OUTPUT_SRCS} ${zint_COMMON_SRCS} ${zint_ONEDIM_SRCS} ${zint_POSTAL_SRCS} ${zint_TWODIM_SRCS})
|
||||
|
||||
if(NOT PNG_FOUND)
|
||||
add_definitions(-DNO_PNG)
|
||||
endif()
|
||||
|
||||
add_library(zint SHARED ${zint_SRCS})
|
||||
|
||||
if(ZINT_STATIC)
|
||||
@ -29,6 +25,12 @@ set_target_properties(zint PROPERTIES SOVERSION "${ZINT_VERSION_MAJOR}.${ZINT_
|
||||
|
||||
if(PNG_FOUND)
|
||||
target_link_libraries(zint PNG::PNG)
|
||||
else()
|
||||
target_compile_definitions(zint PUBLIC NO_PNG)
|
||||
endif()
|
||||
|
||||
if(ZINT_TEST)
|
||||
target_compile_definitions(zint PUBLIC ZINT_TEST)
|
||||
endif()
|
||||
|
||||
if(NOT MSVC)
|
||||
@ -39,7 +41,7 @@ endif()
|
||||
if(MSVC)
|
||||
# "BUILD_SHARED_LIBS" is a CMake defined variable, see documentation.
|
||||
if(BUILD_SHARED_LIBS)
|
||||
add_definitions("-DDLL_EXPORT")
|
||||
target_compile_definitions(zint PRIVATE DLL_EXPORT)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user