Re: [cmake-developers] [PATCH] FindTIFF: Add imported targets
On 12/03/2015 07:11 PM, Roger Leigh wrote: > I hope this is now staged correctly for review. I've pushed a > tiff-imported-target topic branch and merged into next: Yes, thanks. I've just updated a nightly build client to enable the test for this. -Brad -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] [PATCH] FindTIFF: Add imported targets
On 02/12/2015 17:31, rle...@codelibre.net wrote: - 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 I hope this is now staged correctly for review. I've pushed a tiff-imported-target topic branch and merged into next: amys% ssh g...@cmake.org stage cmake merge -b next tiff-imported-target Fetching upstream next Merge topic 'tiff-imported-target' into next 09f36344 Help: Document addition of FindTIFF imported targets a237b26d FindTIFF: Add imported targets and update documentation Auto-merging Tests/CMakeLists.txt Pushing upstream next Kind regards, Roger -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
[cmake-developers] [PATCH] FindTIFF: Add imported targets
- 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 Patch attached. Regards, Roger>From d8f52434e7b86f55bdcdc4b2ca588f6d5f7daafa Mon Sep 17 00:00:00 2001 From: Roger LeighDate: Wed, 2 Dec 2015 17:20:24 + Subject: [PATCH] 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 --- Modules/FindTIFF.cmake | 67 -- Tests/CMakeLists.txt | 4 +++ Tests/FindTIFF/CMakeLists.txt | 10 ++ Tests/FindTIFF/Test/CMakeLists.txt | 17 ++ Tests/FindTIFF/Test/main.c | 12 +++ 5 files changed, 100 insertions(+), 10 deletions(-) create mode 100644 Tests/FindTIFF/CMakeLists.txt create mode 100644 Tests/FindTIFF/Test/CMakeLists.txt create mode 100644 Tests/FindTIFF/Test/main.c 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 000..c4e0c6a --- /dev/null +++ b/Tests/FindTIFF/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindTIFF.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $ +
[cmake-developers] [PATCH] FindTIFF: Add imported targets
- 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 Patch actually attached this time... Regards, Roger>From d8f52434e7b86f55bdcdc4b2ca588f6d5f7daafa Mon Sep 17 00:00:00 2001 From: Roger LeighDate: Wed, 2 Dec 2015 17:20:24 + Subject: [PATCH] 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 --- Modules/FindTIFF.cmake | 67 -- Tests/CMakeLists.txt | 4 +++ Tests/FindTIFF/CMakeLists.txt | 10 ++ Tests/FindTIFF/Test/CMakeLists.txt | 17 ++ Tests/FindTIFF/Test/main.c | 12 +++ 5 files changed, 100 insertions(+), 10 deletions(-) create mode 100644 Tests/FindTIFF/CMakeLists.txt create mode 100644 Tests/FindTIFF/Test/CMakeLists.txt create mode 100644 Tests/FindTIFF/Test/main.c 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 000..c4e0c6a --- /dev/null +++ b/Tests/FindTIFF/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindTIFF.Test COMMAND +