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.
This commit is contained in:
Nico Weber 2020-06-05 21:23:31 -04:00 committed by Andreas Kling
parent 9de92ae4c1
commit e162b59a5e
Notes: sideshowbarker 2024-07-19 05:48:44 +09:00

View File

@ -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