1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235
|
#[=======================================================================[.rst:
FindJPEG
---------
Find the JPEG library
Imported Targets
^^^^^^^^^^^^^^^^
This module provides the following imported targets, if found:
``JPEG::JPEG``
The JPEG library. This will be either shared or static, with shared prefered.
``JPEG::JPEG-static``
The JPEG static library
Result Variables
^^^^^^^^^^^^^^^^
This will define the following variables:
``JPEG_FOUND``
True if the required components have been found.
``JPEG_static_FOUND``
True if the system has the C++ JPEG static library.
``JPEG_IS_STATIC``
True if ``JPEG::JPEG`` and ``JPEG::JPEG-static`` are the same.
Cache Variables
^^^^^^^^^^^^^^^
The following cache variables may also be set:
``JPEG_INCLUDE_DIR``
The directory containing ``libjpeg.hpp``.
``JPEG_shared_LIBRARY_RELEASE``
The path to the release JPEG library.
``JPEG_shared_LIBRARY_DEBUG``
The path to the debug JPEG library.
``JPEG_shared_LIBRARY``
The path to the release JPEG library, or the debug library
if the release library is not found
``JPEG_static_LIBRARY_RELEASE``
The path to the release JPEG library.
``JPEG_static_LIBRARY_DEBUG``
The path to the debug JPEG library.
``JPEG_static_LIBRARY``
The path to the release JPEG library, or the debug library
if the release library is not found
``JPEG_RUNTIME_RELEASE``
The path to the release JPEG dll, windows only.
``JPEG_RUNTIME_DEBUG``
The path to the debug JPEG dll, windows only.
#]=======================================================================]
find_path(JPEG_INCLUDE_DIR NAMES "jpeglib.h")
if(WIN32)
set(_jpeg_lib_release_names "jpeg.lib")
set(_jpeg_lib_debug_names "jpegd.lib")
set(_jpeg_lib_static_release_names "jpeg-static.lib")
set(_jpeg_lib_static_debug_names "jpeg-staticd.lib")
set(_jpeg_runtime_release_names "jpeg62.dll")
set(_jpeg_runtime_debug_names "jpeg62d.dll")
else()
set(_jpeg_lib_release_names "jpeg")
set(_jpeg_lib_debug_names "jpegd")
set(_jpeg_lib_static_release_names "libjpeg.a")
set(_jpeg_lib_static_debug_names "libjpegd.a")
endif(WIN32)
find_library(JPEG_LIBRARY_RELEASE
NAMES ${_jpeg_lib_release_names}
PATH_SUFFIXES Release
)
find_library(JPEG_LIBRARY_RELEASE
NAMES ${_jpeg_lib_static_release_names}
PATH_SUFFIXES Release
)
find_library(JPEG_LIBRARY_DEBUG
NAMES ${_jpeg_lib_debug_names}
PATH_SUFFIXES Debug
)
find_library(JPEG_LIBRARY_DEBUG
NAMES ${_jpeg_lib_static_debug_names}
PATH_SUFFIXES Debug
)
find_library(JPEG_static_LIBRARY_RELEASE
NAMES ${_jpeg_lib_static_release_names}
PATH_SUFFIXES Release
)
find_library(JPEG_static_LIBRARY_DEBUG
NAMES ${_jpeg_lib_static_debug_names}
PATH_SUFFIXES Debug
)
unset(_jpeg_lib_release_names)
unset(_jpeg_lib_debug_names)
unset(_jpeg_lib_static_release_names)
unset(_jpeg_lib_static_debug_names)
if(WIN32)
find_file(JPEG_RUNTIME_DEBUG
NAMES ${_jpeg_runtime_debug_names}
PATH_SUFFIXES "bin/Debug" "bin"
)
find_file(JPEG_RUNTIME_RELEASE
NAMES ${_jpeg_runtime_release_names}
PATH_SUFFIXES "bin/Release" "bin"
)
endif()
include(SelectLibraryConfigurations)
select_library_configurations(JPEG)
select_library_configurations(JPEG_static)
if (JPEG_static_LIBRARY)
set(JPEG_static_FOUND TRUE)
endif()
if (JPEG_LIBRARY STREQUAL JPEG_static_LIBRARY)
set(JPEG_IS_STATIC TRUE)
else()
set(JPEG_IS_STATIC FALSE)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(JPEG
REQUIRED_VARS
JPEG_LIBRARY
JPEG_INCLUDE_DIR
)
if (JPEG_FOUND)
mark_as_advanced(JPEG_INCLUDE_DIR)
mark_as_advanced(JPEG_LIBRARY)
mark_as_advanced(JPEG_LIBRARY_RELEASE)
mark_as_advanced(JPEG_LIBRARY_DEBUG)
endif()
if (JPEG_static_FOUND)
mark_as_advanced(JPEG_static_LIBRARY)
mark_as_advanced(JPEG_static_LIBRARY_RELEASE)
mark_as_advanced(JPEG_static_LIBRARY_DEBUG)
endif()
if (JPEG_static_FOUND)
if (NOT TARGET JPEG::JPEG-static)
add_library(JPEG::JPEG-static STATIC IMPORTED)
endif()
if (JPEG_static_LIBRARY_RELEASE)
set_property(TARGET JPEG::JPEG-static APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(JPEG::JPEG-static PROPERTIES
IMPORTED_LOCATION_RELEASE "${JPEG_static_LIBRARY_RELEASE}")
endif()
if (JPEG_static_LIBRARY_DEBUG)
set_property(TARGET JPEG::JPEG-static APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(JPEG::JPEG-static PROPERTIES
IMPORTED_LOCATION_DEBUG "${JPEG_static_LIBRARY_DEBUG}")
endif()
set_target_properties(JPEG::JPEG-static PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${JPEG_INCLUDE_DIR}"
)
endif()
if (JPEG_FOUND AND JPEG_IS_STATIC)
if (NOT TARGET JPEG::JPEG)
add_library(JPEG::JPEG ALIAS JPEG::JPEG-static)
endif()
elseif(JPEG_FOUND)
# If we are going to create the a SHARED IMPORTED target for the
# release configuration, but we don't have the debug DLL then we should
# not add a debug configuration. We ensure that here by "unfinding"
# any debug library we found.
if (JPEG_RUNTIME_RELEASE AND JPEG_LIBRARY_RELEASE AND NOT JPEG_RUNTIME_DEBUG)
set(JPEG_LIBRARY_DEBUG JPEG_LIBRARY_DEBUG-NOTFOUND)
endif()
# Similarly, if we are going to create a SHARED UNKNOWN target for the
# release configuration, and we _have_ a debug DLL, we "unfind" the
# debug DLL so that we don't use it.
if (JPEG_LIBRARY_DEBUG AND JPEG_LIBRARY_RELEASE AND NOT JPEG_RUNTIME_RELEASE)
set(JPEG_RUNTIME_DEBUG JPEG_RUNTIME_DEBUG-NOTFOUND)
endif()
if (JPEG_LIBRARY_RELEASE AND JPEG_RUNTIME_RELEASE)
if (NOT TARGET JPEG::JPEG)
add_library(JPEG::JPEG SHARED IMPORTED)
endif()
set_property(TARGET JPEG::JPEG APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(JPEG::JPEG PROPERTIES
IMPORTED_LOCATION_RELEASE "${JPEG_RUNTIME_RELEASE}")
set_target_properties(JPEG::JPEG PROPERTIES
IMPORTED_IMPLIB_RELEASE "${JPEG_LIBRARY_RELEASE}")
elseif(JPEG_LIBRARY_RELEASE)
if (NOT TARGET JPEG::JPEG)
add_library(JPEG::JPEG UNKNOWN IMPORTED)
endif()
set_property(TARGET JPEG::JPEG APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(JPEG::JPEG PROPERTIES
IMPORTED_LOCATION_RELEASE "${JPEG_LIBRARY_RELEASE}")
endif()
if (JPEG_LIBRARY_DEBUG AND JPEG_RUNTIME_DEBUG)
if (NOT TARGET JPEG::JPEG)
add_library(JPEG::JPEG SHARED IMPORTED)
endif()
set_property(TARGET JPEG::JPEG APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(JPEG::JPEG PROPERTIES
IMPORTED_LOCATION_DEBUG "${JPEG_RUNTIME_DEBUG}")
set_target_properties(JPEG::JPEG PROPERTIES
IMPORTED_IMPLIB_DEBUG "${JPEG_LIBRARY_DEBUG}")
elseif(JPEG_LIBRARY_DEBUG)
if (NOT TARGET JPEG::JPEG)
add_library(JPEG::JPEG UNKNOWN IMPORTED)
endif()
set_property(TARGET JPEG::JPEG APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(JPEG::JPEG PROPERTIES
IMPORTED_LOCATION_DEBUG "${JPEG_LIBRARY_DEBUG}")
endif()
set_target_properties(JPEG::JPEG PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${JPEG_INCLUDE_DIR}"
)
endif()
|