head	1.1;
branch	1.1.1;
access;
symbols
	zlib-1-4-0:1.1.1.2
	perseant-exfatfs:1.1.1.1.0.2
	perseant-exfatfs-base-20261102:1.1.1.1
	zlib-1-3-2:1.1.1.1
	ZLIB:1.1.1;
locks; strict;
comment	@# @;


1.1
date	2026.05.03.16.34.34;	author christos;	state Exp;
branches
	1.1.1.1;
next	;
commitid	WC5vTA5Qzr0V6oEG;

1.1.1.1
date	2026.05.03.16.34.34;	author christos;	state Exp;
branches
	1.1.1.1.2.1;
next	1.1.1.2;
commitid	WC5vTA5Qzr0V6oEG;

1.1.1.2
date	2026.11.11.15.49.07;	author christos;	state Exp;
branches;
next	;
commitid	9erRToM6R4J4G33H;

1.1.1.1.2.1
date	2026.05.03.16.34.34;	author perseant;	state dead;
branches;
next	1.1.1.1.2.2;
commitid	3QTNojfCEH9lUb2H;

1.1.1.1.2.2
date	2026.11.04.22.36.25;	author perseant;	state Exp;
branches;
next	;
commitid	3QTNojfCEH9lUb2H;


desc
@@


1.1
log
@Initial revision
@
text
@function(ZLIB_findTestEnv testName)
    set(testEnv "PATH=")

    if(MSVC OR MINGW)
        set(separator "\\\;")
    else()
        set(separator ":")
    endif()

    string(APPEND testEnv "$<TARGET_FILE_DIR:ZLIB::ZLIB>${separator}")
    string(APPEND testEnv "$ENV{PATH}")

    set_tests_properties(${testName} PROPERTIES ENVIRONMENT "${testEnv}")
endfunction()

