From ce136cd5b6409d2776a8425b12b9987d1b661756 Mon Sep 17 00:00:00 2001 From: Strahinja Val Markovic Date: Mon, 12 Aug 2013 20:33:46 -0700 Subject: [PATCH] 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. --- cpp/ycm/CMakeLists.txt | 5 +++-- install.sh | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cpp/ycm/CMakeLists.txt b/cpp/ycm/CMakeLists.txt index 2063da8e..9275338a 100644 --- a/cpp/ycm/CMakeLists.txt +++ b/cpp/ycm/CMakeLists.txt @@ -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() diff --git a/install.sh b/install.sh index 413b6608..0ba0c4d6 100755 --- a/install.sh +++ b/install.sh @@ -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