From: Paul Zander <negril.nx+gentoo@gmail.com>

Make fits test images download optional
Make j2k test images download optional

Adapted for OpenImageIO 3.1.7.0.

diff -urw a b
--- a/src/cmake/testing.cmake
+++ b/src/cmake/testing.cmake
@@ -276,12 +276,14 @@
                     IMAGEDIR oiio-images URL "Recent checkout of OpenImageIO-images")
     oiio_add_tests (jpeg2000
                     FOUNDVAR OPENJPEG_FOUND
+		    ENABLEVAR ENABLE_OPENJPEG
                     IMAGEDIR oiio-images URL "Recent checkout of OpenImageIO-images")
     oiio_add_tests (htj2k
                     FOUNDVAR openjph_FOUND
                     IMAGEDIR oiio-images URL "Recent checkout of OpenImageIO-images")
     oiio_add_tests (jpeg2000-j2kp4files
                     FOUNDVAR OPENJPEG_FOUND
+		    ENABLEVAR ENABLE_OPENJPEG
                     IMAGEDIR j2kp4files_v1_5
                     URL http://www.itu.int/net/ITU-T/sigdb/speimage/ImageForm-s.aspx?val=10100803)
     set (all_openexr_tests
@@ -432,6 +434,10 @@
     oiio_get_test_data (openexr-images
                         REPO https://github.com/AcademySoftwareFoundation/openexr-images.git
                         BRANCH main)
+    if(ENABLE_FITS)
     oiio_get_test_data (fits-images)
+    endif()
+    if(ENABLE_OPENJPEG)
     oiio_get_test_data (j2kp4files_v1_5)
+    endif()
 endfunction ()
