93 Commits

Author SHA1 Message Date
Roger Leigh
9a2de8115c Correct -Wformat errors
Fix format string mismatches where the format specifier doesn't match
the argument type:

- Change %d to %u for unsigned int/uint32_t arguments
- Change %u to %d for signed int arguments
- Add casts where needed for printf family functions
- Use PRIu64/PRIi64 for uint64_t/int64_t arguments

Fix -Wformat-nonliteral warnings

Add TIFF_ATTRIBUTE((__format__(__printf__, N, 0))) to functions that
accept format strings as parameters (va_list style). The 0 indicates
no variadic arguments to check since the format is validated at the
call site.
2025-12-24 13:49:08 +00:00
Roger Leigh
81b28ece04 ci: Build CMake builds with extra-warnings
* Split extra-warnings into extra-warnings and broken-warnings
* extra-warnings initially only uses -pedantic -Wextra
* Warnings will be moved from broken-warnings to extra-warnings
  once the CI builds have proved them safe to use
2025-12-24 13:49:08 +00:00
Roger Leigh
29c5dead27 cmake: Improve tiff_target_compile_as_cxx implementation 2025-12-20 12:55:28 +00:00
Roger Leigh
e8459c5ad1 Add CMake options for C++ compatibility checking
Add two new CMake options to help maintain C++ compatibility:

1. cxx-compat-warnings: Enables -Wc++-compat flag (GCC/Clang) which
   warns about using C++ keywords as identifiers and some enum/int
   conversions. This is limited and won't catch all issues.

2. cxx-compat-mode: Compiles C source files as C++17 using -x c++
   (GCC/Clang) or /TP (MSVC). This catches all C++ incompatibilities
   as compile errors, including:
   - implicit void* to typed pointer conversions
   - register storage class (removed in C++17)
   - goto/switch jumping over variable initialization
   - enum arithmetic and implicit conversions

Usage:
  cmake -Dcxx-compat-warnings=ON ..  # Light checking
  cmake -Dcxx-compat-mode=ON ..      # Full C++ compilation
2025-12-18 22:35:00 +00:00
Roger Leigh
50c2da5b12 Merge branch 'cmake-cmath-avoid-imported-target_neroburner' into 'master'
cmake: Replace CMath::CMath with direct link to avoid export

Closes #625

See merge request libtiff/libtiff!764
2025-12-13 14:48:54 +00:00
Reinhold Gschweicher
4b3e1d314d cmake: rename TiffConfig.cmake.in to tiff-config.cmake.in
As requested by code review and to make it more coherent.
2025-09-17 13:48:55 +02:00
Reinhold Gschweicher
25d17e1718 cmake: Replace CMath::CMath with direct link to avoid export
Link with CMATH_LIBRARIES instead of CMath::CMath.  While this
will still be exported, it will be available on the host system.

Port of original commit:
67f73084ca

co-authored: Roger Leigh <rleigh@codelibre.net>
2025-09-15 16:17:29 +02:00
Reinhold Gschweicher
5697b12e42 cmake: install tiff-config.cmake to allow all capitalizations
Rename `TiffConfig.cmake` to `tiff-config.cmake` to allow all
capitalizations of `find_package(TIFF)` to be found.
2025-09-15 16:07:02 +02:00
Bob Friesenhahn
56f641129c Merge branch 'defines' into 'master'
Move several defines into tif_config.h

See merge request libtiff/libtiff!664
2025-04-29 21:51:44 +00:00
榆柳松
fc202ff1df Rename cxx to tiff-cxx,avoid overly mundane names. 2024-11-30 15:32:38 +08:00
Daniel E @diizzyy
0dbcfc5bd2 CMake: fix build with LLVM/Clang 17+
Fixes #651
2024-10-20 22:45:18 +02:00
Benjamin Gilbert
dc769d5871 Define HAVE_JPEGTURBO_DUAL_MODE_8_12 in tif_config.h
Remove special-case Autotools and CMake code to define it on the
compiler command line.
2024-09-21 13:24:16 -07:00
Benjamin Gilbert
ce85ec85f0 Define LERC_STATIC in tif_config.h
Remove special-case Autotools and CMake code to define it on the
compiler command line.
2024-09-21 13:23:04 -07:00
Benjamin Gilbert
5a4e05aad2 CMake: set WORDS_BIGENDIAN via #cmakedefine
Autotools sets WORDS_BIGENDIAN via tif_config.h, but the CMake equivalent
in tif_config.h.cmake.in is a no-op; CMake passes the define on the
compiler command line instead.  For consistency, have CMake set the define
via tif_config.h.
2024-09-21 13:22:08 -07:00
Su_Laus
9ab54a8580 Revert "Move most TIFF tools to archive and keep some as unsupported (see #580)."
This reverts commit eab89a627f.

