Commit 1acfd07f authored by Victor Zverovich's avatar Victor Zverovich

Workaround broken MinGW installation on AppVeyor (#355)

parent d4885cea
...@@ -20,3 +20,7 @@ build_script: ...@@ -20,3 +20,7 @@ build_script:
on_failure: on_failure:
- appveyor PushArtifact Testing/Temporary/LastTest.log - appveyor PushArtifact Testing/Temporary/LastTest.log
- appveyor AddTest test - 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'))
...@@ -56,11 +56,19 @@ if (CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) ...@@ -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) set(PEDANTIC_COMPILE_FLAGS -Wall -Wextra -Wno-long-long -Wno-variadic-macros)
endif () 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. # Adds a test.
# Usage: add_fmt_test(name srcs...) # Usage: add_fmt_test(name srcs...)
function(add_fmt_test name) function(add_fmt_test name)
add_executable(${name} ${name}.cc ${ARGN}) add_fmt_executable(${name} ${name}.cc ${ARGN})
target_link_libraries(${name} test-main) target_link_libraries(${name} test-main)
# define if certain c++ features can be used # define if certain c++ features can be used
target_compile_definitions(${name} PRIVATE target_compile_definitions(${name} PRIVATE
FMT_USE_TYPE_TRAITS=$<BOOL:${SUPPORTS_TYPE_TRAITS}> FMT_USE_TYPE_TRAITS=$<BOOL:${SUPPORTS_TYPE_TRAITS}>
...@@ -89,7 +97,7 @@ if (FMT_PEDANTIC AND MSVC) ...@@ -89,7 +97,7 @@ if (FMT_PEDANTIC AND MSVC)
endif () endif ()
if (HAVE_OPEN) if (HAVE_OPEN)
add_executable(posix-mock-test add_fmt_executable(posix-mock-test
posix-mock-test.cc ../fmt/format.cc ${TEST_MAIN_SRC}) posix-mock-test.cc ../fmt/format.cc ${TEST_MAIN_SRC})
target_include_directories(posix-mock-test PRIVATE ${PROJECT_SOURCE_DIR}) target_include_directories(posix-mock-test PRIVATE ${PROJECT_SOURCE_DIR})
target_compile_definitions(posix-mock-test PRIVATE FMT_USE_FILE_DESCRIPTORS=1) target_compile_definitions(posix-mock-test PRIVATE FMT_USE_FILE_DESCRIPTORS=1)
...@@ -98,7 +106,7 @@ if (HAVE_OPEN) ...@@ -98,7 +106,7 @@ if (HAVE_OPEN)
add_fmt_test(posix-test) add_fmt_test(posix-test)
endif () endif ()
add_executable(header-only-test add_fmt_executable(header-only-test
header-only-test.cc header-only-test2.cc test-main.cc) header-only-test.cc header-only-test2.cc test-main.cc)
target_link_libraries(header-only-test gmock) target_link_libraries(header-only-test gmock)
if (TARGET fmt-header-only) if (TARGET fmt-header-only)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment