mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Add and use helper to set all flags to both the shared and the static library
This commit is contained in:
parent
3e89058051
commit
acd12e1754
@ -20,28 +20,42 @@ if(ZINT_STATIC)
|
|||||||
add_library(zint-static STATIC ${zint_SRCS})
|
add_library(zint-static STATIC ${zint_SRCS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
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()
|
||||||
|
|
||||||
set_target_properties(zint PROPERTIES SOVERSION "${ZINT_VERSION_MAJOR}.${ZINT_VERSION_MINOR}"
|
set_target_properties(zint PROPERTIES SOVERSION "${ZINT_VERSION_MAJOR}.${ZINT_VERSION_MINOR}"
|
||||||
VERSION ${ZINT_VERSION})
|
VERSION ${ZINT_VERSION})
|
||||||
|
|
||||||
if(PNG_FOUND)
|
if(PNG_FOUND)
|
||||||
target_link_libraries(zint PNG::PNG)
|
zint_target_link_libraries(PNG::PNG)
|
||||||
else()
|
else()
|
||||||
target_compile_definitions(zint PUBLIC NO_PNG)
|
zint_target_compile_definitions(PUBLIC NO_PNG)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ZINT_TEST)
|
if(ZINT_TEST)
|
||||||
target_compile_definitions(zint PUBLIC ZINT_TEST)
|
zint_target_compile_definitions(PUBLIC ZINT_TEST)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
# Link with standard C math library.
|
# Link with standard C math library.
|
||||||
target_link_libraries(zint m)
|
zint_target_link_libraries(m)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
# "BUILD_SHARED_LIBS" is a CMake defined variable, see documentation.
|
# "BUILD_SHARED_LIBS" is a CMake defined variable, see documentation.
|
||||||
if(BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
target_compile_definitions(zint PRIVATE DLL_EXPORT)
|
zint_target_compile_definitions(zint PRIVATE DLL_EXPORT)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user