if(ZLIB_BUILD_SHARED)
    add_executable(zlib_example example.c)
    target_link_libraries(zlib_example ZLIB::ZLIB)
    target_compile_definitions(zlib_example PRIVATE ZLIB_BUILD)
    add_test(NAME zlib_example COMMAND zlib_example)

    add_executable(minigzip minigzip.c)
    target_compile_definitions(
        minigzip PRIVATE $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
    target_link_libraries(minigzip ZLIB::ZLIB)

    if(MSVC
       OR MSYS
       OR MINGW
       OR CYGWIN)
        zlib_findtestenv(zlib_example)
    endif(
        MSVC
        OR MSYS
        OR MINGW
        OR CYGWIN)

    if(HAVE_OFF64_T)
        add_executable(zlib_example64 example.c)
        target_compile_definitions(
            zlib_example64
            PRIVATE ZLIB_BUILD
                    $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
        target_link_libraries(zlib_example64 ZLIB::ZLIB)
        add_test(NAME zlib_example64 COMMAND zlib_example64)

        if(MSVC
           OR MSYS
           OR MINGW
           OR CYGWIN)
            zlib_findtestenv(zlib_example64)
        endif(
            MSVC
            OR MSYS
            OR MINGW
            OR CYGWIN)
    endif(HAVE_OFF64_T)
endif(ZLIB_BUILD_SHARED)

if(ZLIB_BUILD_STATIC)
    add_executable(zlib_static_example example.c)
    target_link_libraries(zlib_static_example ZLIB::ZLIBSTATIC)
    target_compile_definitions(
        zlib_static_example
        PRIVATE ZLIB_BUILD
                $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
    add_test(NAME zlib_static_example COMMAND zlib_static_example)

    add_executable(static_minigzip minigzip.c)
    target_link_libraries(static_minigzip ZLIB::ZLIBSTATIC)

    if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID} STREQUAL
                                                "Clang")
        set(CFLAGS_OLD ${CMAKE_C_FLAGS})
        set(CMAKE_C_FLAGS
            ""
            CACHE STRING "" FORCE)

        if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
            find_program(GCOV_EXECUTABLE gcov)
        endif(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")

        if(${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
            set(llvm_names llvm_cov)
            list(APPEND llvm_names llvm-cov)

            foreach(ver RANGE 11 99)
                list(APPEND llvm_names llvm-cov-${ver})
            endforeach(ver RANGE 11 99)

            find_program(GCOV_EXECUTABLE NAMES ${llvm_names})
            set(llvm_option "gcov")
        endif(${CMAKE_C_COMPILER_ID} STREQUAL "Clang")

        add_executable(infcover infcover.c)
        target_link_libraries(infcover ZLIB::ZLIBSTATIC)
        target_compile_options(infcover PRIVATE -coverage)
        target_link_options(infcover PRIVATE -coverage)
        target_compile_definitions(
            infcover PRIVATE $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
        add_test(NAME zlib_coverage COMMAND infcover)
        set(INFCOVER_DIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/infcover.dir)
        add_test(
            NAME zlib_coverage-summary
            COMMAND
                ${GCOV_EXECUTABLE} ${llvm_option}
                ${CMAKE_CURRENT_SOURCE_DIR}/infcover.c -o
                ${INFCOVER_DIR}/infcover.c.gcda)
        set_tests_properties(zlib_coverage-summary PROPERTIES DEPENDS
                                                              zlib-coverage)
        set(CMAKE_C_FLAGS
            ${CFLAGS_OLD}
            CACHE STRING "" FORCE)
    endif(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID}
                                                   STREQUAL "Clang")

    if(HAVE_OFF64_T)
        add_executable(zlib_static_example64 example.c)
        target_compile_definitions(
            zlib_static_example64
            PRIVATE ZLIB_BUILD
                    $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
        target_link_libraries(zlib_static_example64 ZLIB::ZLIBSTATIC)
        add_test(NAME zlib_static_example64 COMMAND zlib_static_example64)
    endif(HAVE_OFF64_T)
endif(ZLIB_BUILD_STATIC)

add_test(
    NAME zlib_install
    COMMAND ${CMAKE_COMMAND} --install ${zlib_BINARY_DIR} --prefix
            ${CMAKE_CURRENT_BINARY_DIR}/test_install --config $<CONFIG>
    WORKING_DIRECTORY ${zlib_BINARY_DIR})

set_tests_properties(zlib_install PROPERTIES FIXTURES_SETUP zlib_install)

file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/find_package_no_components_test)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/find_package_wrong_components_test)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)

configure_file(
    ${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in
    ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test/CMakeLists.txt @@ONLY)

configure_file(
    ${CMAKE_CURRENT_SOURCE_DIR}/find_package_no_components_test.cmake.in
    ${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test/CMakeLists.txt @@ONLY)

configure_file(
    ${CMAKE_CURRENT_SOURCE_DIR}/find_package_wrong_components_test.cmake.in
    ${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test/CMakeLists.txt @@ONLY)

configure_file(
    ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_test.cmake.in
    ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test/CMakeLists.txt @@ONLY)

configure_file(
    ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_exclude_test.cmake.in
    ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test/CMakeLists.txt
    @@ONLY)

# CMAKE_GENERATOR_PLATFORM doesn't work in the if
set(GENERATOR ${CMAKE_GENERATOR_PLATFORM})

if(GENERATOR)
    set(PLATFORM "-A ${GENERATOR}")
endif(GENERATOR)
#
# findpackage_test
#
add_test(
    NAME zlib_find_package_configure
    COMMAND
        ${CMAKE_COMMAND} ${PLATFORM}
        -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build
        -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
        -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
        -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install --fresh
        -G "${CMAKE_GENERATOR}" -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)

add_test(
    NAME zlib_find_package_build
    COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build)

add_test(
    NAME zlib_find_package_test
    COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build)

set_tests_properties(
    zlib_find_package_configure PROPERTIES FIXTURES_REQUIRED zlib_install
                                           FIXTURES_SETUP fp_config)

set_tests_properties(
    zlib_find_package_build PROPERTIES FIXTURES_REQUIRED fp_config
                                       FIXTURES_SETUP fp_build)

set_tests_properties(
    zlib_find_package_test PROPERTIES FIXTURES_REQUIRED fp_build ENVIRONMENT
                                      CTEST_OUTPUT_ON_FAILURE=1)

#
# findpackage_no_components_test
#
add_test(
    NAME zlib_find_package_no_components_configure
    COMMAND
        ${CMAKE_COMMAND} ${PLATFORM}
        -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test_build
        -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
        -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
        -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install --fresh
        -G "${CMAKE_GENERATOR}"
        -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test)

set_tests_properties(
    zlib_find_package_no_components_configure
        PROPERTIES FIXTURES_REQUIRED zlib_install)

if(NOT ZLIB_BUILD_SHARED OR NOT ZLIB_BUILD_STATIC)
    set_tests_properties(
        zlib_find_package_no_components_configure
            PROPERTIES WILL_FAIL TRUE)
endif(NOT ZLIB_BUILD_SHARED OR NOT ZLIB_BUILD_STATIC)

#
# findpackage_no_component_test
#
add_test(
    NAME zlib_find_package_wrong_components_configure
    COMMAND
        ${CMAKE_COMMAND} ${PLATFORM}
        -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test_build
        -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
        -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
        -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install --fresh
        -G "${CMAKE_GENERATOR}"
        -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test)

set_tests_properties(
    zlib_find_package_wrong_components_configure
        PROPERTIES FIXTURES_REQUIRED zlib_install
                   WILL_FAIL TRUE)

#
# add_subdirectory_test
#
add_test(
    NAME zlib_add_subdirectory_configure
    COMMAND
        ${CMAKE_COMMAND} ${PLATFORM}
        -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build
        -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
        -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
        -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install --fresh
        -G "${CMAKE_GENERATOR}" -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)

add_test(
    NAME zlib_add_subdirectory_build
    COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build)

add_test(
    NAME zlib_add_subdirectory_test
    COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build)

set_tests_properties(
    zlib_add_subdirectory_configure PROPERTIES FIXTURES_REQUIRED zlib_install
                                               FIXTURES_SETUP as_config)

set_tests_properties(
    zlib_add_subdirectory_build PROPERTIES FIXTURES_REQUIRED as_config
                                           FIXTURES_SETUP as_build)

set_tests_properties(
    zlib_add_subdirectory_test PROPERTIES FIXTURES_REQUIRED as_build
                                          ENVIRONMENT CTEST_OUTPUT_ON_FAILURE=1)

#
# add_subdirectory_exclude_test
#
add_test(
    NAME zlib_add_subdirectory_exclude_configure
    COMMAND
        ${CMAKE_COMMAND} ${PLATFORM}
        -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build
        -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
        -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
        -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install --fresh
        -G "${CMAKE_GENERATOR}" -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)

add_test(
    NAME zlib_add_subdirectory_exclude_build
    COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
    WORKING_DIRECTORY
        ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build)

add_test(
    NAME zlib_add_subdirectory_exclude_test
    COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>
    WORKING_DIRECTORY
        ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build)

set_tests_properties(
    zlib_add_subdirectory_exclude_configure
    PROPERTIES FIXTURES_REQUIRED zlib_install FIXTURES_SETUP asx_config)

set_tests_properties(
    zlib_add_subdirectory_exclude_build PROPERTIES FIXTURES_REQUIRED as_config
                                                   FIXTURES_SETUP asx_build)

set_tests_properties(
    zlib_add_subdirectory_exclude_test
    PROPERTIES FIXTURES_REQUIRED asx_build ENVIRONMENT
               CTEST_OUTPUT_ON_FAILURE=1)
@


1.1.1.1
log
@import zlib-1.3.2 (previous was 1.3.1)


Version 1.3.2 has these key updates from 1.3.1:

    Address findings of the 7ASecurity audit of zlib.
	Check for negative lengths in crc32_combine functions.
	Copy only the initialized window contents in inflateCopy.
	Prevent the use of insecure functions without an explicit request.
	Add compressBound_z and deflateBound_z functions for large values.
	Use atomics to build inflate fixed tables once.
	Add --undefined option to ./configure for UBSan checker.
	Copy only the initialized deflate state in deflateCopy.
	Zero inflate state on allocation.
	Add compress_z and uncompress_z functions.
    Complete rewrite of cmake support.
    Remove untgz from contrib.
    Vectorize the CRC-32 calculation on the s390x.
    Remove vstudio projects in lieu of cmake-generated projects.
    Add zipAlreadyThere() to minizip zip.c to help avoid duplicates.
    Add deflateUsed() function to get the used bits in the last byte.
    Fix bug in inflatePrime() for 16-bit ints.
    Add a "G" option to force gzip, disabling transparency in gzread().
    Return all available uncompressed data on error in gzread.c.
    Support non-blocking devices in the gz* routines.
@
text
@@


1.1.1.2
log
@Import zlib-1.4.0 (previous was 1.3.2) to address CVE-2026-85091

Breaking changes
- CMake:
  - The minimum CMake version is now 3.15, up from 3.12.
  - Library file names changed on MSVC: z is now libz, as in libz.dll,
    libz.lib, and the static libzs.lib. minizip's libraries changed the
    same way.
  - On Cygwin, the libraries now use the lib prefix.
  - Contrib targets and tests built as part of zlib are now prefixed with
    zlib_. Several test targets were renamed to one scheme, for example
    zlib_examplestatic and minigzipstatic.
  - The zlib1.dll option ENABLE_BZIP2 is now ZLIB1_DLL_ENABLE_BZIP2.
- When not otherwise determined, z_off_t is again long, as in 1.3.1, instead
  of 1.3.2's long long. Windows applications built with 1.3.2 headers should
  be recompiled; see Enhancements for 64-bit offsets.
- deflateReset() now resets the gzip header set by deflateSetHeader(), as
  zlib.h has always said. Code relying on the header persisting must set
  it again.
- Raw deflate that completes exactly at the end of the output buffer now
  returns Z_STREAM_END instead of Z_OK, as documented.
- gzopen() with "x" now fails where O_EXCL isn't available, instead of
  truncating an existing file (Trail of Bits TOB-ZLIB-009).
- gzip reading now delivers the data decompressed before a read error, and
  only then reports the error.

Security fixes
- Non-blocking gzwrite() had a buffer overflow; CVE-2026-85091 (reported by
  mat-mo; also TOB-ZLIB-003).
- inflateGetDictionary() could write up to 8 MB past the caller's 32K buffer
  (Theorem THM-ZLIB-001). This took a zlib header with an invalid window
  size, then inflateReset() or inflateSync(). Affects 1.2.8 through 1.3.2.
- inflateSync() before the window size was known allocated a one-byte
  window that could later be overrun (TOB-ZLIB-004).
- inflatePrime() could lead inflate() to read before the start of the input
  (TOB-ZLIB-014).
- Repeated deflatePrime() calls could write past the pending buffer
  (TOB-ZLIB-013).
- inflateBack() failed to detect distances too far back, and copied
  uninitialized memory to the output (reported by Kornel Lesiński).
- gzseek() forward before any data was written could write uninitialized
  memory to the gzip output (found by Claude Opus 5.5).
- deflateResetKeep() used mid-stream could read outside the window
  (reported by Jason Gross).
- gzdopen() now sets close-on-exec with the correct flag (TOB-ZLIB-008).
- minizip:
  - A double free in block_central_name() (reported by Oculytic), and a
    NULL dereference on repeated zipAlreadyThere() calls after a bad central
    directory (reported by Naveed Khan).
  - Validation of extra-field sizes, plus portable, alignment-safe reading,
    in zipRemoveExtraInfoBlock() (reported by Naveed Khan and jmestwa-coder).
  - unzip no longer reads Zip64 values from outside their extra-field
    record (reported by Mohamed Elnady). It also uses only the Zip64 locator
    immediately before the end of central directory record (reported by
    snajafov). Crafted archives could make minizip report different entries
    than other readers.
  - miniunz could create directories outside the extraction directory
    (reported by Naveed Khan), and on Windows write files anywhere
    (reported by Trail of Bits). Fixed by Naveed Khan. Path names are now
    processed by component.
- contrib/infback9: removed out-of-bounds pointer arithmetic in inftree9.c;
  CVE-2026-4738 (fix by npt-1707, submitted by CrossVR). The pointers return
  in bounds before use and no known compiler mishandles this, so the
  critical rating overstates it, though it could trap on capability hardware
  such as CHERI.

Bug fixes
- gzip reading:
  - Restored the detection of truncated gzip streams, part of which was lost
    in 1.3.2. Also fixed a complete stream being reported as truncated.
  - An error in the first member is no longer treated as trailing garbage.
  - Corrected pending-skip handling in gz_skip(), gzdirect() and forced
    seeks at EOF.
  - gzgets() now returns an empty string when promised.
- gzip writing:
  - Successive SEEK_CUR seeks no longer lose zero fill.
  - Zero fill is now handled correctly after a write error.
  - gzprintf() is now all-or-nothing when blocked, and is no longer a stub
    when compiled as C++.
  - gzseek() leaves the position unchanged on failure.
  - gzopen_w() now works with paths not representable in the locale.
- inflate:
  - total_in was short six bytes on Z_NEED_DICT.
  - inflateReset() now restores the requested window size, and the wrap
    after inflateSync().
  - inflateSetDictionary() rejects a null dictionary.
  - With PKZIP_BUG_WORKAROUND, the code tables were slightly too small.
- deflate:
  - A bad deflateSetDictionary() call is now detected as promised.
  - A failed deflateCopy() or inflateCopy() leaves the destination safe to
    end.
  - Removed a possible overflow in deflate_stored() comparisons.
- Undefined behavior removed in gzwrite.c, gzseek, gz_vacate() and mztools.c.
- minizip:
  - zip.c no longer writes corrupt headers when a Zip64 field overflows an
    extra field (reported by mzfr and itsgaldoron), or for Zip64 entries
    with file comments.
  - zipOpen3() no longer leaks memory or returns a freed comment pointer on
    failure.
  - Added allocation checks.
- Build:
  - configure now builds the shared library with linkers such as lld that
    reject undefined symbols in zlib.map, including for --solo.
  - zlib.h no longer depends on NULL being defined.
  - zip.c builds with NO_ADDFILEINEXISTINGZIP.
  - The test programs use the generated zconf.h when building out of tree.
- Many CMake fixes: pkg-config files, installation of headers and of
  minizip's configuration, symbol prefixing, assembler detection, and
  parallel testing. It also works with CMake 4.

Enhancements
- 64-bit offsets on Windows with MSVC or MinGW, by compiling the
  application with _FILE_OFFSET_BITS=64 or _LARGEFILE64_SOURCE. The library
  itself needs no changes.
- Platforms:
  - Android large file support.
  - An export list on AIX.
  - -Wno-psabi, only where the PowerPC note would appear.
  - s390x VGFMAFLAG in configure.
  - Win32 Makefile.msc builds for ARM64.
  - minigzip's mmap code uses POSIX types.
- CMake:
  - Package components, with _FOUND variables.
  - Installation and export of zlib1.dll and zlibwapi.dll.
  - Contribs build standalone, with zlib's defaults.
  - Tests consolidated, and tests on Windows.
- minizip:
  - The traditional encryption header uses a PCG generator instead of
    rand().
  - Fewer compiler warnings.
- Documentation:
  - Clarified that undocumented functions are not part of the API.
  - inflateGetHeader() header reuse.
  - deflateBound() and deflateSetDictionary() ordering.
  - The application's responsibilities in unzip.h.

Known issues
- contrib/iostream2 is unsafe on untrusted input (reported by Trail of
  Bits). When reading a string, it uses the length stored in the compressed
  data without checking it, so a crafted file can write past the end of the
  destination buffer. Use contrib/iostream3 instead.
@
text
@d20 1
a20 1
    add_test(NAME zlib_example COMMAND zlib_example zlib_example.gz)
d45 1
a45 1
        add_test(NAME zlib_example64 COMMAND zlib_example64 zlib_example64.gz)
d61 2
a62 2
    add_executable(zlib_examplestatic example.c)
    target_link_libraries(zlib_examplestatic ZLIB::ZLIBSTATIC)
d64 1
a64 1
        zlib_examplestatic
d67 1
a67 1
    add_test(NAME zlib_examplestatic COMMAND zlib_examplestatic zlib_examplestatic.gz)
d69 2
a70 2
    add_executable(minigzipstatic minigzip.c)
    target_link_libraries(minigzipstatic ZLIB::ZLIBSTATIC)
d72 2
a73 2
    if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR
       ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
d83 1
a83 2
        if(${CMAKE_C_COMPILER_ID} STREQUAL "Clang"
           AND NOT CMAKE_CROSSCOMPILING)
d93 1
a93 2
        endif(${CMAKE_C_COMPILER_ID} STREQUAL "Clang"
              AND NOT CMAKE_CROSSCOMPILING)
d109 2
a110 3
        set_tests_properties(zlib_coverage-summary
            PROPERTIES
                DEPENDS zlib-coverage)
d114 2
a115 2
    endif(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR
          ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
d118 7
a124 7
        add_executable(zlib_example64static example.c)
        target_compile_definitions(zlib_example64static
            PRIVATE
                ZLIB_BUILD
                $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
        target_link_libraries(zlib_example64static ZLIB::ZLIBSTATIC)
        add_test(NAME zlib_example64static COMMAND zlib_example64static zlib_example64static.gz)
d130 2
a131 4
    COMMAND ${CMAKE_COMMAND}
            --install ${zlib_BINARY_DIR}
            --prefix ${CMAKE_CURRENT_BINARY_DIR}/test_install
            --config $<CONFIG>
d136 6
d144 1
a144 1
    ${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_test/CMakeLists.txt @@ONLY)
d148 1
a148 1
    ${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_no_components_test/CMakeLists.txt @@ONLY)
d152 1
a152 1
    ${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_wrong_components_test/CMakeLists.txt @@ONLY)
d156 1
a156 1
    ${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_test/CMakeLists.txt @@ONLY)
d160 1
a160 1
    ${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_exclude_test/CMakeLists.txt
d170 1
a170 1
# find_package_test
d175 3
a177 5
        ${CMAKE_COMMAND}
        ${PLATFORM}
        -B${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_test_build
        -DCMAKE_BUILD_TYPE=$<CONFIG>
        -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
d179 2
a180 6
        "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
        "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
        -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install
        $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
        -G "${CMAKE_GENERATOR}"
        -S${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_test)
d185 1
a185 1
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_test_build)
d190 1
a190 1
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_test_build)
d192 11
a202 15
set_tests_properties(zlib_find_package_configure
    PROPERTIES
        FIXTURES_REQUIRED zlib_install
        FIXTURES_SETUP fp_config)

set_tests_properties(zlib_find_package_build
    PROPERTIES
        FIXTURES_REQUIRED fp_config
        FIXTURES_SETUP fp_build)

set_tests_properties(zlib_find_package_test
    PROPERTIES
        FIXTURES_REQUIRED fp_build
        ENVIRONMENT
        CTEST_OUTPUT_ON_FAILURE=1)
d205 1
a205 1
# find_package_no_components_test
d210 3
a212 5
        ${CMAKE_COMMAND}
        ${PLATFORM}
        -B${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_no_components_test_build
        -DCMAKE_BUILD_TYPE=$<CONFIG>
        -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
d214 1
a214 4
        "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
        "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
        -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install
        $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
d216 1
a216 1
        -S${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_no_components_test)
d218 3
a220 3
set_tests_properties(zlib_find_package_no_components_configure
    PROPERTIES
        FIXTURES_REQUIRED zlib_install)
d223 3
a225 3
    set_tests_properties(zlib_find_package_no_components_configure
        PROPERTIES
            WILL_FAIL TRUE)
d229 1
a229 1
# find_package_wrong_component_test
d234 3
a236 5
        ${CMAKE_COMMAND}
        ${PLATFORM}
        -B${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_wrong_components_test_build
        -DCMAKE_BUILD_TYPE=$<CONFIG>
        -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
d238 1
a238 4
        "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
        "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
        -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install
        $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
d240 1
a240 1
        -S${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_wrong_components_test)
d242 4
a245 4
set_tests_properties(zlib_find_package_wrong_components_configure
    PROPERTIES
        FIXTURES_REQUIRED zlib_install
        WILL_FAIL TRUE)
d253 3
a255 5
        ${CMAKE_COMMAND}
        ${PLATFORM}
        -B${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_test_build
        -DCMAKE_BUILD_TYPE=$<CONFIG>
        -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
d257 2
a258 6
        "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
        "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
        -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install
        $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
        -G "${CMAKE_GENERATOR}"
        -S${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_test)
d263 1
a263 1
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_test_build)
d268 1
a268 1
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_test_build)
d270 11
a280 15
set_tests_properties(zlib_add_subdirectory_configure
    PROPERTIES
        FIXTURES_REQUIRED zlib_install
        FIXTURES_SETUP as_config)

set_tests_properties(zlib_add_subdirectory_build
    PROPERTIES
        FIXTURES_REQUIRED as_config
        FIXTURES_SETUP as_build)

set_tests_properties(zlib_add_subdirectory_test
    PROPERTIES
        FIXTURES_REQUIRED as_build
        ENVIRONMENT
        CTEST_OUTPUT_ON_FAILURE=1)
d288 3
a290 5
        ${CMAKE_COMMAND}
        ${PLATFORM}
        -B${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_exclude_test_build
        -DCMAKE_BUILD_TYPE=$<CONFIG>
        -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
d292 2
a293 6
        "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
        "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
        -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install
        $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
        -G "${CMAKE_GENERATOR}"
        -S${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_exclude_test)
d299 1
a299 1
        ${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_exclude_test_build)
d305 1
a305 1
        ${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_exclude_test_build)
d307 12
a318 15
set_tests_properties(zlib_add_subdirectory_exclude_configure
    PROPERTIES
        FIXTURES_REQUIRED zlib_install
        FIXTURES_SETUP asx_config)

set_tests_properties(zlib_add_subdirectory_exclude_build
    PROPERTIES
        FIXTURES_REQUIRED asx_config
        FIXTURES_SETUP asx_build)

set_tests_properties(zlib_add_subdirectory_exclude_test
    PROPERTIES
        FIXTURES_REQUIRED asx_build
        ENVIRONMENT
        CTEST_OUTPUT_ON_FAILURE=1)
@


1.1.1.1.2.1
log
@file CMakeLists.txt was added on branch perseant-exfatfs on 2026-11-04 22:36:25 +0000
@
text
@d1 318
@


1.1.1.1.2.2
log
@Sync with HEAD
@
text
@a0 318
function(ZLIB_findTestEnv testName)
    set(testEnv "PATH=")

    if(MSVC OR MINGW)
        set(separator "\\\;")
    else()
        set(separator ":")
    endif()

    string(APPEND testEnv "$<TARGET_FILE_DIR:ZLIB::ZLIB>${separator}")
    string(APPEND testEnv "$ENV{PATH}")

    set_tests_properties(${testName} PROPERTIES ENVIRONMENT "${testEnv}")
endfunction()

if(ZLIB_BUILD_SHARED)
    add_executable(zlib_example example.c)
    target_link_libraries(zlib_example ZLIB::ZLIB)
    target_compile_definitions(zlib_example PRIVATE ZLIB_BUILD)
    add_test(NAME zlib_example COMMAND zlib_example)

    add_executable(minigzip minigzip.c)
    target_compile_definitions(
        minigzip PRIVATE $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
    target_link_libraries(minigzip ZLIB::ZLIB)

    if(MSVC
       OR MSYS
       OR MINGW
       OR CYGWIN)
        zlib_findtestenv(zlib_example)
    endif(
        MSVC
        OR MSYS
        OR MINGW
        OR CYGWIN)

    if(HAVE_OFF64_T)
        add_executable(zlib_example64 example.c)
        target_compile_definitions(
            zlib_example64
            PRIVATE ZLIB_BUILD
                    $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
        target_link_libraries(zlib_example64 ZLIB::ZLIB)
        add_test(NAME zlib_example64 COMMAND zlib_example64)

        if(MSVC
           OR MSYS
           OR MINGW
           OR CYGWIN)
            zlib_findtestenv(zlib_example64)
        endif(
            MSVC
            OR MSYS
            OR MINGW
            OR CYGWIN)
    endif(HAVE_OFF64_T)
endif(ZLIB_BUILD_SHARED)

if(ZLIB_BUILD_STATIC)
    add_executable(zlib_static_example example.c)
    target_link_libraries(zlib_static_example ZLIB::ZLIBSTATIC)
    target_compile_definitions(
        zlib_static_example
        PRIVATE ZLIB_BUILD
                $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
    add_test(NAME zlib_static_example COMMAND zlib_static_example)

    add_executable(static_minigzip minigzip.c)
    target_link_libraries(static_minigzip ZLIB::ZLIBSTATIC)

    if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID} STREQUAL
                                                "Clang")
        set(CFLAGS_OLD ${CMAKE_C_FLAGS})
        set(CMAKE_C_FLAGS
            ""
            CACHE STRING "" FORCE)

        if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
            find_program(GCOV_EXECUTABLE gcov)
        endif(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")

        if(${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
            set(llvm_names llvm_cov)
            list(APPEND llvm_names llvm-cov)

            foreach(ver RANGE 11 99)
                list(APPEND llvm_names llvm-cov-${ver})
            endforeach(ver RANGE 11 99)

            find_program(GCOV_EXECUTABLE NAMES ${llvm_names})
            set(llvm_option "gcov")
        endif(${CMAKE_C_COMPILER_ID} STREQUAL "Clang")

        add_executable(infcover infcover.c)
        target_link_libraries(infcover ZLIB::ZLIBSTATIC)
        target_compile_options(infcover PRIVATE -coverage)
        target_link_options(infcover PRIVATE -coverage)
        target_compile_definitions(
            infcover PRIVATE $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
        add_test(NAME zlib_coverage COMMAND infcover)
        set(INFCOVER_DIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/infcover.dir)
        add_test(
            NAME zlib_coverage-summary
            COMMAND
                ${GCOV_EXECUTABLE} ${llvm_option}
                ${CMAKE_CURRENT_SOURCE_DIR}/infcover.c -o
                ${INFCOVER_DIR}/infcover.c.gcda)
        set_tests_properties(zlib_coverage-summary PROPERTIES DEPENDS
                                                              zlib-coverage)
        set(CMAKE_C_FLAGS
            ${CFLAGS_OLD}
            CACHE STRING "" FORCE)
    endif(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID}
                                                   STREQUAL "Clang")

    if(HAVE_OFF64_T)
        add_executable(zlib_static_example64 example.c)
        target_compile_definitions(
            zlib_static_example64
            PRIVATE ZLIB_BUILD
                    $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
        target_link_libraries(zlib_static_example64 ZLIB::ZLIBSTATIC)
        add_test(NAME zlib_static_example64 COMMAND zlib_static_example64)
    endif(HAVE_OFF64_T)
endif(ZLIB_BUILD_STATIC)

add_test(
    NAME zlib_install
    COMMAND ${CMAKE_COMMAND} --install ${zlib_BINARY_DIR} --prefix
            ${CMAKE_CURRENT_BINARY_DIR}/test_install --config $<CONFIG>
    WORKING_DIRECTORY ${zlib_BINARY_DIR})

set_tests_properties(zlib_install PROPERTIES FIXTURES_SETUP zlib_install)

file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/find_package_no_components_test)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/find_package_wrong_components_test)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)

configure_file(
    ${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in
    ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test/CMakeLists.txt @@ONLY)

configure_file(
    ${CMAKE_CURRENT_SOURCE_DIR}/find_package_no_components_test.cmake.in
    ${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test/CMakeLists.txt @@ONLY)

configure_file(
    ${CMAKE_CURRENT_SOURCE_DIR}/find_package_wrong_components_test.cmake.in
    ${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test/CMakeLists.txt @@ONLY)

configure_file(
    ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_test.cmake.in
    ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test/CMakeLists.txt @@ONLY)

configure_file(
    ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_exclude_test.cmake.in
    ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test/CMakeLists.txt
    @@ONLY)

# CMAKE_GENERATOR_PLATFORM doesn't work in the if
set(GENERATOR ${CMAKE_GENERATOR_PLATFORM})

if(GENERATOR)
    set(PLATFORM "-A ${GENERATOR}")
endif(GENERATOR)
#
# findpackage_test
#
add_test(
    NAME zlib_find_package_configure
    COMMAND
        ${CMAKE_COMMAND} ${PLATFORM}
        -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build
        -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
        -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
        -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install --fresh
        -G "${CMAKE_GENERATOR}" -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)

add_test(
    NAME zlib_find_package_build
    COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build)

add_test(
    NAME zlib_find_package_test
    COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build)

set_tests_properties(
    zlib_find_package_configure PROPERTIES FIXTURES_REQUIRED zlib_install
                                           FIXTURES_SETUP fp_config)

set_tests_properties(
    zlib_find_package_build PROPERTIES FIXTURES_REQUIRED fp_config
                                       FIXTURES_SETUP fp_build)

set_tests_properties(
    zlib_find_package_test PROPERTIES FIXTURES_REQUIRED fp_build ENVIRONMENT
                                      CTEST_OUTPUT_ON_FAILURE=1)

#
# findpackage_no_components_test
#
add_test(
    NAME zlib_find_package_no_components_configure
    COMMAND
        ${CMAKE_COMMAND} ${PLATFORM}
        -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test_build
        -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
        -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
        -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install --fresh
        -G "${CMAKE_GENERATOR}"
        -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test)

set_tests_properties(
    zlib_find_package_no_components_configure
        PROPERTIES FIXTURES_REQUIRED zlib_install)

if(NOT ZLIB_BUILD_SHARED OR NOT ZLIB_BUILD_STATIC)
    set_tests_properties(
        zlib_find_package_no_components_configure
            PROPERTIES WILL_FAIL TRUE)
endif(NOT ZLIB_BUILD_SHARED OR NOT ZLIB_BUILD_STATIC)

#
# findpackage_no_component_test
#
add_test(
    NAME zlib_find_package_wrong_components_configure
    COMMAND
        ${CMAKE_COMMAND} ${PLATFORM}
        -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test_build
        -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
        -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
        -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install --fresh
        -G "${CMAKE_GENERATOR}"
        -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test)

set_tests_properties(
    zlib_find_package_wrong_components_configure
        PROPERTIES FIXTURES_REQUIRED zlib_install
                   WILL_FAIL TRUE)

#
# add_subdirectory_test
#
add_test(
    NAME zlib_add_subdirectory_configure
    COMMAND
        ${CMAKE_COMMAND} ${PLATFORM}
        -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build
        -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
        -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
        -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install --fresh
        -G "${CMAKE_GENERATOR}" -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)

add_test(
    NAME zlib_add_subdirectory_build
    COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build)

add_test(
    NAME zlib_add_subdirectory_test
    COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build)

set_tests_properties(
    zlib_add_subdirectory_configure PROPERTIES FIXTURES_REQUIRED zlib_install
                                               FIXTURES_SETUP as_config)

set_tests_properties(
    zlib_add_subdirectory_build PROPERTIES FIXTURES_REQUIRED as_config
                                           FIXTURES_SETUP as_build)

set_tests_properties(
    zlib_add_subdirectory_test PROPERTIES FIXTURES_REQUIRED as_build
                                          ENVIRONMENT CTEST_OUTPUT_ON_FAILURE=1)

#
# add_subdirectory_exclude_test
#
add_test(
    NAME zlib_add_subdirectory_exclude_configure
    COMMAND
        ${CMAKE_COMMAND} ${PLATFORM}
        -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build
        -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
        -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
        -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install --fresh
        -G "${CMAKE_GENERATOR}" -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)

add_test(
    NAME zlib_add_subdirectory_exclude_build
    COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
    WORKING_DIRECTORY
        ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build)

add_test(
    NAME zlib_add_subdirectory_exclude_test
    COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>
    WORKING_DIRECTORY
        ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build)

set_tests_properties(
    zlib_add_subdirectory_exclude_configure
    PROPERTIES FIXTURES_REQUIRED zlib_install FIXTURES_SETUP asx_config)

set_tests_properties(
    zlib_add_subdirectory_exclude_build PROPERTIES FIXTURES_REQUIRED as_config
                                                   FIXTURES_SETUP asx_build)

set_tests_properties(
    zlib_add_subdirectory_exclude_test
    PROPERTIES FIXTURES_REQUIRED asx_build ENVIRONMENT
               CTEST_OUTPUT_ON_FAILURE=1)
@


