Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 395f1ce2 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Warn when using the wrong version of libjpeg

parent 5997def7
......@@ -10,8 +10,15 @@ endif()
if(${CMAKE_VERSION} VERSION_GREATER 2.8.12)
cmake_policy(SET CMP0022 OLD)
cmake_policy(SET CMP0046 OLD)
endif()
if(${CMAKE_VERSION} VERSION_GREATER 3.0.0)
cmake_policy(SET CMP0026 OLD)
endif()
######################
#######################
## Constants defines ##
......@@ -113,6 +120,7 @@ option(CREATIVEONLY "compile only Karbon and Krita" OFF)
# get the special macros
include(CalligraProductSetMacros)
include(MacroJPEG)
# get the definitions of products, features and product sets
include(CalligraProducts.cmake)
......
# A macro wrapper to find JPEG library version
#
# Syntax: DETECT_JPEG()
# JPEG_LIB_VERSION is set to version ID depending of libjpeg version detected.
#
# Copyright (c) 2010-2014, Gilles Caulier, <caulier dot gilles at gmail dot com>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
# check version of libjpeg so that we can use the appropriate dir
# See bug #227313 for details
function(CompileToCheckVersion LibId Ret)
set(_jpeglib_version_source "
#include <stddef.h>
#include <stdio.h>
#include <jpeglib.h>
int main()
{
#if (JPEG_LIB_VERSION >= ${LibId})
#error JPEG_LIB_VERSION >= ${LibId}
#endif
}
")
set(_jpeglib_version_source_file ${CMAKE_BINARY_DIR}/CMakeTmp/cmake_jpeglib_version_check.cpp)
file(WRITE "${_jpeglib_version_source_file}" "${_jpeglib_version_source}")
set(_jpeglib_version_include_dirs "-DINCLUDE_DIRECTORIES:STRING=${JPEG_INCLUDE_DIR}")
try_compile(_jpeglib_version_compile_result ${CMAKE_BINARY_DIR} ${_jpeglib_version_source_file}
CMAKE_FLAGS "${_jpeglib_version_include_dirs}"
COMPILE_OUTPUT_VARIABLE _jpeglib_version_compile_output_var)
set(${Ret} ${_jpeglib_version_compile_result} PARENT_SCOPE)
endfunction()
macro(DETECT_JPEG)
find_package(JPEG REQUIRED)
if(JPEG_FOUND)
CompileToCheckVersion(90 _CompileResult)
if(_CompileResult)
# Compile sucessfuly. It's not libjpeg 90. We check previous version.
CompileToCheckVersion(80 _CompileResult)
if(_CompileResult)
# Compile sucessfuly. It's not libjpeg 90. We check previous version.
CompileToCheckVersion(70 _CompileResult)
if(_CompileResult)
# Compile sucessfuly. It's not libjpeg 70.
set(JPEG_LIB_VERSION 62)
else()
set(JPEG_LIB_VERSION 70)
endif()
else()
set(JPEG_LIB_VERSION 84)
endif()
else()
set(JPEG_LIB_VERSION 91)
endif()
message(STATUS "Libjpeg version: ${JPEG_LIB_VERSION}")
endif()
endmacro()
......@@ -14,6 +14,13 @@ macro_optional_find_package(TIFF)
macro_log_feature(TIFF_FOUND "tiff" "TIFF Library and Utilities" "http://www.remotesensing.org/libtiff" FALSE "" "Required by the Krita TIFF filter")
macro_optional_find_package(JPEG)
if (JPEG_FOUND)
DETECT_JPEG()
if (JPEG_LIB_VERSION GREATER 70)
set(JPEG_FOUND FALSE)
message("Detected libpeg 8 or 9: this is NOT supported.")
endif()
endif()
macro_log_feature(JPEG_FOUND "jpeg" "Free library for JPEG image compression. Note: libjpeg8 is NOT supported." "http://www.libjpeg-turbo.org" FALSE "" "Required by the Krita JPEG filter")
macro_optional_find_package(Kdcraw)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment