Skip to content

Commit 8a880ca

Browse files
committed
use CMAKE_*_FLAGS also on unix
1 parent 7f7b5dd commit 8a880ca

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

CMakeLists.txt

+6-13
Original file line numberDiff line numberDiff line change
@@ -304,24 +304,17 @@ IF (PEDANTIC)
304304
ADD_DEFINITIONS( /wd4610 ) # user defined constructor required (sqlite3_index_info)
305305
ADD_DEFINITIONS( /wd4706 ) # assignment within conditional expression (pal)
306306
ELSE (MSVC)
307-
IF (APPLE)
308-
# add warnings via flags instead of definitions on Mac (otherwise -Wall can not be overridden per language)
309-
SET(_warnings "-Wall -Wextra -Wno-long-long -Wformat-security -Wno-strict-aliasing")
310-
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_warnings}")
311-
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_warnings}")
312-
ELSE (APPLE)
313-
ADD_DEFINITIONS( -Wall -Wextra -Wno-long-long -Wformat-security -Wno-strict-aliasing )
314-
ENDIF (APPLE)
307+
# add warnings via flags (not as definitions as on Mac -Wall can not be overridden per language )
308+
SET(_warnings "-Wall -Wextra -Wno-long-long -Wformat-security -Wno-strict-aliasing")
309+
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_warnings}")
310+
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_warnings}")
311+
315312
# Qt produces lots of warnings with strict aliasing (as of Qt 4.4.0 & GCC 4.3)
316313
# There are redundant declarations in Qt and GDAL
317314
# ADD_DEFINITIONS( -fstrict-aliasing -Wstrict-aliasing=1 -Wredundant-decls )
318315

319316
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
320-
IF (APPLE)
321-
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-return-type-c-linkage")
322-
ELSE (APPLE)
323-
ADD_DEFINITIONS(-Wno-return-type-c-linkage) # used in plugins and providers
324-
ENDIF (APPLE)
317+
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-return-type-c-linkage")
325318
ENDIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
326319
ENDIF (MSVC)
327320

0 commit comments

Comments
 (0)