From 9c701f10097722c102ac86b90664d199aebd683e Mon Sep 17 00:00:00 2001 From: gitlost Date: Thu, 18 Jul 2024 01:38:29 +0100 Subject: [PATCH] 2nd attempt to fix [857021] - add ZINT_NO_PNG define to tests --- cmake/zint_add_test.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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