2015.08.13 18:58 "[Tiff] [patch] Additional CMake fixes (2)", by Roger Leigh

2015.08.13 18:58 "[Tiff] [patch] Additional CMake fixes (2)", by Roger Leigh

Hi,

I found that there's a copy-paste error in libtiff/CMakeLists.txt. The libtiffxx logic was actually applying properties to the libtiff target, which includes its linker map file and this meant that the libtiff symbols were not versioned correctly and the libtiffxx symbol versioning was absent entirely.

The attached patch sets the properties on the targets correctly, and so the symbol versioning should match the autotools logic now.

I have been using the cmake build logic against 4.0.4 for a few months now on Linux, MacOS X, FreeBSD and Windows with several Visual Studio versions, and it seems to be working well. On Windows, I now have daily integration testing against VS 2012 and 2013, with 2010/2015 to come.

We have a reasonably large set of build slaves in the ci.openmicroscopy.org Jenkins CI setup; I could likely set up a libtiff build/test job to build the current CVS against all the Visual Studio versions if that would be of any benefit to you. Likewise for Linux/MacOSX/BSD, though I suspect these already have much better test coverage! If you wanted to drop the set of project files for each Visual Studio version in favour of CMake, this would give you test coverage of the complete set.

I've also (this week) submitted some improvements to the FindTIFF CMake module so it can detect Debug and Release versions of the library properly (previously was Release only, so it's now possible to link with a Debug libtiff for your own debug builds when using CMake).

Regards,
Roger

diff -urN tiff-4.0.4/libtiff/CMakeLists.txt tiff-4.0.4-fixed/libtiff/CMakeLists.txt --- tiff-4.0.4/libtiff/CMakeLists.txt 2015-06-25 09:54:08.537710322 -0700 +++ tiff-4.0.4-fixed/libtiff/CMakeLists.txt 2015-08-13 11:45:08.946509390 -0700 @@ -149,16 +149,16 @@

 if(cxx)
   add_library(tiffxx SHARED ${tiffxx_SOURCES} ${tiffxx_HEADERS})
   target_link_libraries(tiffxx tiff)

- set_target_properties(tiff PROPERTIES SOVERSION ${SO_COMPATVERSION}) + set_target_properties(tiffxx PROPERTIES SOVERSION ${SO_COMPATVERSION})

   if(NOT CYGWIN)

     # This property causes shared libraries on Linux to have the full version
     # encoded into their final filename.  We disable this on Cygwin because
     # it causes cygz-${TIFF_FULL_VERSION}.dll to be created when cygz.dll
     # seems to be the default.
-    set_target_properties(tiff PROPERTIES VERSION ${SO_VERSION})
+    set_target_properties(tiffxx PROPERTIES VERSION ${SO_VERSION})

   endif()
   if(HAVE_LD_VERSION_SCRIPT)
- set_target_properties(tiff PROPERTIES LINK_FLAGS
+ set_target_properties(tiffxx PROPERTIES LINK_FLAGS
                           "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libtiffxx.map")
   endif()