From dc0f5c516702d55743c2de8f9b8f9201f70614cb Mon Sep 17 00:00:00 2001 From: Lucian Petrut Date: Tue, 14 Jan 2020 07:14:06 +0000 Subject: [PATCH] Fix Mingw support If _POSIX_ is set, mingw will no longer prefix *some* function names with an underscore, which is expected by libfmt. Rather than handling them case by case, we'll just avoid the POSIX macros. Signed-off-by: Lucian Petrut --- CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e24afd1..b71fd844 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,16 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) message(STATUS "CMake version: ${CMAKE_VERSION}") endif () +if(MINGW) + # If _POSIX is set, mingw will no longer prefix *some* function names with an + # underscore, which is expected by libfmt. Rather than handling them case by + # case, we'll just undefine the following. + remove_definitions(-D_POSIX=1) + remove_definitions(-D_POSIX_C_SOURCE=1) + remove_definitions(-D_POSIX_=1) + remove_definitions(-D_POSIX_THREADS=1) +endif() + # Joins arguments and places the results in ${result_var}. function(join result_var) set(result )