blob: bce790a478639ee35093957de7c0cff54ff8eb52 [file] [log] [blame]
Samuel Martinde90e022016-11-06 17:35:59 +01001From 38f50c7d9ad3ba06b64583045665203afb53cbd9 Mon Sep 17 00:00:00 2001
2From: Samuel Martin <s.martin49@gmail.com>
3Date: Sun, 6 Nov 2016 16:29:08 +0100
4Subject: [PATCH] thirdparty: tiff: append flags found by pkg-config if
5 available
6
7This change allows to get all required CFLAGS/LDFLAGS in case of static only
8build.
9
10This build issue [1] was triggered by the Buildroot farms.
11
12[1] http://autobuild.buildroot.net/results/d0d/d0d22727311d6300e0e400728126170407bfd699/build-end.log
13
14Signed-off-by: Samuel Martin <s.martin49@gmail.com>
15---
16 thirdparty/CMakeLists.txt | 23 +++++++++++++++++++++--
17 1 file changed, 21 insertions(+), 2 deletions(-)
18
19diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt
Baruch Siach27752762016-11-14 23:58:30 +020020index cb24b43b58e2..cd6a5e1391b0 100644
Samuel Martinde90e022016-11-06 17:35:59 +010021--- a/thirdparty/CMakeLists.txt
22+++ b/thirdparty/CMakeLists.txt
23@@ -1,5 +1,9 @@
24 # 3rd party libs
25
Baruch Siach27752762016-11-14 23:58:30 +020026+if(NOT BUILD_THIRDPARTY)
Samuel Martinde90e022016-11-06 17:35:59 +010027+ include(FindPkgConfig)
Baruch Siach27752762016-11-14 23:58:30 +020028+endif(NOT BUILD_THIRDPARTY)
Samuel Martinde90e022016-11-06 17:35:59 +010029+
30 #------------
31 # Try to find lib Z
Baruch Siach27752762016-11-14 23:58:30 +020032 if(BUILD_THIRDPARTY)
33@@ -36,6 +40,9 @@ if(BUILD_THIRDPARTY)
34 else(BUILD_THIRDPARTY)
35 if(ZLIB_FOUND)
36 find_package(PNG)
Samuel Martinde90e022016-11-06 17:35:59 +010037+ # Static only build:
38+ # it is not necessary to invoke pkg_check_module on libpng, because libpng
39+ # only depends on zlib, which is already checked.
Baruch Siach27752762016-11-14 23:58:30 +020040 if(PNG_FOUND)
Samuel Martinde90e022016-11-06 17:35:59 +010041 message(STATUS "Your system seems to have a PNG lib available, we will use it")
Baruch Siach27752762016-11-14 23:58:30 +020042 set(OPJ_HAVE_PNG_H 1 PARENT_SCOPE)
43@@ -66,12 +73,24 @@ if(BUILD_THIRDPARTY)
44 set(OPJ_HAVE_LIBTIFF 1 PARENT_SCOPE)
45 else(BUILD_THIRDPARTY)
46 find_package(TIFF)
Samuel Martinde90e022016-11-06 17:35:59 +010047+ # Static only build:
48+ # it is necessary to invoke pkg_check_module on libtiff since it may have
49+ # several other dependencies not declared by its cmake module, but they are
50+ # in the its pkgconfig module.
Baruch Siach27752762016-11-14 23:58:30 +020051+ if(PKG_CONFIG_FOUND)
52+ foreach(pc_tiff_module tiff tiff3 tiff4 tiff-3 tiff-4 libtiff libtiff3 libtiff4 libtiff-3 libtiff-4)
Samuel Martinde90e022016-11-06 17:35:59 +010053+ pkg_check_modules(PC_TIFF QUIET ${pc_tiff_module})
Baruch Siach27752762016-11-14 23:58:30 +020054+ if(PC_TIFF_FOUND)
Samuel Martinde90e022016-11-06 17:35:59 +010055+ break()
Baruch Siach27752762016-11-14 23:58:30 +020056+ endif(PC_TIFF_FOUND)
57+ endforeach()
58+ endif(PKG_CONFIG_FOUND)
59 if(TIFF_FOUND)
Samuel Martinde90e022016-11-06 17:35:59 +010060 message(STATUS "Your system seems to have a TIFF lib available, we will use it")
Baruch Siach27752762016-11-14 23:58:30 +020061 set(OPJ_HAVE_TIFF_H 1 PARENT_SCOPE)
62 set(OPJ_HAVE_LIBTIFF 1 PARENT_SCOPE)
63- set(TIFF_LIBNAME ${TIFF_LIBRARIES} PARENT_SCOPE)
64- set(TIFF_INCLUDE_DIRNAME ${TIFF_INCLUDE_DIR} PARENT_SCOPE)
65+ set(TIFF_LIBNAME ${TIFF_LIBRARIES} ${PC_TIFF_STATIC_LIBRARIES} PARENT_SCOPE)
66+ set(TIFF_INCLUDE_DIRNAME ${TIFF_INCLUDE_DIR} ${PC_TIFF_STATIC_INCLUDE_DIRS} PARENT_SCOPE)
67 else(TIFF_FOUND) # not found
68 set(OPJ_HAVE_TIFF_H 0 PARENT_SCOPE)
69 set(OPJ_HAVE_LIBTIFF 0 PARENT_SCOPE)
Samuel Martinde90e022016-11-06 17:35:59 +010070--
712.10.2
72