diff --git a/CMakeLists.txt b/CMakeLists.txt index 74408df80..09cbac97e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -272,7 +272,9 @@ link_directories(${PROJECT_BINARY_DIR}) # Load all of our third party directories add_subdirectory(thirdparty) - +if (UNIX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") +endif() # Glob together all headers that need to be precompiled file( GLOB HEADERS_DDATABASE diff --git a/dCommon/CMakeLists.txt b/dCommon/CMakeLists.txt index 5300a4f27..fec1a2d70 100644 --- a/dCommon/CMakeLists.txt +++ b/dCommon/CMakeLists.txt @@ -20,6 +20,12 @@ set(DCOMMON_SOURCES "FdbToSqlite.cpp" ) +# Workaround for compiler bug where the optimized code could result in a memcpy of 0 bytes, even though that isnt possible. +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97185 +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set_source_files_properties("FdbToSqlite.cpp" PROPERTIES COMPILE_FLAGS "-Wno-stringop-overflow") +endif() + add_subdirectory(dClient) foreach(file ${DCOMMON_DCLIENT_SOURCES}) diff --git a/dGame/dInventory/CMakeLists.txt b/dGame/dInventory/CMakeLists.txt index a663a97d4..bc741efe9 100644 --- a/dGame/dInventory/CMakeLists.txt +++ b/dGame/dInventory/CMakeLists.txt @@ -5,5 +5,11 @@ set(DGAME_DINVENTORY_SOURCES "ItemSet.cpp" "ItemSetPassiveAbility.cpp") +# Workaround for compiler bug where the optimized code could result in a memcpy of 0 bytes, even though that isnt possible. +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97185 +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set_source_files_properties("Item.cpp" PROPERTIES COMPILE_FLAGS "-Wno-stringop-overflow") +endif() + add_library(dInventory STATIC ${DGAME_DINVENTORY_SOURCES}) target_precompile_headers(dInventory REUSE_FROM dGameBase) diff --git a/thirdparty/SQLite/CMakeLists.txt b/thirdparty/SQLite/CMakeLists.txt index aa7a64230..ba45f0152 100644 --- a/thirdparty/SQLite/CMakeLists.txt +++ b/thirdparty/SQLite/CMakeLists.txt @@ -10,5 +10,10 @@ if(UNIX) target_link_libraries(sqlite3 pthread dl m) # -Wno-unused-result -Wno-unknown-pragmas -fpermissive - target_compile_options(sqlite3 PRIVATE "-Wno-return-local-addr" "-Wno-maybe-uninitialized") + target_compile_options(sqlite3 PRIVATE) + if(NOT APPLE) + target_compile_options(sqlite3 PRIVATE "-Wno-return-local-addr" "-Wno-maybe-uninitialized") + else() + target_compile_options(sqlite3 PRIVATE "-Wno-return-stack-address" "-Wno-uninitialized") + endif() endif()