This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  203efca5072f27271f5403f0188afc0bb0df767a (commit)
       via  09f36344eaa6adee6a238ae1320d57352eaee8f0 (commit)
       via  a237b26d6c9821464856db283e0f83152409465b (commit)
      from  26d765cf6b6c6a08b03b8643cd7b408dc29a373b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=203efca5072f27271f5403f0188afc0bb0df767a
commit 203efca5072f27271f5403f0188afc0bb0df767a
Merge: 26d765c 09f3634
Author:     Roger Leigh <rle...@codelibre.net>
AuthorDate: Thu Dec 3 19:08:42 2015 -0500
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Thu Dec 3 19:08:42 2015 -0500

    Merge topic 'tiff-imported-target' into next
    
    09f36344 Help: Document addition of FindTIFF imported targets
    a237b26d FindTIFF: Add imported targets and update documentation


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=09f36344eaa6adee6a238ae1320d57352eaee8f0
commit 09f36344eaa6adee6a238ae1320d57352eaee8f0
Author:     Roger Leigh <rle...@codelibre.net>
AuthorDate: Thu Dec 3 23:46:44 2015 +0000
Commit:     Roger Leigh <rle...@codelibre.net>
CommitDate: Thu Dec 3 23:46:44 2015 +0000

    Help: Document addition of FindTIFF imported targets

diff --git a/Help/release/dev/FindTIFF-imported-targets.rst 
b/Help/release/dev/FindTIFF-imported-targets.rst
new file mode 100644
index 0000000..f8bbc14
--- /dev/null
+++ b/Help/release/dev/FindTIFF-imported-targets.rst
@@ -0,0 +1,4 @@
+FindTIFF-imported-targets
+-------------------------
+
+* The :module:`FindTIFF` module now provides imported targets.

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a237b26d6c9821464856db283e0f83152409465b
commit a237b26d6c9821464856db283e0f83152409465b
Author:     Roger Leigh <rle...@codelibre.net>
AuthorDate: Wed Dec 2 17:20:24 2015 +0000
Commit:     Roger Leigh <rle...@codelibre.net>
CommitDate: Thu Dec 3 23:44:40 2015 +0000

    FindTIFF: Add imported targets and update documentation
    
    - Add TIFF::TIFF imported target
    - Document imported target
    - Add testcase to test the standard variables and the imported
      target
    
    Also:
    
    - Add TIFF_INCLUDE_DIRS to match common practice
    - Update documentation generally, including documenting
      TIFF_INCLUDE_DIRS

diff --git a/Modules/FindTIFF.cmake b/Modules/FindTIFF.cmake
index ed092ea..e49a00d 100644
--- a/Modules/FindTIFF.cmake
+++ b/Modules/FindTIFF.cmake
@@ -2,24 +2,43 @@
 # FindTIFF
 # --------
 #
-# Find TIFF library
+# Find the TIFF library (libtiff).
 #
-# Find the native TIFF includes and library This module defines
+# Imported targets
+# ^^^^^^^^^^^^^^^^
 #
-# ::
+# This module defines the following :prop_tgt:`IMPORTED` targets:
 #
-#   TIFF_INCLUDE_DIR, where to find tiff.h, etc.
-#   TIFF_LIBRARIES, libraries to link against to use TIFF.
-#   TIFF_FOUND, If false, do not try to use TIFF.
+# ``TIFF::TIFF``
+#   The TIFF library, if found.
 #
-# also defined, but not for general use are
+# Result variables
+# ^^^^^^^^^^^^^^^^
 #
-# ::
+# This module will set the following variables in your project:
 #
-#   TIFF_LIBRARY, where to find the TIFF library.
+# ``TIFF_FOUND``
+#   true if the TIFF headers and libraries were found
+# ``TIFF_INCLUDE_DIR``
+#   the directory containing the TIFF headers
+# ``TIFF_INCLUDE_DIRS``
+#   the directory containing the TIFF headers
+# ``TIFF_LIBRARIES``
+#   TIFF libraries to be linked
+#
+# Cache variables
+# ^^^^^^^^^^^^^^^
+#
+# The following cache variables may also be set:
+#
+# ``TIFF_INCLUDE_DIR``
+#   the directory containing the TIFF headers
+# ``TIFF_LIBRARY``
+# the path to the TIFF library
 
 #=============================================================================
 # Copyright 2002-2009 Kitware, Inc.
+# Copyright 2015 University of Dundee
 #
 # Distributed under the OSI-approved BSD License (the "License");
 # see accompanying file Copyright.txt for details.
@@ -65,7 +84,35 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIFF
                                   VERSION_VAR TIFF_VERSION_STRING)
 
 if(TIFF_FOUND)
