mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Install CMake export
This commit is contained in:
parent
66431d8ec1
commit
536a581d9e
@ -192,6 +192,8 @@ else()
|
||||
endif()
|
||||
|
||||
install(FILES cmake/modules/FindZint.cmake DESTINATION ${CMAKE_MODULES_INSTALL_PATH} COMPONENT Devel)
|
||||
configure_file("zint-config.cmake.in" "zint-config.cmake" @ONLY)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zint-config.cmake" DESTINATION "${SHARE_INSTALL_PREFIX}/zint")
|
||||
|
||||
# This needs to be run very last so other parts of the scripts can take
|
||||
# advantage of this.
|
||||
|
@ -48,6 +48,15 @@ function(zint_target_compile_definitions scope definition)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(zint_target_include_directories scope directory)
|
||||
if(ZINT_SHARED)
|
||||
target_include_directories(zint ${scope} ${directory})
|
||||
endif()
|
||||
if(ZINT_STATIC)
|
||||
target_include_directories(zint-static ${scope} ${directory})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
if(ZINT_SHARED)
|
||||
set_target_properties(zint PROPERTIES SOVERSION "${ZINT_VERSION_MAJOR}.${ZINT_VERSION_MINOR}"
|
||||
VERSION ${ZINT_VERSION})
|
||||
@ -76,12 +85,18 @@ if(MSVC)
|
||||
target_compile_definitions(zint PRIVATE DLL_EXPORT)
|
||||
endif()
|
||||
|
||||
zint_target_include_directories(PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>
|
||||
)
|
||||
|
||||
if(ZINT_SHARED)
|
||||
install(TARGETS zint ${INSTALL_TARGETS_DEFAULT_ARGS})
|
||||
install(TARGETS zint EXPORT zint-targets ${INSTALL_TARGETS_DEFAULT_ARGS})
|
||||
endif()
|
||||
if(ZINT_STATIC)
|
||||
install(TARGETS zint-static ${INSTALL_TARGETS_DEFAULT_ARGS})
|
||||
install(TARGETS zint-static EXPORT zint-targets ${INSTALL_TARGETS_DEFAULT_ARGS})
|
||||
endif()
|
||||
install(EXPORT zint-targets NAMESPACE zint:: DESTINATION "${SHARE_INSTALL_PREFIX}/zint")
|
||||
install(FILES zint.h DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)
|
||||
|
||||
if(ZINT_TEST)
|
||||
|
5
zint-config.cmake.in
Normal file
5
zint-config.cmake.in
Normal file
@ -0,0 +1,5 @@
|
||||
if(@ZINT_USE_PNG@)
|
||||
include(CMakeFindDependencyMacro)
|
||||
find_dependency(PNG)
|
||||
endif()
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/zint-targets.cmake")
|
Loading…
Reference in New Issue
Block a user