mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
feat(CMake): enable optional C++20 support (#7075)
This commit is contained in:
3
conf/dist/config.cmake
vendored
3
conf/dist/config.cmake
vendored
@@ -84,3 +84,6 @@ endif()
|
||||
# Source tree in IDE
|
||||
set(WITH_SOURCE_TREE "hierarchical" CACHE STRING "Build the source tree for IDE's.")
|
||||
set_property(CACHE WITH_SOURCE_TREE PROPERTY STRINGS no flat hierarchical)
|
||||
|
||||
# If disable - use c++17
|
||||
option(USE_CPP_20 "Enable c++20 standard" 0)
|
||||
|
||||
@@ -9,28 +9,15 @@ add_library(acore-compile-option-interface INTERFACE)
|
||||
# Use -std=c++11 instead of -std=gnu++11
|
||||
set(CXX_EXTENSIONS OFF)
|
||||
|
||||
# Enable support С++17
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
message(STATUS "Enabled С++17 support")
|
||||
|
||||
# An interface library to make the target features available to other targets
|
||||
add_library(acore-feature-interface INTERFACE)
|
||||
|
||||
target_compile_features(acore-feature-interface
|
||||
INTERFACE
|
||||
cxx_alias_templates
|
||||
cxx_auto_type
|
||||
cxx_constexpr
|
||||
cxx_decltype
|
||||
cxx_decltype_auto
|
||||
cxx_final
|
||||
cxx_lambdas
|
||||
cxx_generic_lambdas
|
||||
cxx_variadic_templates
|
||||
cxx_defaulted_functions
|
||||
cxx_nullptr
|
||||
cxx_trailing_return_types
|
||||
cxx_return_type_deduction)
|
||||
if (USE_CPP_20)
|
||||
# Enable support С++20
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
message(STATUS "Enabled С++20 standard")
|
||||
else()
|
||||
# Enable support С++17
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
message(STATUS "Enabled С++17 standard")
|
||||
endif()
|
||||
|
||||
# An interface library to make the warnings level available to other targets
|
||||
# This interface taget is set-up through the platform specific script
|
||||
@@ -38,10 +25,10 @@ add_library(acore-warning-interface INTERFACE)
|
||||
|
||||
# An interface used for all other interfaces
|
||||
add_library(acore-default-interface INTERFACE)
|
||||
|
||||
target_link_libraries(acore-default-interface
|
||||
INTERFACE
|
||||
acore-compile-option-interface
|
||||
acore-feature-interface)
|
||||
acore-compile-option-interface)
|
||||
|
||||
# An interface used for silencing all warnings
|
||||
add_library(acore-no-warning-interface INTERFACE)
|
||||
|
||||
@@ -158,4 +158,10 @@ if(BUILD_SHARED_LIBS)
|
||||
WarnAboutSpacesInBuildPath()
|
||||
endif()
|
||||
|
||||
if (USE_CPP_20)
|
||||
message("")
|
||||
message(" *** Enabled C++20 standart")
|
||||
message(" *** Please note that this is an experimental feature!")
|
||||
endif()
|
||||
|
||||
message("")
|
||||
|
||||
Reference in New Issue
Block a user