Samuel Martin | de90e02 | 2016-11-06 17:35:59 +0100 | [diff] [blame] | 1 | From 38f50c7d9ad3ba06b64583045665203afb53cbd9 Mon Sep 17 00:00:00 2001 |
| 2 | From: Samuel Martin <s.martin49@gmail.com> |
| 3 | Date: Sun, 6 Nov 2016 16:29:08 +0100 |
| 4 | Subject: [PATCH] thirdparty: tiff: append flags found by pkg-config if |
| 5 | available |
| 6 | |
| 7 | This change allows to get all required CFLAGS/LDFLAGS in case of static only |
| 8 | build. |
| 9 | |
| 10 | This build issue [1] was triggered by the Buildroot farms. |
| 11 | |
| 12 | [1] http://autobuild.buildroot.net/results/d0d/d0d22727311d6300e0e400728126170407bfd699/build-end.log |
| 13 | |
| 14 | Signed-off-by: Samuel Martin <s.martin49@gmail.com> |
| 15 | --- |
| 16 | thirdparty/CMakeLists.txt | 23 +++++++++++++++++++++-- |
| 17 | 1 file changed, 21 insertions(+), 2 deletions(-) |
| 18 | |
| 19 | diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt |
Baruch Siach | 2775276 | 2016-11-14 23:58:30 +0200 | [diff] [blame] | 20 | index cb24b43b58e2..cd6a5e1391b0 100644 |
Samuel Martin | de90e02 | 2016-11-06 17:35:59 +0100 | [diff] [blame] | 21 | --- a/thirdparty/CMakeLists.txt |
| 22 | +++ b/thirdparty/CMakeLists.txt |
| 23 | @@ -1,5 +1,9 @@ |
| 24 | # 3rd party libs |
| 25 | |
Baruch Siach | 2775276 | 2016-11-14 23:58:30 +0200 | [diff] [blame] | 26 | +if(NOT BUILD_THIRDPARTY) |
Samuel Martin | de90e02 | 2016-11-06 17:35:59 +0100 | [diff] [blame] | 27 | + include(FindPkgConfig) |
Baruch Siach | 2775276 | 2016-11-14 23:58:30 +0200 | [diff] [blame] | 28 | +endif(NOT BUILD_THIRDPARTY) |
Samuel Martin | de90e02 | 2016-11-06 17:35:59 +0100 | [diff] [blame] | 29 | + |
| 30 | #------------ |
| 31 | # Try to find lib Z |
Baruch Siach | 2775276 | 2016-11-14 23:58:30 +0200 | [diff] [blame] | 32 | if(BUILD_THIRDPARTY) |
| 33 | @@ -36,6 +40,9 @@ if(BUILD_THIRDPARTY) |
| 34 | else(BUILD_THIRDPARTY) |
| 35 | if(ZLIB_FOUND) |
| 36 | find_package(PNG) |
Samuel Martin | de90e02 | 2016-11-06 17:35:59 +0100 | [diff] [blame] | 37 | + # 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 Siach | 2775276 | 2016-11-14 23:58:30 +0200 | [diff] [blame] | 40 | if(PNG_FOUND) |
Samuel Martin | de90e02 | 2016-11-06 17:35:59 +0100 | [diff] [blame] | 41 | message(STATUS "Your system seems to have a PNG lib available, we will use it") |
Baruch Siach | 2775276 | 2016-11-14 23:58:30 +0200 | [diff] [blame] | 42 | 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 Martin | de90e02 | 2016-11-06 17:35:59 +0100 | [diff] [blame] | 47 | + # 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 Siach | 2775276 | 2016-11-14 23:58:30 +0200 | [diff] [blame] | 51 | + if(PKG_CONFIG_FOUND) |
| 52 | + foreach(pc_tiff_module tiff tiff3 tiff4 tiff-3 tiff-4 libtiff libtiff3 libtiff4 libtiff-3 libtiff-4) |
Samuel Martin | de90e02 | 2016-11-06 17:35:59 +0100 | [diff] [blame] | 53 | + pkg_check_modules(PC_TIFF QUIET ${pc_tiff_module}) |
Baruch Siach | 2775276 | 2016-11-14 23:58:30 +0200 | [diff] [blame] | 54 | + if(PC_TIFF_FOUND) |
Samuel Martin | de90e02 | 2016-11-06 17:35:59 +0100 | [diff] [blame] | 55 | + break() |
Baruch Siach | 2775276 | 2016-11-14 23:58:30 +0200 | [diff] [blame] | 56 | + endif(PC_TIFF_FOUND) |
| 57 | + endforeach() |
| 58 | + endif(PKG_CONFIG_FOUND) |
| 59 | if(TIFF_FOUND) |
Samuel Martin | de90e02 | 2016-11-06 17:35:59 +0100 | [diff] [blame] | 60 | message(STATUS "Your system seems to have a TIFF lib available, we will use it") |
Baruch Siach | 2775276 | 2016-11-14 23:58:30 +0200 | [diff] [blame] | 61 | 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 Martin | de90e02 | 2016-11-06 17:35:59 +0100 | [diff] [blame] | 70 | -- |
| 71 | 2.10.2 |
| 72 | |