From c6caf2d7d400efea31c597b11a03332c0e66003c Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Tue, 29 Sep 2020 20:58:25 +0100 Subject: [PATCH] reproc: Fix tests compilation error on Mingw --- cmake/reproc.cmake | 6 ++++++ reproc/test/assert.h | 2 -- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cmake/reproc.cmake b/cmake/reproc.cmake index e9b23d79f..d0efafc04 100644 --- a/cmake/reproc.cmake +++ b/cmake/reproc.cmake @@ -341,6 +341,12 @@ function(reproc_test TARGET NAME LANGUAGE) reproc_common(${TARGET}-test-${NAME} ${LANGUAGE} ${NAME} test) target_link_libraries(${TARGET}-test-${NAME} PRIVATE ${TARGET}) + if(MINGW) + target_compile_definitions(${TARGET}-test-${NAME} PRIVATE + __USE_MINGW_ANSI_STDIO=1 # Add %zu on Mingw + ) + endif() + add_test(NAME ${TARGET}-test-${NAME} COMMAND ${TARGET}-test-${NAME}) if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/resources/${NAME}.c) diff --git a/reproc/test/assert.h b/reproc/test/assert.h index 9422af0fa..ea0d0a9c8 100644 --- a/reproc/test/assert.h +++ b/reproc/test/assert.h @@ -1,7 +1,5 @@ #pragma once -#define __USE_MINGW_ANSI_STDIO 1 // Add %zu on MinGW. - #include #include #include