From: Paul Zander <negril.nx+gentoo@gmail.com>
Make fits test images download optional
Make j2k test images download optional

diff --git a/src/cmake/testing.cmake b/src/cmake/testing.cmake
index b671def..ff84b7d 100644
--- a/src/cmake/testing.cmake
+++ b/src/cmake/testing.cmake
@@ -271,9 +271,11 @@ macro (oiio_add_all_tests)
                     IMAGEDIR oiio-images URL "Recent checkout of oiio-images")
     oiio_add_tests (jpeg2000
                     FOUNDVAR OPENJPEG_FOUND
+                    ENABLEVAR ENABLE_OPENJPEG
                     IMAGEDIR oiio-images URL "Recent checkout of oiio-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
@@ -410,6 +410,10 @@ function (oiio_setup_test_data)
     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 ()
