How to upgrade C++ version for cocos2d-x-4.0?

Hello, I am trying to integrate gtest to one of my project. While compiling it gives me the following error:

…/googletest/googletest/include/gtest/internal/gtest-port.h:280:2: error: #error C++ versions less than C++14 are not supported.
[build] #error C++ versions less than C++14 are not supported.

Is there any way we can upgrade the c++ version of the cocos2d-x project?

Try adding this to your CMakeLists.txt:

# These must be set AFTER the "include(CocosBuildSet)" statement,  
# otherwise these settings will be overwritten
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

You can also force cocos2d to use C++14:

set_target_properties(cocos2d PROPERTIES
    CXX_STANDARD 14
    CXX_STANDARD_REQUIRED YES
    CXX_EXTENSIONS NO
)

It worked, Thanks!!