summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2014-03-13 06:37:28 +0000
committerTed Kremenek <kremenek@apple.com>2014-03-13 06:37:28 +0000
commitec7eedc5db065b407cfb9945e2970a791a25705f (patch)
tree606d00a23892a5338fe5b5fe3d29b9ec4c44e5f5 /cmake
parent76604af7748badc535017534f5f4c627516fdd7a (diff)
downloadllvm-ec7eedc5db065b407cfb9945e2970a791a25705f.tar.gz
llvm-ec7eedc5db065b407cfb9945e2970a791a25705f.tar.bz2
llvm-ec7eedc5db065b407cfb9945e2970a791a25705f.tar.xz
[CMake] Enable a bunch of Xcode build settings that correspond to warnings that are for the most part enabled by default either by Clang or -Wall.
I personally build with these settings enabled all the time, and it is clearer to see the actual warning flags (e.g., -Wuninitialized) get passed by Xcode rather than seeing -Wno-uninitialized followed by -Wall (the latter canceling out the former) and figuring out what is going on. Xcode will ignore build settings it doesn't understand, so this will work on possibly older versions of Xcode that don't support all of these settings. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203760 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/HandleLLVMOptions.cmake23
1 files changed, 23 insertions, 0 deletions
diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake
index 319adf3f32..d12d1c788f 100644
--- a/cmake/modules/HandleLLVMOptions.cmake
+++ b/cmake/modules/HandleLLVMOptions.cmake
@@ -173,6 +173,29 @@ if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
endif( LLVM_BUILD_32_BITS )
endif( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
+if( XCODE )
+ # For Xcode enable several build settings that correspond to
+ # many warnings that are on by default in Clang but are
+ # not enabled for historical reasons. For versions of Xcode
+ # that do not support these options they will simply
+ # be ignored.
+ set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_ABOUT_RETURN_TYPE "YES")
+ set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_ABOUT_MISSING_NEWLINE "YES")
+ set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_UNUSED_VALUE "YES")
+ set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_UNUSED_VARIABLE "YES")
+ set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_SIGN_COMPARE "YES")
+ set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_UNUSED_FUNCTION "YES")
+ set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED "YES")
+ set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS "YES")
+ set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_UNINITIALIZED_AUTOS "YES")
+ set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_BOOL_CONVERSION "YES")
+ set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_EMPTY_BODY "YES")
+ set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_ENUM_CONVERSION "YES")
+ set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_INT_CONVERSION "YES")
+ set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_CONSTANT_CONVERSION "YES")
+ set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_NON_VIRTUAL_DESTRUCTOR "YES")
+endif()
+
# On Win32 using MS tools, provide an option to set the number of parallel jobs
# to use.
if( MSVC_IDE )