From 4b039cd6e05436bb3f4410e9b0c7c5bddf166cc1 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 6 Sep 2023 14:59:03 +0800 Subject: [PATCH] fixed #16190: Compilation errors if using Clang 15 with c++17 since std::unary_function has been removed (#16191) * fixed #16190: Compilation errors if using Clang 15 with c++17 since std::unary_function has been removed * Windows doesn't need to define BOOST_NO_CXX98_FUNCTION_BASE since it has already been defined. --- native/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/native/CMakeLists.txt b/native/CMakeLists.txt index 5e8077fcb6c..3b76038ed4f 100644 --- a/native/CMakeLists.txt +++ b/native/CMakeLists.txt @@ -83,6 +83,13 @@ if(USE_SERVER_MODE) add_definitions(-DCC_SERVER_MODE) endif() +# Fix the issue: https://github.com/cocos/cocos-engine/issues/16190 +# std::unary_function was removed since clang 15 +# The macro has already been defined in boost/config/stdlib/dinkumware.hpp(258,1), +# so no need to define it again to avoid 'macro redefinition' error. +if(NOT WINDOWS) + add_definitions(-DBOOST_NO_CXX98_FUNCTION_BASE) +endif() add_definitions(-DCC_NETMODE_CLIENT=0) add_definitions(-DCC_NETMODE_LISTEN_SERVER=1)