Skip to content

Commit

Permalink
Workaround broken MinGW installation on AppVeyor (#355)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Jul 16, 2016
1 parent d4885ce commit 1acfd07
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions support/appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ build_script:
on_failure:
- appveyor PushArtifact Testing/Temporary/LastTest.log
- appveyor AddTest test

# Uncomment this to debug AppVeyor failures.
#on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
14 changes: 11 additions & 3 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,19 @@ if (CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
set(PEDANTIC_COMPILE_FLAGS -Wall -Wextra -Wno-long-long -Wno-variadic-macros)
endif ()

function(add_fmt_executable name)
add_executable(${name} ${ARGN})
if (MINGW)
target_link_libraries(${name} -static-libgcc -static-libstdc++)
endif ()
endfunction()

# Adds a test.
# Usage: add_fmt_test(name srcs...)
function(add_fmt_test name)
add_executable(${name} ${name}.cc ${ARGN})
add_fmt_executable(${name} ${name}.cc ${ARGN})
target_link_libraries(${name} test-main)

# define if certain c++ features can be used
target_compile_definitions(${name} PRIVATE
FMT_USE_TYPE_TRAITS=$<BOOL:${SUPPORTS_TYPE_TRAITS}>
Expand Down Expand Up @@ -89,7 +97,7 @@ if (FMT_PEDANTIC AND MSVC)
endif ()

if (HAVE_OPEN)
add_executable(posix-mock-test
add_fmt_executable(posix-mock-test
posix-mock-test.cc ../fmt/format.cc ${TEST_MAIN_SRC})
target_include_directories(posix-mock-test PRIVATE ${PROJECT_SOURCE_DIR})
target_compile_definitions(posix-mock-test PRIVATE FMT_USE_FILE_DESCRIPTORS=1)
Expand All @@ -98,7 +106,7 @@ if (HAVE_OPEN)
add_fmt_test(posix-test)
endif ()

add_executable(header-only-test
add_fmt_executable(header-only-test
header-only-test.cc header-only-test2.cc test-main.cc)
target_link_libraries(header-only-test gmock)
if (TARGET fmt-header-only)
Expand Down

0 comments on commit 1acfd07

Please sign in to comment.