Skip to content
Permalink
Browse files
Add CMake option whether to show extra warnings from clang on Apple
- Set APPLE_CLANG_WARNINGS:BOOL=FALSE to not show extra warnings (TRUE by default)
  • Loading branch information
dakcarto committed Feb 1, 2013
1 parent 4889d82 commit 0866c6c08721ac57cc9d0c05d49bcb7eb8969161
Showing with 15 additions and 2 deletions.
  1. +10 −1 CMakeLists.txt
  2. +4 −0 src/plugins/grass/CMakeLists.txt
  3. +1 −1 src/plugins/grass/qtermwidget/k3processcontroller.cpp
@@ -117,6 +117,10 @@ 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?")

@@ -304,7 +308,12 @@ 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_CLANG AND NOT APPLE_CLANG_WARNINGS)
SET(CMAKE_C_FLAGS "-Wall -Wextra -Wno-long-long -Wformat-security -Wno-strict-aliasing ")
SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wno-return-type-c-linkage -Wno-overloaded-virtual ")
ELSE (APPLE_CLANG AND NOT APPLE_CLANG_WARNINGS)
ADD_DEFINITIONS( -Wall -Wextra -Wno-long-long -Wformat-security -Wno-strict-aliasing )
ENDIF (APPLE_CLANG AND NOT APPLE_CLANG_WARNINGS)
# 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 )
@@ -11,6 +11,10 @@ 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

@@ -123,7 +123,7 @@ K3ProcessController::~K3ProcessController()
close( d->fd[0] );
close( d->fd[1] );
#else
#warning FIXME: why does close() freeze up destruction?
//FIXME: why does close() freeze up destruction?
#endif

delete d;

0 comments on commit 0866c6c

Please sign in to comment.