summaryrefslogtreecommitdiff
path: root/port
diff options
context:
space:
mode:
authorJeremy Maitin-Shepard <jbms@google.com>2022-09-21 13:42:08 -0700
committerJeremy Maitin-Shepard <jbms@google.com>2022-10-03 15:41:07 -0700
commit814a2441e76b54bfc2d4dd8961a9b43d996bcc0c (patch)
tree6b99d486058d06fe95c2c638bb44039b1bbd0e63 /port
parent4c3ddd99b6efbdca9d0f2e91a53671edb0656fd7 (diff)
downloadlibtiff-git-814a2441e76b54bfc2d4dd8961a9b43d996bcc0c.tar.gz
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.
Diffstat (limited to 'port')
-rwxr-xr-xport/CMakeLists.txt10
1 files changed, 5 insertions, 5 deletions
diff --git a/port/CMakeLists.txt b/port/CMakeLists.txt
index fd459162..04bd3ea8 100755
--- a/port/CMakeLists.txt
+++ b/port/CMakeLists.txt
@@ -31,21 +31,21 @@ set(port_HEADERS libport.h)
# Only build if any needed features are missing
if(NOT HAVE_GETOPT)
- add_library(port STATIC ../placeholder.h)
+ add_library(tiff_port STATIC ../placeholder.h)
# Add getopt if missing
if(NOT HAVE_GETOPT)
- target_sources(port PUBLIC
+ target_sources(tiff_port PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/getopt.c)
endif()
- target_include_directories(port PUBLIC
+ target_include_directories(tiff_port PUBLIC
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR})
else()
# Dummy interface library
- add_library(port INTERFACE)
- target_include_directories(port INTERFACE
+ add_library(tiff_port INTERFACE)
+ target_include_directories(tiff_port INTERFACE
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR})
endif()