diff --git a/CMakeLists.txt b/CMakeLists.txt
index ba349c3664c..a4fbce11b03 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -430,6 +430,8 @@ check_compiler_has_flag(
HAS_COMPILER_FLAG_WCONDITIONAL_INITIALIZED
)
+set(CXX_FLAGS_PROJECT "${CXX_FLAGS_PROJECT} -include boost-patched/bind/arg.hpp")
+
### Set the final compiler flags.
set(COMPILER_FLAGS "${CXX_FLAGS_PROJECT}")
diff --git a/projectfiles/VC12/wesnoth.vcxproj b/projectfiles/VC12/wesnoth.vcxproj
index 427dcf4c829..9d012ce5e0a 100644
--- a/projectfiles/VC12/wesnoth.vcxproj
+++ b/projectfiles/VC12/wesnoth.vcxproj
@@ -148,6 +148,7 @@
EditAndContinue
4503;4127;4512;4003;4068;%(DisableSpecificWarnings)
true
+ boost-patched/bind/arg.hpp;%(ForcedIncludeFiles)
_MSC_VER;%(PreprocessorDefinitions)
@@ -184,6 +185,7 @@
ProgramDatabase
true
4503
+ boost-patched/bind/arg.hpp;%(ForcedIncludeFiles)
_MSC_VER;%(PreprocessorDefinitions)
@@ -226,6 +228,7 @@
EditAndContinue
4503;4127;4512;%(DisableSpecificWarnings)
true
+ boost-patched/bind/arg.hpp;%(ForcedIncludeFiles)
_MSC_VER;%(PreprocessorDefinitions)
@@ -258,6 +261,7 @@
EditAndContinue
4503;4127;4512;%(DisableSpecificWarnings)
true
+ boost-patched/bind/arg.hpp;%(ForcedIncludeFiles)
_MSC_VER;%(PreprocessorDefinitions)
@@ -293,6 +297,7 @@
ProgramDatabase
true
4503
+ boost-patched/bind/arg.hpp;%(ForcedIncludeFiles)
_MSC_VER;%(PreprocessorDefinitions)
@@ -338,6 +343,7 @@
ProgramDatabase
true
4503
+ boost-patched/bind/arg.hpp;%(ForcedIncludeFiles)
_MSC_VER;%(PreprocessorDefinitions)
diff --git a/projectfiles/VC12/wesnothd.vcxproj b/projectfiles/VC12/wesnothd.vcxproj
index 1262a6d5754..275733ba53f 100644
--- a/projectfiles/VC12/wesnothd.vcxproj
+++ b/projectfiles/VC12/wesnothd.vcxproj
@@ -113,6 +113,7 @@
EditAndContinue
4503;4127;4512;4003;4068;%(DisableSpecificWarnings)
true
+ boost-patched/bind/arg.hpp;%(ForcedIncludeFiles)
/SAFESEH:NO %(AdditionalOptions)
@@ -138,6 +139,7 @@
Level3
ProgramDatabase
4503
+ boost-patched/bind/arg.hpp;%(ForcedIncludeFiles)
SDL2main.lib;SDL2.lib;SDL2_net.lib;winmm.lib;ws2_32.lib;Shlwapi.lib;%(AdditionalDependencies)
@@ -165,6 +167,7 @@
Level4
EditAndContinue
4503;4127;4512;%(DisableSpecificWarnings)
+ boost-patched/bind/arg.hpp;%(ForcedIncludeFiles)
SDL2main.lib;SDL2.lib;SDL2_net.lib;winmm.lib;ws2_32.lib;Shlwapi.lib;%(AdditionalDependencies)
@@ -189,6 +192,7 @@
Level3
ProgramDatabase
4503
+ boost-patched/bind/arg.hpp;%(ForcedIncludeFiles)
SDL2main.lib;SDL2.lib;SDL2_net.lib;winmm.lib;ws2_32.lib;Shlwapi.lib;%(AdditionalDependencies)
diff --git a/projectfiles/VC12/wesnothlib.vcxproj b/projectfiles/VC12/wesnothlib.vcxproj
index 09cf1f5be19..345fa947210 100644
--- a/projectfiles/VC12/wesnothlib.vcxproj
+++ b/projectfiles/VC12/wesnothlib.vcxproj
@@ -95,6 +95,7 @@
EditAndContinue
4503;4127;4512;4003;4068;%(DisableSpecificWarnings)
true
+ boost-patched/bind/arg.hpp;%(ForcedIncludeFiles)
..\..\..\external\lib;%(AdditionalLibraryDirectories)
@@ -116,6 +117,7 @@
ProgramDatabase
true
4503
+ boost-patched/bind/arg.hpp;%(ForcedIncludeFiles)
..\..\..\external\lib;%(AdditionalLibraryDirectories)
@@ -136,6 +138,7 @@
EditAndContinue
4503;4127;4512;%(DisableSpecificWarnings)
true
+ boost-patched/bind/arg.hpp;%(ForcedIncludeFiles)
..\..\..\external\lib;%(AdditionalLibraryDirectories)
@@ -157,6 +160,7 @@
ProgramDatabase
true
4503
+ boost-patched/bind/arg.hpp;%(ForcedIncludeFiles)
..\..\..\external\lib;%(AdditionalLibraryDirectories)
diff --git a/src/SConscript b/src/SConscript
index 610de49b4ec..61e900d036f 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -6,6 +6,10 @@ from glob import glob
Import("*")
+# Inject boost::bind patch everywhere
+for env in [test_env, client_env, env]:
+ env.Append(CCFLAGS = Split("-include boost-patched/bind/arg.hpp"))
+
for env in [test_env, client_env, env]:
env.Append(CPPDEFINES = "$EXTRA_DEFINE")
diff --git a/src/boost-patched/bind/arg.hpp b/src/boost-patched/bind/arg.hpp
new file mode 100644
index 00000000000..3adbeb9efb4
--- /dev/null
+++ b/src/boost-patched/bind/arg.hpp
@@ -0,0 +1,84 @@
+#ifdef __cplusplus
+
+#include
+#if (BOOST_VERSION >= 106000) && (BOOST_VERSION <= 106200)
+
+#ifndef BOOST_BIND_ARG_HPP_INCLUDED
+#define BOOST_BIND_ARG_HPP_INCLUDED
+
+/*
+** See https://svn.boost.org/trac/boost/ticket/12397
+** Patch applied https://github.com/boostorg/bind/commit/3c56630b5400c43d1a4393d685a407e68a69ce9e
+** GL 2016-10-12
+*/
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+//
+// bind/arg.hpp
+//
+// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/bind/bind.html for documentation.
+//
+
+#include
+#include
+
+namespace boost
+{
+
+template< int I, int J > struct _arg_eq
+{
+};
+
+template< int I > struct _arg_eq< I, I>
+{
+ typedef void type;
+};
+
+template< int I > struct arg
+{
+ BOOST_CONSTEXPR arg()
+ {
+ }
+
+ template< class T > BOOST_CONSTEXPR arg( T const & /* t */, typename _arg_eq< I, is_placeholder::value >::type * = 0 )
+ {
+ }
+};
+
+template< int I > BOOST_CONSTEXPR bool operator==( arg const &, arg const & )
+{
+ return true;
+}
+
+#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
+
+template< int I > struct is_placeholder< arg >
+{
+ enum _vt { value = I };
+};
+
+template< int I > struct is_placeholder< arg (*) () >
+{
+ enum _vt { value = I };
+};
+
+#endif
+
+} // namespace boost
+
+#endif // #ifndef BOOST_BIND_ARG_HPP_INCLUDED
+
+#endif // BOOST_VERSION checks
+
+#endif // __cplusplus