Warning, /graphics/krita/cmake/modules/FindLibExiv2.cmake is written in an unsupported language. File is not indexed.
0001 #.rst: 0002 # FindLibExiv2 0003 # ------------ 0004 # 0005 # Try to find the Exiv2 library. 0006 # 0007 # This will define the following variables: 0008 # 0009 # ``LibExiv2_FOUND`` 0010 # System has LibExiv2. 0011 # 0012 # ``LibExiv2_VERSION`` 0013 # The version of LibExiv2. 0014 # 0015 # ``LibExiv2_INCLUDE_DIRS`` 0016 # This should be passed to target_include_directories() if 0017 # the target is not used for linking. 0018 # 0019 # ``LibExiv2_LIBRARIES`` 0020 # The LibExiv2 library. 0021 # This can be passed to target_link_libraries() instead of 0022 # the ``LibExiv2::LibExiv2`` target 0023 # 0024 # If ``LibExiv2_FOUND`` is TRUE, the following imported target 0025 # will be available: 0026 # 0027 # ``LibExiv2::LibExiv2`` 0028 # The Exiv2 library 0029 # 0030 # Since 5.53.0. 0031 # 0032 #============================================================================= 0033 # SPDX-FileCopyrightText: 2018 Christophe Giboudeaux <christophe@krop.fr> 0034 # SPDX-FileCopyrightText: 2010 Alexander Neundorf <neundorf@kde.org> 0035 # SPDX-FileCopyrightText: 2008 Gilles Caulier <caulier.gilles@gmail.com> 0036 # 0037 # 0038 # Redistribution and use in source and binary forms, with or without 0039 # modification, are permitted provided that the following conditions 0040 # are met: 0041 # 0042 # SPDX-License-Identifier: BSD-3-Clause 0043 #============================================================================= 0044 0045 find_package(PkgConfig QUIET) 0046 pkg_check_modules(PC_EXIV2 QUIET exiv2) 0047 0048 find_path(LibExiv2_INCLUDE_DIRS NAMES exiv2/exif.hpp 0049 HINTS ${PC_EXIV2_INCLUDEDIR} 0050 ) 0051 0052 find_library(LibExiv2_LIBRARIES NAMES exiv2 libexiv2 0053 HINTS ${PC_EXIV2_LIBRARY_DIRS} 0054 ) 0055 0056 set(LibExiv2_VERSION ${PC_EXIV2_VERSION}) 0057 0058 if(NOT LibExiv2_VERSION AND DEFINED LibExiv2_INCLUDE_DIRS) 0059 # With exiv >= 0.27, the version #defines are in exv_conf.h instead of version.hpp 0060 foreach(_exiv2_version_file "version.hpp" "exv_conf.h") 0061 if(EXISTS "${LibExiv2_INCLUDE_DIRS}/exiv2/${_exiv2_version_file}") 0062 file(READ "${LibExiv2_INCLUDE_DIRS}/exiv2/${_exiv2_version_file}" _exiv_version_file_content) 0063 string(REGEX MATCH "#define EXIV2_MAJOR_VERSION[ ]+\\([0-9]+\\)" EXIV2_MAJOR_VERSION_MATCH ${_exiv_version_file_content}) 0064 string(REGEX MATCH "#define EXIV2_MINOR_VERSION[ ]+\\([0-9]+\\)" EXIV2_MINOR_VERSION_MATCH ${_exiv_version_file_content}) 0065 string(REGEX MATCH "#define EXIV2_PATCH_VERSION[ ]+\\([0-9]+\\)" EXIV2_PATCH_VERSION_MATCH ${_exiv_version_file_content}) 0066 if(EXIV2_MAJOR_VERSION_MATCH) 0067 string(REGEX REPLACE ".*_MAJOR_VERSION[ ]+\\((.*)\\)" "\\1" EXIV2_MAJOR_VERSION ${EXIV2_MAJOR_VERSION_MATCH}) 0068 string(REGEX REPLACE ".*_MINOR_VERSION[ ]+\\((.*)\\)" "\\1" EXIV2_MINOR_VERSION ${EXIV2_MINOR_VERSION_MATCH}) 0069 string(REGEX REPLACE ".*_PATCH_VERSION[ ]+\\((.*)\\)" "\\1" EXIV2_PATCH_VERSION ${EXIV2_PATCH_VERSION_MATCH}) 0070 endif() 0071 endif() 0072 endforeach() 0073 0074 set(LibExiv2_VERSION "${EXIV2_MAJOR_VERSION}.${EXIV2_MINOR_VERSION}.${EXIV2_PATCH_VERSION}") 0075 endif() 0076 0077 include(FindPackageHandleStandardArgs) 0078 find_package_handle_standard_args(LibExiv2 0079 FOUND_VAR LibExiv2_FOUND 0080 REQUIRED_VARS LibExiv2_LIBRARIES LibExiv2_INCLUDE_DIRS 0081 VERSION_VAR LibExiv2_VERSION 0082 ) 0083 0084 mark_as_advanced(LibExiv2_INCLUDE_DIRS LibExiv2_LIBRARIES) 0085 0086 if(LibExiv2_FOUND AND NOT TARGET LibExiv2::LibExiv2) 0087 add_library(LibExiv2::LibExiv2 UNKNOWN IMPORTED) 0088 set_target_properties(LibExiv2::LibExiv2 PROPERTIES 0089 IMPORTED_LOCATION "${LibExiv2_LIBRARIES}" 0090 INTERFACE_INCLUDE_DIRECTORIES "${LibExiv2_INCLUDE_DIRS}" 0091 ) 0092 # Workaround for using exiv2 with -std=c++!7 0093 # FIXME: Remove this when exiv2 has been updated to remove usage of 0094 # `auto_ptr`. 0095 if(MSVC) 0096 target_compile_definitions(LibExiv2::LibExiv2 0097 INTERFACE _HAS_AUTO_PTR_ETC=1 0098 ) 0099 elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR 0100 CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") # libc++ 0101 target_compile_definitions(LibExiv2::LibExiv2 0102 INTERFACE _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR 0103 ) 0104 endif() 0105 endif() 0106 0107 include(FeatureSummary) 0108 set_package_properties(LibExiv2 PROPERTIES 0109 URL "http://www.exiv2.org" 0110 DESCRIPTION "Image metadata support" 0111 )