qt5base-lts/cmake/FindWrapSystemJpeg.cmake
Michal Klocek be2745e478 Install 3rdparty headers for static builds
For static builds we need 3rdparty headers to be installed.
Leaf modules like qtwebengine needs 3rdparty libs and header for
zlib, freetype, harfbuzz, png, jpeg. Without those the Chromium bundled
versions are used, however it might end up badly if qt has already
bundled one.

Introduce new header only modules with additional arguments for
qt_internal_add_module:

 * EXTERNAL_HEADERS to pick exactly which headers are public
 * EXTERNAL_HEADERS_DIR to include whole directory preserving the
   files directory structure

Fix qtsync so it keep directory structure for all non-qt modules when
syncing headers and do not generate warnings for headers files.

Task-number: QTBUG-87154
Task-number: QTBUG-88614
Change-Id: If1c27bf8608791cd4e0a21839d6316a445a96e9f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-02-19 01:52:32 +01:00

33 lines
1006 B
CMake

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)