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 <lpetrut@cloudbasesolutions.com>
This commit is contained in:
Lucian Petrut 2020-01-14 07:14:06 +00:00
parent 7ad3015f5b
commit dc0f5c5167

View File

@ -15,6 +15,16 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
message(STATUS "CMake version: ${CMAKE_VERSION}") message(STATUS "CMake version: ${CMAKE_VERSION}")
endif () 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}. # Joins arguments and places the results in ${result_var}.
function(join result_var) function(join result_var)
set(result ) set(result )