qt5base-lts/cmake/FindWrapSystemJpeg.cmake
Lucie Gérard 32df595275 Change the license of all CMakeLists.txt and *.cmake files to BSD
Task-number: QTBUG-105718
Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-23 23:58:42 +02:00

36 lines
1.1 KiB
CMake

# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
if(TARGET WrapSystemJpeg::WrapSystemJpeg)
set(WrapSystemJpeg_FOUND TRUE)
return()
endif()
set(WrapSystemJpeg_REQUIRED_VARS __jpeg_found)
find_package(JPEG ${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION} QUIET)
set(__jpeg_target_name "JPEG::JPEG")
if(JPEG_FOUND AND TARGET "${__jpeg_target_name}")
set(__jpeg_found TRUE)
endif()
if(JPEG_LIBRARIES)
list(PREPEND WrapSystemJpeg_REQUIRED_VARS JPEG_LIBRARIES)
endif()
if(JPEG_VERSION)
set(WrapSystemJpeg_VERSION "${JPEG_VERSION}")
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(WrapSystemJpeg
REQUIRED_VARS ${WrapSystemJpeg_REQUIRED_VARS}
VERSION_VAR WrapSystemJpeg_VERSION)
if(WrapSystemJpeg_FOUND)
add_library(WrapSystemJpeg::WrapSystemJpeg INTERFACE IMPORTED)
target_link_libraries(WrapSystemJpeg::WrapSystemJpeg
INTERFACE "${__jpeg_target_name}")
endif()
unset(__jpeg_target_name)
unset(__jpeg_found)