libtiff: cmake: Do not build faxtable target when cross-compiling

From fa3806c1586574f3d714065474ded027212d53a9 Mon Sep 17 00:00:00 2001
From: Roger Leigh <[EMAIL REDACTED]>
Date: Sun, 29 May 2022 11:19:54 +0100
Subject: [PATCH] cmake: Do not build faxtable target when cross-compiling

---
 libtiff/CMakeLists.txt | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/libtiff/CMakeLists.txt b/libtiff/CMakeLists.txt
index b6b31677..488a7a8c 100755
--- a/libtiff/CMakeLists.txt
+++ b/libtiff/CMakeLists.txt
@@ -217,12 +217,14 @@ if(CXX_SUPPORT)
 
 endif()
 
-add_executable(mkg3states ../placeholder.h)
-target_sources(mkg3states PRIVATE mkg3states.c tif_fax3.h)
-target_link_libraries(mkg3states tiff port)
-
-add_custom_target(faxtable
-        DEPENDS mkg3states
-        COMMAND ${CMAKE_COMMAND} -E rm "tif_fax3sm.c"
-        COMMAND mkg3states -b -c const "tif_fax3sm.c"
-        WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
+if(NOT CMAKE_CROSSCOMPILING)
+  add_executable(mkg3states ../placeholder.h)
+  target_sources(mkg3states PRIVATE mkg3states.c tif_fax3.h)
+  target_link_libraries(mkg3states tiff port)
+
+  add_custom_target(faxtable
+          DEPENDS mkg3states
+          COMMAND ${CMAKE_COMMAND} -E rm "tif_fax3sm.c"
+          COMMAND mkg3states -b -c const "tif_fax3sm.c"
+          WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
+endif()