summaryrefslogtreecommitdiff
path: root/Meta/CMake
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2023-04-17 19:50:53 -0400
committerAndreas Kling <kling@serenityos.org>2023-04-18 10:05:49 +0200
commit8f988b7baedfedfeffb95a5fbcf7c27d25c3ac0a (patch)
tree1e485d2a265674fd9e5a218a5b8d154c1ec389de /Meta/CMake
parent5872fe6536909133e44a18ffe1871b5cd4e788e3 (diff)
downloadserenity-8f988b7baedfedfeffb95a5fbcf7c27d25c3ac0a.zip
Meta: Move more common flags to common_compile_options.cmake
For the most part no behavior change, except that we now pass -Wno-implicit-const-int-float-conversion and -Wno-literal-suffix only to clang and gcc each in both lagom and serenity builds, while we previously passed them to both in lagom builds (and passed them to one each in serenity builds). The former is a clang flag, the latter a gcc flag, but since we also use -Wno-unknown-warning-option it doesn't really matter.
Diffstat (limited to 'Meta/CMake')
-rw-r--r--Meta/CMake/common_compile_options.cmake12
-rw-r--r--Meta/CMake/lagom_compile_options.cmake2
-rw-r--r--Meta/CMake/serenity_compile_options.cmake6
3 files changed, 12 insertions, 8 deletions
diff --git a/Meta/CMake/common_compile_options.cmake b/Meta/CMake/common_compile_options.cmake
index 2c0671881b..4791f2433b 100644
--- a/Meta/CMake/common_compile_options.cmake
+++ b/Meta/CMake/common_compile_options.cmake
@@ -17,3 +17,15 @@ if (NOT CMAKE_HOST_SYSTEM_NAME MATCHES SerenityOS)
# Disable -Werror for now.
add_compile_options(-Werror)
endif()
+
+if (CMAKE_CXX_COMPILER_ID MATCHES "Clang$")
+ # Clang's default constexpr-steps limit is 1048576(2^20), GCC doesn't have one
+ add_compile_options(-fconstexpr-steps=16777216)
+
+ add_compile_options(-Wno-implicit-const-int-float-conversion)
+ add_compile_options(-Wno-user-defined-literals)
+elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ # Only ignore expansion-to-defined for g++, clang's implementation doesn't complain about function-like macros
+ add_compile_options(-Wno-expansion-to-defined)
+ add_compile_options(-Wno-literal-suffix)
+endif()
diff --git a/Meta/CMake/lagom_compile_options.cmake b/Meta/CMake/lagom_compile_options.cmake
index b784a8b94a..f65b48b5c2 100644
--- a/Meta/CMake/lagom_compile_options.cmake
+++ b/Meta/CMake/lagom_compile_options.cmake
@@ -1,7 +1,5 @@
include(${CMAKE_CURRENT_LIST_DIR}/common_compile_options.cmake)
-add_compile_options(-Wno-implicit-const-int-float-conversion)
-add_compile_options(-Wno-literal-suffix)
add_compile_options(-Wno-maybe-uninitialized)
add_compile_options(-Wno-shorten-64-to-32)
add_compile_options(-fsigned-char)
diff --git a/Meta/CMake/serenity_compile_options.cmake b/Meta/CMake/serenity_compile_options.cmake
index 19f8b45dab..6fcc971703 100644
--- a/Meta/CMake/serenity_compile_options.cmake
+++ b/Meta/CMake/serenity_compile_options.cmake
@@ -31,19 +31,13 @@ add_compile_options(-gdwarf-4)
add_compile_options(-g1)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
- add_compile_options(-Wno-literal-suffix)
add_compile_options(-Wno-maybe-uninitialized)
- # Only ignore expansion-to-defined for g++, clang's implementation doesn't complain about function-like macros
- add_compile_options(-Wno-expansion-to-defined)
add_compile_options(-Wcast-align)
add_compile_options(-Wdouble-promotion)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang$")
- add_compile_options(-Wno-user-defined-literals)
add_compile_options(-Wno-atomic-alignment)
- add_compile_options(-Wno-implicit-const-int-float-conversion)
add_compile_options(-Wno-unused-const-variable)
add_compile_options(-Wno-unused-private-field)
- add_compile_options(-fconstexpr-steps=16777216)
# Clang doesn't add compiler_rt to the search path when compiling with -nostdlib.
link_directories(${TOOLCHAIN_ROOT}/lib/clang/${CMAKE_CXX_COMPILER_VERSION}/lib/${SERENITY_ARCH}-pc-serenity/)