From e162b59a5eff529d99308915dd4067e71361d172 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Fri, 5 Jun 2020 21:23:31 -0400 Subject: [PATCH] cmake: Make setting CMAKE_BUILD_TYPE an error. I tried setting it to Release, then noticed that it didn't build due to gcc's optimizer-level dependent warnings and -Werror, then started fixing the warnings for a bit (all false positives), then looked at the global CMakeLists.txt and realized that the default build is aleady using compiler optimizations. It looks like people aren't supposed to change this, so make that explicit to be friendly to people familiar with cmake but new to serenity. --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2929f2b92a..0fdeac7740 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,13 @@ cmake_minimum_required(VERSION 3.16) project(SerenityOS C CXX ASM) +if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "") + message(FATAL + ": Don't use CMAKE_BUILD_TYPE when building serenity.\n" + "The default build type is optimized with debug info and asserts enabled,\n" + "and that's all there is.") +endif() + enable_testing() add_custom_target(image