-  set( TIFF_LIBRARIES ${TIFF_LIBRARY} )
+  set(TIFF_LIBRARIES ${TIFF_LIBRARY})
+  set(TIFF_INCLUDE_DIRS "${TIFF_INCLUDE_DIR}")
+
+  if(NOT TARGET TIFF::TIFF)
+    add_library(TIFF::TIFF UNKNOWN IMPORTED)
+    if(TIFF_INCLUDE_DIRS)
+      set_target_properties(TIFF::TIFF PROPERTIES
+        INTERFACE_INCLUDE_DIRECTORIES "${TIFF_INCLUDE_DIRS}")
+    endif()
+    if(EXISTS "${TIFF_LIBRARY}")
+      set_target_properties(TIFF::TIFF PROPERTIES
+        IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+        IMPORTED_LOCATION "${TIFF_LIBRARY}")
+    endif()
+    if(EXISTS "${TIFF_LIBRARY_DEBUG}")
+      set_property(TARGET TIFF::TIFF APPEND PROPERTY
+        IMPORTED_CONFIGURATIONS DEBUG)
+      set_target_properties(TIFF::TIFF PROPERTIES
+        IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
+        IMPORTED_LOCATION_DEBUG "${TIFF_LIBRARY_DEBUG}")
+    endif()
+    if(EXISTS "${TIFF_LIBRARY_RELEASE}")
+      set_property(TARGET TIFF::TIFF APPEND PROPERTY
+        IMPORTED_CONFIGURATIONS RELEASE)
+      set_target_properties(TIFF::TIFF PROPERTIES
+        IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
+        IMPORTED_LOCATION_RELEASE "${TIFF_LIBRARY_RELEASE}")
+    endif()
+  endif()
 endif()
 
 mark_as_advanced(TIFF_INCLUDE_DIR TIFF_LIBRARY)
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 5fd7159..a040ec0 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1367,6 +1367,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P 
${CMake_SOURCE_DIR}/Utilities/Release
     add_subdirectory(FindOpenSSL)
   endif()
 
+  if(CMake_TEST_FindTIFF)
+    add_subdirectory(FindTIFF)
+  endif()
+
   if(CMake_TEST_FindXercesC)
     add_subdirectory(FindXercesC)
   endif()
diff --git a/Tests/FindTIFF/CMakeLists.txt b/Tests/FindTIFF/CMakeLists.txt
new file mode 100644
index 0000000..c4e0c6a
--- /dev/null
+++ b/Tests/FindTIFF/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME FindTIFF.Test COMMAND
+  ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+  --build-and-test
+  "${CMake_SOURCE_DIR}/Tests/FindTIFF/Test"
+  "${CMake_BINARY_DIR}/Tests/FindTIFF/Test"
+  ${build_generator_args}
+  --build-project TestFindTIFF
+  --build-options ${build_options}
+  --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+  )
diff --git a/Tests/FindTIFF/Test/CMakeLists.txt 
b/Tests/FindTIFF/Test/CMakeLists.txt
new file mode 100644
index 0000000..f17cda7
--- /dev/null
+++ b/Tests/FindTIFF/Test/CMakeLists.txt
@@ -0,0 +1,17 @@
+cmake_minimum_required(VERSION 3.1)
+project(TestFindTIFF C)
+include(CTest)
+
+# CMake does not actually provide FindTIFF publicly.
+set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../Source/Modules)
+
+find_package(TIFF REQUIRED)
+
+add_executable(test_xercesc_tgt main.c)
+target_link_libraries(test_xercesc_tgt TIFF::TIFF)
+add_test(NAME test_xercesc_tgt COMMAND test_xercesc_tgt)
+
+add_executable(test_xercesc_var main.c)
+target_include_directories(test_xercesc_var PRIVATE ${TIFF_INCLUDE_DIRS})
+target_link_libraries(test_xercesc_var PRIVATE ${TIFF_LIBRARIES})
+add_test(NAME test_xercesc_var COMMAND test_xercesc_var)
diff --git a/Tests/FindTIFF/Test/main.c b/Tests/FindTIFF/Test/main.c
new file mode 100644
index 0000000..fc4f337
--- /dev/null
+++ b/Tests/FindTIFF/Test/main.c
@@ -0,0 +1,12 @@
+#include <assert.h>
+#include <tiffio.h>
+
+int main()
+{
+  /* Without any TIFF file to open, test that the call fails as
+     expected.  This tests that linking worked. */
+  TIFF *tiff = TIFFOpen("invalid.tiff", "r");
+  assert(!tiff);
+
+  return 0;
+}

-----------------------------------------------------------------------

Summary of changes:
 Help/release/dev/FindTIFF-imported-targets.rst |    4 ++
 Modules/FindTIFF.cmake                         |   67 ++++++++++++++++++++----
 Tests/CMakeLists.txt                           |    4 ++
 Tests/{FindBoost => FindTIFF}/CMakeLists.txt   |    8 +--
 Tests/FindTIFF/Test/CMakeLists.txt             |   17 ++++++
 Tests/FindTIFF/Test/main.c                     |   12 +++++
 6 files changed, 98 insertions(+), 14 deletions(-)
 create mode 100644 Help/release/dev/FindTIFF-imported-targets.rst
 copy Tests/{FindBoost => FindTIFF}/CMakeLists.txt (54%)
 create mode 100644 Tests/FindTIFF/Test/CMakeLists.txt
 create mode 100644 Tests/FindTIFF/Test/main.c


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/mailman/listinfo/cmake-commits

Reply via email to