Skip to content

Commit 1acfd07

Browse files
committed
Workaround broken MinGW installation on AppVeyor (fmtlib#355)
1 parent d4885ce commit 1acfd07

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

support/appveyor.yml

+4
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ build_script:
2020
on_failure:
2121
- appveyor PushArtifact Testing/Temporary/LastTest.log
2222
- appveyor AddTest test
23+
24+
# Uncomment this to debug AppVeyor failures.
25+
#on_finish:
26+
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

test/CMakeLists.txt

+11-3
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,19 @@ if (CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
5656
set(PEDANTIC_COMPILE_FLAGS -Wall -Wextra -Wno-long-long -Wno-variadic-macros)
5757
endif ()
5858

59+
function(add_fmt_executable name)
60+
add_executable(${name} ${ARGN})
61+
if (MINGW)
62+
target_link_libraries(${name} -static-libgcc -static-libstdc++)
63+
endif ()
64+
endfunction()
65+
5966
# Adds a test.
6067
# Usage: add_fmt_test(name srcs...)
6168
function(add_fmt_test name)
62-
add_executable(${name} ${name}.cc ${ARGN})
69+
add_fmt_executable(${name} ${name}.cc ${ARGN})
6370
target_link_libraries(${name} test-main)
71+
6472
# define if certain c++ features can be used
6573
target_compile_definitions(${name} PRIVATE
6674
FMT_USE_TYPE_TRAITS=$<BOOL:${SUPPORTS_TYPE_TRAITS}>
@@ -89,7 +97,7 @@ if (FMT_PEDANTIC AND MSVC)
8997
endif ()
9098

9199
if (HAVE_OPEN)
92-
add_executable(posix-mock-test
100+
add_fmt_executable(posix-mock-test
93101
posix-mock-test.cc ../fmt/format.cc ${TEST_MAIN_SRC})
94102
target_include_directories(posix-mock-test PRIVATE ${PROJECT_SOURCE_DIR})
95103
target_compile_definitions(posix-mock-test PRIVATE FMT_USE_FILE_DESCRIPTORS=1)
@@ -98,7 +106,7 @@ if (HAVE_OPEN)
98106
add_fmt_test(posix-test)
99107
endif ()
100108

101-
add_executable(header-only-test
109+
add_fmt_executable(header-only-test
102110
header-only-test.cc header-only-test2.cc test-main.cc)
103111
target_link_libraries(header-only-test gmock)
104112
if (TARGET fmt-header-only)

0 commit comments

Comments
 (0)