diff --git a/cmake/zint_add_test.cmake b/cmake/zint_add_test.cmake index a0276ce8..372b34fa 100644 --- a/cmake/zint_add_test.cmake +++ b/cmake/zint_add_test.cmake @@ -1,4 +1,4 @@ -# Copyright (C) 2021-23 Robin Stuart +# Copyright (C) 2021-2024 Robin Stuart # Adapted from qrencode/tests/CMakeLists.txt # Copyright (C) 2006-2017 Kentaro Fukuchi # vim: set ts=4 sw=4 et : @@ -8,6 +8,9 @@ macro(zint_add_test test_name test_command) if(ZINT_SHARED) add_executable(${test_command} ${test_command}.c) target_link_libraries(${test_command} testcommon ${ADDITIONAL_LIBS}) + if(NOT (ZINT_USE_PNG AND PNG_FOUND)) + target_compile_definitions(${test_command} PRIVATE ZINT_NO_PNG) + endif() add_test(${test_name} ${test_command}) if(MSVC) set_tests_properties(${test_name} PROPERTIES ENVIRONMENT @@ -20,6 +23,9 @@ macro(zint_add_test test_name test_command) if(ZINT_STATIC) add_executable(${test_command}-static ${test_command}.c) target_link_libraries(${test_command}-static testcommon-static ${ADDITIONAL_LIBS}) + if(NOT (ZINT_USE_PNG AND PNG_FOUND)) + target_compile_definitions(${test_command}-static PRIVATE ZINT_NO_PNG) + endif() add_test(${test_name}-static ${test_command}-static) if(MSVC) set_tests_properties(${test_name}-static PROPERTIES ENVIRONMENT