diff --git a/cmake/exiv2Config.cmake.in b/cmake/exiv2Config.cmake.in new file mode 100644 index 0000000000..b3e2b601c9 --- /dev/null +++ b/cmake/exiv2Config.cmake.in @@ -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) \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1abc7eac20..d0227f0c6a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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 @@ -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")