diff options
author | Kargatum <dowlandtop@yandex.com> | 2021-07-25 06:54:02 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-25 01:54:02 +0200 |
commit | 7f6e9b1984e7e5c68136d8b8f4a43befc8b09f8c (patch) | |
tree | 7450e2753d53c20f971a270b1e5fef89f2df84ec /src/cmake | |
parent | 608e01d59c053abdc32dc0016d80fc2d208339d8 (diff) |
feat(CMake): enable optional C++20 support (#7075)
Diffstat (limited to 'src/cmake')
-rw-r--r-- | src/cmake/macros/ConfigureBaseTargets.cmake | 37 | ||||
-rw-r--r-- | src/cmake/showoptions.cmake | 6 |
2 files changed, 18 insertions, 25 deletions
diff --git a/src/cmake/macros/ConfigureBaseTargets.cmake b/src/cmake/macros/ConfigureBaseTargets.cmake index 693f4e8f6c..2a713429b0 100644 --- a/src/cmake/macros/ConfigureBaseTargets.cmake +++ b/src/cmake/macros/ConfigureBaseTargets.cmake @@ -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) @@ -75,4 +62,4 @@ add_library(acore-core-interface INTERFACE) target_link_libraries(acore-core-interface INTERFACE acore-default-interface - acore-warning-interface)
\ No newline at end of file + acore-warning-interface) diff --git a/src/cmake/showoptions.cmake b/src/cmake/showoptions.cmake index b2e4ee88fb..2e248c95cb 100644 --- a/src/cmake/showoptions.cmake +++ b/src/cmake/showoptions.cmake @@ -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("") |