Skip to content

Commit 41517ea

Browse files
committedDec 1, 2023
CMake: Remove hardcoded warnings list and forcing -Werror on library builds
The CMake buildsystem should be completely reviewed to properly match what is done by SCons, instead of making its own arbitrary decisions on how godot-cpp should be compiled. Currently the SCons setup doesn't include warning options, so CMake shouldn't either. Options similar to upstream Godot's SCons setup could be added, and then replicated for CMake.
1 parent 17137b2 commit 41517ea

File tree

2 files changed

+0
-33
lines changed

2 files changed

+0
-33
lines changed
 

‎CMakeLists.txt

-11
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ option(GODOT_CPP_WARNING_AS_ERROR "Treat warnings as errors" OFF)
4747
# Add path to modules
4848
list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/" )
4949

50-
# Check if we are building ourself or being included
51-
if(${PROJECT_NAME} STREQUAL ${CMAKE_PROJECT_NAME})
52-
set(GODOT_CPP_BUILDING_SELF ON)
53-
endif()
54-
5550
# Set some helper variables for readability
5651
set( compiler_is_clang "$<OR:$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:Clang>>" )
5752
set( compiler_is_gnu "$<CXX_COMPILER_ID:GNU>" )
@@ -158,12 +153,6 @@ add_library(godot::cpp ALIAS ${PROJECT_NAME})
158153

159154
include(GodotCompilerWarnings)
160155

161-
# Treat warnings as errors if we are building ourself
162-
if(GODOT_CPP_BUILDING_SELF)
163-
unset( GODOT_CPP_WARNING_AS_ERROR CACHE )
164-
set_warning_as_error()
165-
endif()
166-
167156
target_compile_features(${PROJECT_NAME}
168157
PRIVATE
169158
cxx_std_17

‎test/CMakeLists.txt

-22
Original file line numberDiff line numberDiff line change
@@ -59,31 +59,9 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
5959

6060
else()
6161

62-
#elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
63-
# using Clang
64-
#elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
65-
# using GCC and maybe MinGW?
66-
6762
set(GODOT_LINKER_FLAGS "-static-libgcc -static-libstdc++ -Wl,-R,'$$ORIGIN'")
6863

69-
# Hmm.. maybe to strikt?
7064
set(GODOT_COMPILE_FLAGS "-fPIC -g -Wwrite-strings")
71-
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -Wchar-subscripts -Wcomment -Wdisabled-optimization")
72-
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -Wformat -Wformat=2 -Wformat-security -Wformat-y2k")
73-
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -Wimport -Winit-self -Winline -Winvalid-pch -Werror")
74-
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -Wmissing-braces -Wmissing-format-attribute")
75-
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -Wmissing-include-dirs -Wmissing-noreturn -Wpacked -Wpointer-arith")
76-
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -Wredundant-decls -Wreturn-type -Wsequence-point")
77-
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -Wswitch -Wswitch-enum -Wtrigraphs")
78-
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -Wuninitialized -Wunknown-pragmas -Wunreachable-code -Wunused-label")
79-
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -Wunused-value -Wvariadic-macros -Wvolatile-register-var -Wno-error=attributes")
80-
81-
# -Wshadow -Wextra -Wall -Weffc++ -Wfloat-equal -Wstack-protector -Wunused-parameter -Wsign-compare -Wunused-variable -Wcast-align
82-
# -Wunused-function -Wstrict-aliasing -Wstrict-aliasing=2 -Wmissing-field-initializers
83-
84-
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Android")
85-
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -Wno-ignored-attributes")
86-
endif()
8765

8866
if(CMAKE_BUILD_TYPE MATCHES Debug)
8967
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -fno-omit-frame-pointer -O0")

0 commit comments

Comments
 (0)