mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
CMake: Use add_compile_options instead of appending to CMAKE_CXX_FLAGS
Problem: - Appending to CMAKE_CXX_FLAGS for everything is cumbersome. Solution: - Use the `add_compile_options` built-in function to handle adding compiler options (and even de-duplicating).
This commit is contained in:
parent
ded0b5a93c
commit
6fac1abac4
Notes:
sideshowbarker
2024-07-19 00:41:13 +09:00
Author: https://github.com/ldm5180 Commit: https://github.com/SerenityOS/serenity/commit/6fac1abac49 Pull-request: https://github.com/SerenityOS/serenity/pull/4485
1 changed files with 7 additions and 6 deletions
|
@ -46,11 +46,12 @@ 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")
|
||||
add_compile_options(-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")
|
||||
add_compile_options(-fconcepts)
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-overloaded-virtual")
|
||||
add_compile_options(-Wno-overloaded-virtual)
|
||||
endif()
|
||||
|
||||
if (ALL_THE_DEBUG_MACROS)
|
||||
|
@ -264,10 +265,10 @@ set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared")
|
|||
|
||||
#FIXME: -fstack-protector
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Os -g1 -fno-exceptions -fno-rtti -Wno-address-of-packed-member -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough -Wno-nonnull-compare -Wno-deprecated-copy -Wno-expansion-to-defined")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffile-prefix-map=${CMAKE_SOURCE_DIR}=.")
|
||||
add_compile_options(-Os -g1 -fno-exceptions -fno-rtti -Wno-address-of-packed-member -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough -Wno-nonnull-compare -Wno-deprecated-copy -Wno-expansion-to-defined)
|
||||
add_compile_options(-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEBUG -DSANITIZE_PTRS")
|
||||
add_compile_definitions(DEBUG SANITIZE_PTRS)
|
||||
set(CMAKE_CXX_FLAGS_STATIC "${CMAKE_CXX_FLAGS} -static")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostartfiles -pie -fpic")
|
||||
|
||||
|
|
Loading…
Reference in a new issue