mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
build: Add a CMake config file compatible with the FindPNG module
Co-authored-by: Cosmin Truta <ctruta@gmail.com> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
This commit is contained in:
committed by
Cosmin Truta
parent
53a7f4e320
commit
0e204b7364
@@ -1129,6 +1129,30 @@ if(NOT SKIP_INSTALL_EXPORT AND NOT SKIP_INSTALL_ALL)
|
||||
FILE libpng${PNGLIB_ABI_VERSION}.cmake)
|
||||
endif()
|
||||
|
||||
# Create a CMake Config File that can be used via find_package(PNG CONFIG)
|
||||
if(NOT SKIP_INSTALL_CONFIG_FILE AND NOT SKIP_INSTALL_ALL)
|
||||
install(TARGETS ${PNG_LIBRARY_TARGETS}
|
||||
EXPORT PNGTargets
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file(PNGConfigVersion.cmake
|
||||
VERSION ${PNGLIB_VERSION}
|
||||
COMPATIBILITY SameMinorVersion)
|
||||
|
||||
install(EXPORT PNGTargets
|
||||
FILE PNGTargets.cmake
|
||||
NAMESPACE PNG::
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/PNG)
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/cmake/PNGConfig.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/PNGConfigVersion.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/PNG)
|
||||
endif()
|
||||
|
||||
# TODO: Create MSVC import lib for MinGW-compiled shared lib.
|
||||
# pexports libpng.dll > libpng.def
|
||||
# lib /def:libpng.def /machine:x86
|
||||
|
||||
Reference in New Issue
Block a user