1 if(CMAKE_COMPILER_IS_GNUCC)
2 INCLUDE(CheckCSourceCompiles)
4 CHECK_C_SOURCE_COMPILES("#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
5 #if GCC_VERSION < 40700
8 int main() { return 0; }" HAVE_GCC_47)
11 message(FATAL_ERROR "Need at least GCC 4.7")
14 CHECK_C_SOURCE_COMPILES("#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
15 #if GCC_VERSION < 40800
18 int main() { return 0; }" HAVE_GCC_48)
25 if("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
29 if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
33 if($ENV{CXX} MATCHES "icpc")
34 set(CMAKE_C_FLAGS "-no-ipo -fp-model precise -wd584 -wd1418 -wd1918 -wd383 -wd869 -wd981 -wd424 -wd1419 -wd444 -wd271 -wd2259 -wd1572 -wd1599 -wd82 -wd177 -wd593 -w")
35 set(CMAKE_CXX_FLAGS "-no-ipo -fp-model precise -wd584 -wd1418 -wd1918 -wd383 -wd869 -wd981 -wd424 -wd1419 -wd444 -wd271 -wd2259 -wd1572 -wd1599 -wd82 -wd177 -wd593 -fno-omit-frame-pointer -ftemplate-depth-180 -Wall -Woverloaded-virtual -Wno-deprecated -w1 -Wno-strict-aliasing -Wno-write-strings -Wno-invalid-offsetof -fno-operator-names")
39 set(GNUCC_48_OPT "-Wno-unused-local-typedefs -fno-canonical-system-headers")
41 set(CMAKE_C_FLAGS "-w")
42 set(CMAKE_CXX_FLAGS "-fno-gcse -fno-omit-frame-pointer -ftemplate-depth-180 -Wall -Woverloaded-virtual -Wno-deprecated -Wno-strict-aliasing -Wno-write-strings -Wno-invalid-offsetof -fno-operator-names -Wno-error=array-bounds -Wno-error=switch -std=gnu++11 -Werror=format-security -Wno-unused-result -Wno-sign-compare -Wno-attributes -Wno-maybe-uninitialized ${GNUCC_48_OPT}")
45 if(CMAKE_COMPILER_IS_GNUCC)
46 set(CMAKE_C_FLAGS_RELEASE "-O3")
49 if(CMAKE_COMPILER_IS_GNUCXX)
50 set(CMAKE_CXX_FLAGS_RELEASE "-O3")