Commit 08075aeb for libheif

commit 08075aebcc0d9bf7d35f900c36114b1b6e90ed7d
Author: Dirk Farin <dirk.farin@gmail.com>
Date:   Wed Sep 9 15:03:36 2026 +0200

    Define BUILD_TESTING before it gates the heifio subdirectory

    The heifio guard added in the previous commit reads BUILD_TESTING at a
    point where the option is not defined yet. On a fresh configure with only
    -DWITH_EXAMPLES=OFF this skipped heifio while the tests were still built,
    so tiffdecode linked a non-existent "-lheifio" and the build failed at
    link time. Re-running configure hid the problem because the cached value
    was then visible.

    Move the option up to the other build options so that all combinations
    of WITH_EXAMPLES and BUILD_TESTING work on the first configure.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b4893877..a49d8388 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -589,6 +589,7 @@ option(WITH_EXAMPLES "Build examples" ON)
 option(WITH_EXAMPLE_HEIF_THUMB "Build heif-thumbnailer tool" ON)
 option(WITH_EXAMPLE_HEIF_VIEW "Build heif-view tool" ON)
 option(WITH_GDK_PIXBUF "Build gdk-pixbuf plugin" ON)
+option(BUILD_TESTING "Build the unit tests" ON)

 option(BUILD_DEVELOPMENT_TOOLS "Build development tools (heif-gen-bayer, etc.)" OFF)

@@ -604,6 +605,8 @@ else ()
     set(CMAKE_CXX_VISIBILITY_PRESET default)
 endif ()

+# heifio is a helper library for reading and writing image files.
+# It is only needed by the example programs and the unit tests.
 if(WITH_EXAMPLES OR BUILD_TESTING)
     add_subdirectory(heifio)
 endif()
@@ -658,7 +661,6 @@ if(ENABLE_COVERAGE)
     WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
 endif()

-option(BUILD_TESTING "" ON)
 set(CMAKE_CTEST_ARGUMENTS "--output-on-failure")
 include(CTest)
 if(BUILD_TESTING)