Skip to content

Commit

Permalink
Add a cmake config file export
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Friedman <[email protected]>
  • Loading branch information
Ryanf55 committed Jul 18, 2023
1 parent c827648 commit 793e872
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
10 changes: 10 additions & 0 deletions cmake/exiv2Config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@PACKAGE_INIT@

cmake_minimum_required(VERSION 3.16.3)
include(CMakeFindDependencyMacro)

find_dependency(ZLIB REQUIRED)

include("${CMAKE_CURRENT_LIST_DIR}/exiv2Export.cmake")

check_required_components(exiv2)
22 changes: 16 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,13 @@ set(requires_private_for_pc_file "${requires_private_string}" PARENT_SCOPE)

write_basic_package_version_file(exiv2ConfigVersion.cmake COMPATIBILITY ExactVersion)

install(TARGETS exiv2lib EXPORT exiv2Config
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
install(TARGETS exiv2lib EXPORT exiv2Export)

include(CMakePackageConfigHelpers)
configure_package_config_file(
../cmake/exiv2Config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/exiv2Config.cmake
INSTALL_DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/exiv2"
)

install(FILES
Expand All @@ -295,7 +298,14 @@ install(FILES
${CMAKE_BINARY_DIR}/exiv2lib_export.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/exiv2)

install(EXPORT exiv2Config DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/exiv2")
install(EXPORT exiv2Export
DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/exiv2"
NAMESPACE exiv2::
)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/exiv2ConfigVersion.cmake DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/exiv2")
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/exiv2ConfigVersion.cmake
${CMAKE_CURRENT_BINARY_DIR}/exiv2Config.cmake
DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/exiv2")

0 comments on commit 793e872

Please sign in to comment.