Skip to content

Commit

Permalink
reproc: Fix tests compilation error on Mingw
Browse files Browse the repository at this point in the history
  • Loading branch information
DaanDeMeyer committed Sep 29, 2020
1 parent 79ff812 commit c6caf2d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 6 additions & 0 deletions cmake/reproc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions reproc/test/assert.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#pragma once

#define __USE_MINGW_ANSI_STDIO 1 // Add %zu on MinGW.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down

0 comments on commit c6caf2d

Please sign in to comment.