summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorMichel Hermier <michel.hermier@gmail.com>2021-03-28 16:48:37 +0200
committerAndreas Kling <kling@serenityos.org>2021-03-28 20:40:12 +0200
commitd927b69082180c03d02bf380cdd0583bb2e63b9c (patch)
tree1e03a4e9791cc41ab61b38f8284ab30f65c4668c /CMakeLists.txt
parenta208cc3169f5569194e0cce77db058ee01d60fc4 (diff)
downloadserenity-d927b69082180c03d02bf380cdd0583bb2e63b9c.zip
cmake: Tidy compiler options.
Prior to this patch there was some long line of unreadable compiler options. Now the long lines are deduplicated and there is only one option per line to ease reading/maintenance.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt34
1 files changed, 27 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8dc8790af2..985ce1c050 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -138,22 +138,42 @@ set(CMAKE_CXX_LINK_FLAGS "-Wl,--hash-style=gnu,-z,relro,-z,now,-z,noexecstack")
# This will need to be revisited when the Loader supports RPATH/RUN_PATH.
set(CMAKE_SKIP_RPATH TRUE)
-if (${CMAKE_HOST_SYSTEM_NAME} MATCHES SerenityOS)
+add_compile_options(-Wformat=2)
+add_compile_options(-fdiagnostics-color=always)
+
+if (NOT ${CMAKE_HOST_SYSTEM_NAME} MATCHES SerenityOS)
# FIXME: Something makes this go crazy and flag unused variables that aren't flagged as such when building with the toolchain.
# Disable -Werror for now.
- add_compile_options(-Wno-unknown-warning-option -Wall -Wextra -Wmissing-declarations -Wformat=2 -fdiagnostics-color=always)
-else()
- add_compile_options(-Wno-unknown-warning-option -Wall -Wextra -Werror -Wmissing-declarations -Wformat=2 -fdiagnostics-color=always)
+ add_compile_options(-Werror)
endif()
-add_compile_options(-g1 -fno-exceptions -fstack-protector-strong -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(-Wall)
+add_compile_options(-Wextra)
+
+add_compile_options(-Wno-address-of-packed-member)
+add_compile_options(-Wcast-qual)
+add_compile_options(-Wno-deprecated-copy)
+add_compile_options(-Wno-expansion-to-defined)
+add_compile_options(-Wimplicit-fallthrough)
+add_compile_options(-Wmissing-declarations)
+add_compile_options(-Wno-nonnull-compare)
+add_compile_options(-Wno-unknown-warning-option)
+add_compile_options(-Wundef)
+add_compile_options(-Wwrite-strings)
+
add_compile_options(-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.)
+add_compile_options(-fno-exceptions)
+add_compile_options(-fstack-protector-strong)
+add_compile_options(-g1)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
- add_compile_options(-fconcepts -Wno-literal-suffix)
+ add_compile_options(-Wno-literal-suffix)
+
+ add_compile_options(-fconcepts)
add_compile_options(-fstack-clash-protection)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
- add_compile_options(-Wno-overloaded-virtual -Wno-user-defined-literals)
+ add_compile_options(-Wno-overloaded-virtual)
+ add_compile_options(-Wno-user-defined-literals)
endif()
add_compile_definitions(DEBUG SANITIZE_PTRS)