- 2015.06.16 17:51 "Re: [Tiff] CMake support for building libtiff", by Lee Howard
- 2015.06.17 03:16 "Re: [Tiff] CMake support for building libtiff", by Bob Friesenhahn
-
2015.06.17 22:38 "Re: [Tiff] CMake support for building libtiff", by Roger Leigh
-
2015.06.18 22:08 "Re: [Tiff] CMake support for building libtiff", by Roger Leigh
-
2015.06.19 11:54 "Re: [Tiff] CMake support for building libtiff", by Roger Leigh
-
2015.07.02 07:10 "[Tiff] [patch] Additional CMake fixes", by Roger Leigh
- 2015.07.04 22:10 "Re: [Tiff] [patch] Additional CMake fixes", by Bob Friesenhahn
-
2015.08.29 11:34 "[Tiff] [patch] Docs for cmake build and some minor tweaks", by Roger Leigh
- 2015.08.29 15:36 "Re: [Tiff] [patch] Docs for cmake build and some minor tweaks", by Bob Friesenhahn
-
2015.08.31 15:12 "[Tiff] [patch] cmake fixes", by
- 2015.08.31 15:34 "Re: [Tiff] [patch] cmake fixes", by Bob Friesenhahn
-
2015.07.02 07:10 "[Tiff] [patch] Additional CMake fixes", by Roger Leigh
- 2015.06.19 13:53 "Re: [Tiff] CMake support for building libtiff", by Rhys Thomas
-
2015.06.19 11:54 "Re: [Tiff] CMake support for building libtiff", by Roger Leigh
-
2015.06.19 13:41 "Re: [Tiff] 4.0.4beta: Symbol differences on Unix and Windows", by Bob Friesenhahn
- 2015.06.18 21:56 "[Tiff] 4.0.4beta: Symbol differences on Unix and Windows", by Roger Leigh
-
2015.06.18 22:08 "Re: [Tiff] CMake support for building libtiff", by Roger Leigh
- 2015.06.25 02:32 "Re: [Tiff] CMake support for building libtiff", by Bob Friesenhahn
2015.08.31 15:12 "[Tiff] [patch] cmake fixes", by
See attached patches.
01: CMake reads all version information directly from configure.ac to avoid duplication of values. This basically greps over the file for the LIBTIFF_* variables, then translates them to the form needed for cmake. This includes the release version and libtool shared library version information.
02: Make shared/static library building configurable. Currently it always builds shared libraries, with static libs having a _static suffix (copying zlib, but it means it's got a non-standard name). CMake has a -DBUILD_SHARED_LIBS=ON|OFF option to select one or the other, which is now used instead. There's now a single "tiff" target to build either shared or static as required, and all the tests and tools are linked with this. Note: the Windows tests fail when linked with a static libtiff (says: libtiff.dll not found). Not really a regression since this was not tested up to this point, and it's likely the unit tests haven't (ever?) been run on Windows with a static libtiff, so there's some additional portability issue here to address. Works fine on UNIX systems, and fine on Windows with the default to build a DLL.
03: Adds a missing file which wasn't being distributed, causing unit tests to fail. Note that "find. -name '*.cmake'" lists all the CMake files which need distributing in addition to all the CMakeLists.txt files (which now are distributed).
Regards,
Roger Leigh
Index: CMakeLists.txt
=================================================================== RCS file: /cvs/maptools/cvsroot/libtiff/CMakeLists.txt,v
retrieving revision 1.5
diff -u -r1.5 CMakeLists.txt
--- CMakeLists.txt 31 Aug 2015 00:01:18 -0000 1.5
+++ CMakeLists.txt 31 Aug 2015 14:31:17 -0000
@@ -42,13 +42,36 @@
cmake_policy(SET CMP0054 NEW)
endif(POLICY CMP0054)
+# Read version information from configure.ac. +FILE(READ "${CMAKE_CURRENT_SOURCE_DIR}/configure.ac" configure) +STRING(REGEX REPLACE ";" "\\\\;" configure "${configure}")
+STRING(REGEX REPLACE "\n" ";" configure "${configure}") +foreach(line ${configure})
+ foreach(var LIBTIFF_MAJOR_VERSION LIBTIFF_MINOR_VERSION LIBTIFF_MICRO_VERSION LIBTIFF_ALPHA_VERSION
+ LIBTIFF_CURRENT LIBTIFF_REVISION LIBTIFF_AGE)
+ if(NOT ${var})
+ string(REGEX MATCH "^${var}=(.*)" ${var}_MATCH "${line}")
+ if(${var}_MATCH)
+ string(REGEX REPLACE "^${var}=(.*)" "\\1" ${var} "${line}")
+ endif()
+ endif()
+ endforeach()
+endforeach()
+
+math(EXPR SO_MAJOR "${LIBTIFF_CURRENT} - ${LIBTIFF_AGE}")
+set(SO_MINOR "${LIBTIFF_AGE}")
+set(SO_REVISION "${LIBTIFF_REVISION}")
+
+message(STATUS "Building tiff version ${LIBTIFF_MAJOR_VERSION}.${LIBTIFF_MINOR_VERSION}.${LIBTIFF_MICRO_VERSION}${LIBTIFF_ALPHA_VERSION}")
+message(STATUS "libtiff library version ${SO_MAJOR}.${SO_MINOR}.${SO_REVISION}")
+
# Project version
-project(tiff VERSION 4.0.5 LANGUAGES C)
+project(tiff VERSION "${LIBTIFF_MAJOR_VERSION}.${LIBTIFF_MINOR_VERSION}.${LIBTIFF_MICRO_VERSION}" LANGUAGES C)
# the other tiff_VERSION_* variables are set automatically
-set(tiff_VERSION_ALPHA beta)
+set(tiff_VERSION_ALPHA "${LIBTIFF_ALPHA_VERSION}")
# Library version (unlike libtool's baroque scheme, WYSIWYG here)
-set(SO_COMPATVERSION 5)
-set(SO_VERSION 5.2.2)
+set(SO_COMPATVERSION "${SO_MAJOR}")
+set(SO_VERSION "${SO_MAJOR}.${SO_MINOR}.${SO_REVISION}")
# For autotools header compatibility
set(PACKAGE_NAME "LibTIFF Software")
Index: CMakeLists.txt
=================================================================== RCS file: /cvs/maptools/cvsroot/libtiff/CMakeLists.txt,v
retrieving revision 1.5
diff -u -r1.5 CMakeLists.txt
--- CMakeLists.txt 31 Aug 2015 00:01:18 -0000 1.5
+++ CMakeLists.txt 31 Aug 2015 14:26:18 -0000
@@ -42,6 +42,8 @@
cmake_policy(SET CMP0054 NEW)
endif(POLICY CMP0054)
+set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries")
+
# Project version
project(tiff VERSION 4.0.5 LANGUAGES C)
# the other tiff_VERSION_* variables are set automatically
@@ -704,6 +706,7 @@
message(STATUS " Documentation directory: ${LIBTIFF_DOCDIR}")
message(STATUS " C compiler: ${CMAKE_C_COMPILER}")
message(STATUS " C++ compiler: ${CMAKE_CXX_COMPILER}")
+message(STATUS " Build shared libraries: ${BUILD_SHARED_LIBS}")
message(STATUS " Enable linker symbol versioning: ${HAVE_LD_VERSION_SCRIPT}")
message(STATUS " Support Microsoft Document Imaging: ${mdi}")
message(STATUS " Use win32 IO: ${USE_WIN32_FILEIO}")
Index: libtiff/CMakeLists.txt
=================================================================== RCS file:
retrieving revision 1.2
diff -u -r1.2 CMakeLists.txt
--- libtiff/CMakeLists.txt 14 Aug 2015 02:26:37 -0000 1.2
+++ libtiff/CMakeLists.txt 31 Aug 2015 14:26:19 -0000
@@ -114,7 +114,7 @@
${CMAKE_CURRENT_BINARY_DIR}
${TIFF_INCLUDES})
-add_library(tiff SHARED ${tiff_SOURCES} ${tiff_HEADERS} ${nodist_tiff_HEADERS} +add_library(tiff ${tiff_SOURCES} ${tiff_HEADERS} ${nodist_tiff_HEADERS}
${tiff_port_SOURCES} libtiff.def)
target_link_libraries(tiff ${TIFF_LIBRARY_DEPS})
set_target_properties(tiff PROPERTIES SOVERSION ${SO_COMPATVERSION})
@@ -130,15 +130,7 @@
"-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libtiff.map")
endif()
-add_library(tiff_static STATIC ${tiff_SOURCES} ${tiff_HEADERS}) -target_link_libraries(tiff_static ${TIFF_LIBRARY_DEPS} port) -if (NOT WIN32)
- # Windows static and DLL import libraries both use .lib so the
- # static lib can't use the same name as the DLL
- set_target_properties(tiff_static PROPERTIES OUTPUT_NAME tiff) -endif()
-
-install(TARGETS tiff tiff_static
+install(TARGETS tiff
RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})
@@ -147,7 +139,7 @@
DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
if(cxx)
- add_library(tiffxx SHARED ${tiffxx_SOURCES} ${tiffxx_HEADERS})
+ add_library(tiffxx ${tiffxx_SOURCES} ${tiffxx_HEADERS})
target_link_libraries(tiffxx tiff)
set_target_properties(tiffxx PROPERTIES SOVERSION ${SO_COMPATVERSION})
if(NOT CYGWIN)
@@ -162,15 +154,7 @@
"-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libtiffxx.map")
endif()
- add_library(tiffxx_static STATIC ${tiffxx_SOURCES} ${tiffxx_HEADERS})
- target_link_libraries(tiffxx_static tiff_staticport)
- if (NOT WIN32)
- # Windows static and DLL import libraries both use .lib so the
- # static lib can't use the same name as the DLL
- set_target_properties(tiffxx_static PROPERTIES OUTPUT_NAME tiffxx)
- endif()
-
- install(TARGETS tiffxx tiffxx_static
+ install(TARGETS tiffxx
RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})
Index: test/Makefile.am
===================================================================
RCS file: /cvs/maptools/cvsroot/libtiff/test/Makefile.am,v
retrieving revision 1.38
diff -u -r1.38 Makefile.am
--- test/Makefile.am 31 Aug 2015 00:01:18 -0000 1.38
+++ test/Makefile.am 31 Aug 2015 14:30:09 -0000
@@ -39,7 +39,8 @@
CMakeLists.txt \
common.sh \
TiffSplitTest.cmake \
- TiffTestCommon.cmake
+ TiffTestCommon.cmake \
+ TiffTest.cmake
# All of the tests to execute via 'make check'
TESTS = $(check_PROGRAMS) $(TESTSCRIPTS)