mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
CMake: Set C++20 mode in canonical cmake
Problem: - Setting `CMAKE_CXX_FLAGS` directly to effect the version of the C++ standard being used is no longer the recommended best practice. Solution: - Set C++20 mode in the compiler by setting `CMAKE_CXX_STANDARD`. - Force the build system generator not to fallback to the latest standard supported by the compiler by enabling `CMAKE_CXX_STANDARD_REQUIRED`. This shouldn't ever be a problem though since the toolchain is tightly controlled. - Disable GNU compiler extensions by disabling `CMAKE_CXX_EXTENSIONS` to preserve the previous flags.
This commit is contained in:
parent
0316f0627e
commit
ded0b5a93c
Notes:
sideshowbarker
2024-07-19 00:41:17 +09:00
Author: https://github.com/ldm5180 Commit: https://github.com/SerenityOS/serenity/commit/ded0b5a93c9 Pull-request: https://github.com/SerenityOS/serenity/pull/4485
1 changed files with 8 additions and 4 deletions
|
@ -42,7 +42,11 @@ add_custom_target(check-style
|
|||
USES_TERMINAL
|
||||
)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-warning-option -Wall -Wextra -Werror -Wmissing-declarations -std=c++2a -fdiagnostics-color=always -ftls-model=initial-exec")
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-warning-option -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always -ftls-model=initial-exec")
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fconcepts")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
|
|
Loading…
Reference in a new issue