Skip to content

Commit

Permalink
Add CMake option whether to show extra warnings from clang on Apple
Browse files Browse the repository at this point in the history
- 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 0866c6c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
11 changes: 10 additions & 1 deletion CMakeLists.txt
Expand Up @@ -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?")

Expand Down Expand Up @@ -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 )
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/grass/CMakeLists.txt
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/grass/qtermwidget/k3processcontroller.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 0866c6c

Please sign in to comment.