minor fixes in ditribution files
[gromacs/qmmm-gamess-us.git] / cmake / gmxCFlags.cmake
blob8e97d433d1587961b3b2f6925143177c4436b037
1 MACRO(gmx_c_flags)
3 include(CheckCCompilerFlag)
5 if( CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX )
6   CHECK_C_COMPILER_FLAG( "-O3" XFLAGS_O3)
7   IF (XFLAGS_O3)
8     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
9   ENDIF(XFLAGS_O3)
11   CHECK_C_COMPILER_FLAG( "-Wall -Wno-unused" XFLAGS_WARN)
12   IF (XFLAGS_WARN)
13     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-unused")
14   ENDIF(XFLAGS_WARN)
15   CHECK_C_COMPILER_FLAG( "-std=gnu99" XFLAGS_GNU99)
16   IF (XFLAGS_GNU99)
17     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
18   ENDIF(XFLAGS_GNU99)
20   # new in gcc 4.5
21   CHECK_C_COMPILER_FLAG( "-fexcess-precision=fast" XFLAGS_EXCESS_PRECISION)
22   IF (XFLAGS_EXCESS_PRECISION)
23     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexcess-precision=fast")
24   ENDIF (XFLAGS_EXCESS_PRECISION)
26   CHECK_C_COMPILER_FLAG( "-march=native" XFLAGS_MARCH)
27   IF (XFLAGS_MARCH)
28     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native")
29   ENDIF(XFLAGS_MARCH)
30 endif( CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX )
32 MARK_AS_ADVANCED(XFLAGS_O3 XFLAGS_WARN XFLAGS_GNU99 XFLAGS_MARCH)
34 ENDMACRO(gmx_c_flags)