Skip to content
Permalink
Browse files
Fix build error under clang on Mac
- Remove APPLE_CLANG_WARNINGS option
- Add warnings via flags instead of definitions
  • Loading branch information
dakcarto committed Feb 3, 2013
1 parent ba6189c commit 8e7db454a1046edcc27d4fd82ee95f21450142f2
Showing with 13 additions and 10 deletions.
  1. +13 −6 CMakeLists.txt
  2. +0 −4 src/plugins/grass/CMakeLists.txt
@@ -117,10 +117,6 @@ ENDIF (WITH_GLOBE)
# Compile flag. Make it possible to turn it off.
SET (PEDANTIC TRUE CACHE BOOL "Determines if we should compile in pedantic mode.")

# whether the compiler front-end is clang on Apple (Mac OS X 10.7+)
SET (APPLE_CLANG (APPLE AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"))
SET (APPLE_CLANG_WARNINGS TRUE CACHE BOOL "Whether to show extra compiler warnings on Mac from clang front-end not shown in gcc front-end builds")

# whether unit tests should be build
SET (ENABLE_TESTS TRUE CACHE BOOL "Build unit tests?")

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

IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
ADD_DEFINITIONS(-Wno-return-type-c-linkage) # used in plugins and providers
IF (APPLE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-return-type-c-linkage")
ELSE (APPLE)
ADD_DEFINITIONS(-Wno-return-type-c-linkage) # used in plugins and providers
ENDIF (APPLE)
ENDIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
ENDIF (MSVC)

@@ -11,10 +11,6 @@ ELSE (WIN32)
ADD_DEFINITIONS(-DHAVE_POSIX_OPENPT)
ENDIF (WIN32)

IF (APPLE_CLANG AND NOT APPLE_CLANG_WARNINGS)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-mismatched-tags ")
ENDIF (APPLE_CLANG AND NOT APPLE_CLANG_WARNINGS)

########################################################
# Files

0 comments on commit 8e7db45

Please sign in to comment.