aboutsummaryrefslogtreecommitdiff
path: root/contrib/minizip/test/add_subdirectory_test.cmake.in
blob: fc2a9e0cb0ae0574309f315afe1495216f997848 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
cmake_minimum_required(VERSION 3.12)

project(zlib_find_package_test
    LANGUAGES C
    VERSION ${zlib_VERSION})

enable_testing()
set(ZLIB_BUILD_TESTING OFF)
add_subdirectory(${zlib_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/zlib)

if(${ZLIB_BUILD_SHARED})
    add_executable(test_example ${zlib_SOURCE_DIR}/test/example.c)
    target_link_libraries(test_example ZLIB::ZLIB)

    if(NOT ${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL ".dll")
        add_test(NAME zlib_test_example_shared COMMAND test_example)
    endif(NOT ${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL ".dll")
endif(${ZLIB_BUILD_SHARED})

if(${ZLIB_BUILD_STATIC})
    add_executable(test_example_static ${zlib_SOURCE_DIR}/test/example.c)
    target_link_libraries(test_example_static ZLIB::ZLIBSTATIC)
    add_test(NAME zlib_test_example_static
        COMMAND test_example_static)
endif(${ZLIB_BUILD_STATIC})