# Conflicts:
#	tools/unsupported/CMakeLists.txt
#	tools/unsupported/tif_tools-unsupported_versioninfo.rc
2024-05-11 16:49:55 +02:00
Julien Schueller
f8498e2a9a CMake: Fix TIFF_INCLUDE_DIRS 2023-10-12 09:36:52 +02:00
Even Rouault
5fd37d37e6 Fix references to mailing list 2023-09-05 18:00:43 +02:00
Su Laus
432a3b64ad Update CMake and autoconf scripts to consistently update LibTIFF version defines and references in various files when version definition in configure.ac has been changed.
- Move in tiffvers.h from .\libtiff source directory to .\libtiff  build directory.
- Remove unused version information from tif_config.h
- With every CMake build the version defines (e.g. 4.5.1) within tiffvers.h are consistently updated from configure.ac. The version release-date is taken from file RELEASE-DATE.
- The files VERSION and RELEASE-DATE are only updated with a special CMake target build: cmake --build . --target tiff_release.

- For autotools, version information is updated from configure.ac with ./autogen.sh. LIBTIFF_RELEASE_DATE is taken form file RELEASE-DATE.
- ./configure generates tiffvers.h with the cached version information and LIBTIFF_RELEASE_DATE.
- "make release" updates tiffvers.h and VERSION file with cached version info and RELEASE-DATE file and tiffves.h with the current date.
2023-09-03 18:11:13 +00:00
Su Laus
eab89a627f Move most TIFF tools to archive and keep some as unsupported (see #580). 2023-08-16 13:01:04 +00:00
Even Rouault
eabde1635a TiffConfig.cmake.in: set TIFF_INCLUDE_DIR, TIFF_INCLUDE_DIRS and... 2023-07-19 22:05:15 +00:00
Even Rouault
72187a0fb7 cmake/PkgConfig.cmake: avoid CMake error when prefix or suffix is empty 2023-06-09 15:40:17 +02:00
Even Rouault
71c90a51bc CMake: export TiffConfig.cmake and TiffConfigVersion.cmake files 2023-06-05 17:20:37 +02:00
Even Rouault
be9785ac6d Merge branch 'bebuch-master-patch-58347' into 'master'
check if upstream lzma (xz) config was used and bind to it if so

See merge request libtiff/libtiff!494
2023-05-25 14:41:50 +00:00
Benjamin Buch
c58e47a183 check if upstream lzma (xz) config was used and bind to it if so 2023-05-25 14:41:49 +00:00
Even Rouault
7eb0f8ca76 Merge branch 'upstream-zstd-config' into 'master'
check if upstream zstd config was used and bind to it if so

See merge request libtiff/libtiff!493
2023-05-25 14:40:48 +00:00
Su_Laus
b2cdf4292a CMake: FindDeflate several errors (see #526)
There are CMake issues if the library is not included in the environment path and only set with CMake -D option.
- For FindDeflate.cmake, FindJBIG.cmake, FindLERC.cmake, FindWebP.cmake, FindZSTD.cmake:
  Set IMPORTED_LOCATION (without debug or release) if neither <library>_LIBRARY_RELEASE nor <library>_LIBRARY_DEBUG were set.
- FindDeflate.cmake: Correct code to retrieve library version information from libdeflate.h
- FindLERC.cmake version string return added.
2023-05-24 21:49:43 +02:00
Benjamin Buch
211704a9e6 prefer shared over static 2023-05-24 10:20:27 +00:00
Benjamin Buch
527208be70 check if upstream zstd config was used and bind to it if so 2023-05-24 09:37:16 +00:00
Benjamin Buch
86e058e4ed CMake: make WebP component name compatible with upstream ConfigWebP.cmake 2023-05-24 09:07:25 +00:00
Even Rouault
0dabdfe857 Hardcode HOST_FILLORDER to FILLORDER_LSB2MSB, and make 'H' flag of TIFFOpen() to warn and an alias of FILLORDER_MSB2LSB 2023-05-09 14:47:49 +02:00
Roman
d2f2dbc392 do not install libtiff-4.pc when tiff-install is reset 2023-04-23 13:49:35 +10:00
Even Rouault
a1be870b1f Make TIFF_MAX_DIR_COUNT a autoconf/CMake setting 2022-12-13 13:12:49 +01:00
Even Rouault
0fd1a81d35 Add support for libjpeg-turbo 2.2-dev 8/12 bit dual mode 2022-11-25 11:26:45 +00:00
Even Rouault
58ad3b5635 CMake: correctly set default value of 'lzma' option when liblzma is detected (fixes #482) 2022-10-23 14:27:28 +02:00
Timothy Lyanguzov
7d0ed2ed5e Apply 9 suggestion(s) to 3 file(s) 2022-10-04 16:38:06 +00:00
Jeremy Maitin-Shepard
814a2441e7 Fix CMake build to be compatible with FetchContent
Recent versions of CMake have improved support for including
dependencies, using the FetchContent module, which allows a dependency
to be imported as a subproject and then later found automatically by
calls to `find_package`.

This change makes libtiff's CMake better behaved when used as a
sub-project:

- CMake has a single global namespace for all target names in all
  sub-projects.  This commit renames the following CMake targets:

  - port -> tiff_port
  - mkg3states -> tiff_mkg3states
  - faxtable -> tiff_faxtable
  - release -> tiff_release

- When building TIFF as a sub-project, it is not normally useful to
  create install rules for its targets.  This commit adds a
  `tiff-install` option that controls whether the install rules are
  added and defaults to OFF when libtiff is included as a sub-project.

- Previously, libtiff set `BUILD_SHARED_LIBS` to ON by default.  With
  this commit, that default is only set if libtiff is the top-level
  project.

- When using `find_package(TIFF)`, the targets `TIFF::TIFF` and
  `TIFF::CXX` are defined.  This commit makes libtiff itself define
  those targets as aliases, to allow other cmake projects to use
  either `find_package` or `FetchContent` interchangeably.

- Adds ZSTD_HAVE_DECOMPRESS_STREAM variable which may be set to bypass
  `check_symbol_exists` call.  Fixes
  https://gitlab.com/libtiff/libtiff/-/issues/472.
2022-10-03 15:41:07 -07:00
Roger Leigh
7da8c385e0 cmake: Correct duplicate definition of _CRT_SECURE_NO_WARNINGS 2022-07-13 21:29:41 +01:00
Roger Leigh
42fc3324e1 cmake: Fixes for Visual Studio 2022 2022-07-13 06:56:03 +01:00
Roger Leigh
7faec51e2b doc: Add Sphinx conversion of all manpages 2022-06-18 22:54:20 +01:00
Matthias Kuhn
cd38e31d6e Always link to libm if available 2022-06-09 13:21:13 +02:00
Roger Leigh
21ae5bbb02 Convert HTML documentation to Sphinx RST
* Add CMake build logic
* Add Autotools build logic
* Move from html/ to doc/
* Manual pages are still generated HTML for the time being
2022-06-04 20:53:23 +01:00
Roger Leigh
36c8177fe8 cmake: Add tiff-opengl option 2022-05-29 11:36:14 +01:00
Miloš Komarčević
9dec6a620d Handle absolute paths in pkg-config file 2022-05-16 15:13:34 +02:00
Robert Pollak
0d8a20920e Replace add_compile_definitions for CMake versions before 3.12 (#238) 2022-05-13 14:34:47 +00:00
Miloš Komarčević
3172b1ddac Correct fix for the pkgconf file relative paths 2022-03-10 10:06:16 +00:00
Miloš Komarčević
0fafae5979 Fix pkgconf file relative paths 2022-03-02 19:00:00 +00:00
Timothy Lyanguzov
3a898a8161 Fix packaging with CPack
Replace all CMAKE_INSTALL_FULL_<DIR> with CMAKE_INSTALL_<DIR> to allow CPack setting CMAKE_INSTALL_PREFIX

Signed-off-by: Timothy Lyanguzov <timothy.lyanguzov@sap.com>
2022-01-28 15:35:21 +13:00
Even Rouault
35bc092078 Merge branch 'VisualStudio_warnings_suppress' into 'master'
Suppress unnecessary warnings in Visual Studio in AppVeyor test.

See merge request libtiff/libtiff!234
2021-12-01 13:50:51 +00:00
Even Rouault
21fae83bc9 Merge branch 'pkgconfig' into 'master'
Add version and requirements to pc file

See merge request libtiff/libtiff!256
2021-07-09 10:06:55 +00:00
Kai Pastor
2c496078ad Fix version in libtiff-4.pc.in, and CMake build: Add requirements to pc file 2021-07-09 10:06:55 +00:00