chore(cmake): update compiler flag settings in utils.cmake
- Modified the yaze_add_compiler_flags function to set C++ and C standards in the parent scope, ensuring they are applied correctly across the project. - Added a new compiler flag for MSVC to support C++20/23 features, enhancing compatibility with modern C++ standards. Benefits: - Improved consistency in compiler settings across different CMake targets. - Enhanced support for newer C++ features, facilitating modern development practices.
This commit is contained in:
@@ -7,11 +7,12 @@
|
||||
# Also handles platform-specific and compiler-specific flags.
|
||||
# ============================================================================
|
||||
function(yaze_add_compiler_flags)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
# Set C++ and C standards in parent scope
|
||||
set(CMAKE_CXX_STANDARD 23 PARENT_SCOPE)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON PARENT_SCOPE)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF PARENT_SCOPE)
|
||||
set(CMAKE_C_STANDARD 99 PARENT_SCOPE)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON PARENT_SCOPE)
|
||||
|
||||
if(YAZE_SUPPRESS_WARNINGS)
|
||||
if(MSVC)
|
||||
@@ -44,6 +45,7 @@ function(yaze_add_compiler_flags)
|
||||
/W4 /permissive-
|
||||
/bigobj
|
||||
/utf-8
|
||||
/std:c++latest # Required for C++20/23 features like std::span
|
||||
)
|
||||
target_compile_definitions(yaze_common INTERFACE
|
||||
_CRT_SECURE_NO_WARNINGS
|
||||
|
||||
Reference in New Issue
Block a user