Dev flags are now off by default

"Dev" flags are -Werror, -Wextra, -Wall and -Wc++98-compat. People who are
compiling YCM as users and not developers (99.99999% of all YCM compilations)
don't care about those flags and were just burdened by their inclusion by
default.

Fixes #502.
This commit is contained in:
Strahinja Val Markovic 2013-08-12 20:33:46 -07:00
parent d35b39a20c
commit ce136cd5b6
2 changed files with 5 additions and 4 deletions

View File

@ -28,6 +28,7 @@ if ( NOT PYTHONLIBS_VERSION_STRING VERSION_LESS "3.0.0" )
"python2.\n" )
endif()
option( DEV_FLAGS "Use compilation flags meant for YCM developers" OFF )
option( USE_CLANG_COMPLETER "Use Clang semantic completer for C/C++/ObjC" OFF )
option( USE_SYSTEM_LIBCLANG "Set to ON to use the system libclang library" OFF )
set( PATH_TO_LLVM_ROOT "" CACHE PATH "Path to the root of a LLVM+Clang binary distribution" )
@ -295,7 +296,7 @@ set_target_properties( ${PROJECT_NAME} PROPERTIES
# For some reason, Xcode is too dumb to understand the -isystem flag and thus
# borks on warnings in Boost.
if ( ( CMAKE_COMPILER_IS_GNUCXX OR COMPILER_IS_CLANG ) AND
if ( DEV_FLAGS AND ( CMAKE_COMPILER_IS_GNUCXX OR COMPILER_IS_CLANG ) AND
NOT CMAKE_GENERATOR_IS_XCODE )
# We want all warnings, and warnings should be treated as errors
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror" )
@ -306,7 +307,7 @@ endif()
# We want warnings if we accidentally use C++11 features
# We can't use this warning on FreeBSD because std headers on that OS are dumb.
# See here: https://github.com/Valloric/YouCompleteMe/issues/260
if ( COMPILER_IS_CLANG AND NOT CMAKE_GENERATOR_IS_XCODE AND NOT
if ( DEV_FLAGS AND COMPILER_IS_CLANG AND NOT CMAKE_GENERATOR_IS_XCODE AND NOT
SYSTEM_IS_FREEBSD )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wc++98-compat" )
endif()

View File

@ -138,7 +138,7 @@ fi
if [ -z "$YCM_TESTRUN" ]; then
install $cmake_args $EXTRA_CMAKE_ARGS
else
testrun $cmake_args $EXTRA_CMAKE_ARGS
testrun $cmake_args -DDEV_FLAGS=ON $EXTRA_CMAKE_ARGS
fi
if $omnisharp_completer; then
@ -153,7 +153,7 @@ if $omnisharp_completer; then
ycm_dir=`pwd`
build_dir=$ycm_dir"/python/ycm/completers/cs/OmniSharpServer"
cd $build_dir
$buildcommand
cd $ycm_dir