From 74d95c7ee8badd8c7198445a628fe2a153f871d5 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Fri, 18 Sep 2015 05:16:57 +0000 Subject: [PATCH] build: make -Wno-invalid-offsetof more specific --- CMakeLists.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c5b396..32b3500 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -357,9 +357,6 @@ IF(CMAKE_COMPILER_IS_GNUCC) ADD_DEFINITIONS(-fno-stack-protector) ENDIF(AQUARIA_GCC_HAS_STACKPROT) - # We knowingly apply offsetof to non-POD types. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-offsetof") - # -O3 breaks on some GCC/MinGW versions, make sure CMake does not set this as default. # Exceptions are not used, excluding support for release builds adds less bulk as well. set(CMAKE_C_FLAGS_RELEASE "-O2" CACHE STRING "Flags used for release builds" FORCE) @@ -451,6 +448,14 @@ SET(AQUARIA_SRCS_UNUSED ${SRCDIR}/WaterFont.cpp ) +IF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) +SET_SOURCE_FILES_PROPERTIES( + # We knowingly apply offsetof to non-POD types. + ${SRCDIR}/ScriptInterface.cpp + PROPERTIES COMPILE_FLAGS "-Wno-invalid-offsetof" +) +ENDIF() + IF(MACOSX) IF(NOT AQUARIA_USE_SDL2) SET(COCOA_SRCS "${BBGEDIR}/Cocoa.mm")