Add phpunit config file support to script test command
[hiphop-php.git] / CMake / HPHPCompiler.cmake
blob3bac4255b91026e68494834135212167eb5e6d40
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
6 #error Not GCC 4.7.0+
7 #endif
8 int main() { return 0; }" HAVE_GCC_47)
10         if (NOT HAVE_GCC_47)
11                 message(FATAL_ERROR "Need at least GCC 4.7")
12         endif()
14         CHECK_C_SOURCE_COMPILES("#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
15 #if GCC_VERSION < 40800
16 #error Not GCC 4.8.0+
17 #endif
18 int main() { return 0; }" HAVE_GCC_48)
20 endif()
22 set(FREEBSD FALSE)
23 set(LINUX FALSE)
25 if("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
26         set(FREEBSD TRUE)
27 endif()
29 if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
30         set(LINUX TRUE)
31 endif()
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")
36 else()
37         set(GNUCC_48_OPT "")
38         if(HAVE_GCC_48)
39                 set(GNUCC_48_OPT "-Wno-unused-local-typedefs -fno-canonical-system-headers")
40         endif()
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}")
43 endif()
45 if(CMAKE_COMPILER_IS_GNUCC)
46         set(CMAKE_C_FLAGS_RELEASE "-O3")
47 endif()
49 if(CMAKE_COMPILER_IS_GNUCXX)
50         set(CMAKE_CXX_FLAGS_RELEASE "-O3")
51 endif()