OFF)
mark_as_advanced(GMX_BUILD_FOR_COVERAGE)
+
+######################################################################
+# Detect OpenMP support
+######################################################################
+# The OpenMP detection _must_ come before tests for other CFLAGS.
+include(gmxManageOpenMP)
+
+
+
######################################################################
# Compiler tests
# These need to be done early (before further tests).
#####################################################################
-# Warn if C and C++ compilers do not match
-if(NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "${CMAKE_CXX_COMPILER_ID}")
- message(WARNING "The ids of the C and C++ compilers do not match (respectively ${CMAKE_C_COMPILER_ID} and ${CMAKE_CXX_COMPILER_ID}). Note that mixing different C/C++ compilers can cause problems!")
-endif()
-if(NOT "${CMAKE_C_COMPILER_VERSION}" STREQUAL "${CMAKE_CXX_COMPILER_VERSION}")
- message(WARNING "The versions of the C and C++ compilers do not match (respectively ${CMAKE_C_COMPILER_VERSION} and ${CMAKE_CXX_COMPILER_VERSION}). Note that mixing different C/C++ compilers can cause problems!")
-endif()
-
# The cmake/Check{C,CXX}CompilerFlag.cmake files in the GROMACS distribution
# are used with permission from CMake v2.8.9 so that GROMACS can detect
# invalid options with the Intel Compilers.
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
-######################################################################
-# Detect OpenMP
-#####################################################################
-# The OpenMP detection must come before tests for other CFLAGS.
-include(gmxManageOpenMP)
-
-
include(gmxCFlags)
gmx_c_flags()
set(EXTRA_C_FLAGS "")
set(EXTRA_CXX_FLAGS "")
-# gcc 4.4.x is buggy and crashes when compiling some files with O3 and OpenMP on.
-# Detect here whether applying a workaround is needed and will apply it later
-# on the affected files. This test must come after gmx_c_flags(), since we
-# only want to enable the workaround when using the -O3 flag.
-include(gmxGCC44O3BugWorkaround)
-gmx_check_gcc44_bug_workaround_needed(GMX_USE_GCC44_BUG_WORKAROUND)
-
-# clang 3.0 is buggy for some unknown reason detected during adding
-# the SSE2 group kernels for GROMACS 4.6. If we ever work out what
-# that is, we should replace these tests with a compiler feature test,
-# update GROMACS Redmine task #1039 and perhaps report a clang bug.
-#
-# In the meantime, until we require CMake 2.8.10 we cannot rely on it to detect
-# the compiler version for us. So we need a manual check for clang 3.0.
-include(gmxDetectClang30)
-gmx_detect_clang_3_0(COMPILER_IS_CLANG_3_0)
-if(COMPILER_IS_CLANG_3_0)
- message(FATAL_ERROR "Your compiler is clang version 3.0, which is known to be buggy for GROMACS. Use a different compiler.")
-endif()
+# Run through a number of tests for buggy compilers and other issues
+include(gmxTestCompilerProblems)
+gmx_test_compiler_problems()
-# clang <=3.2 contains a bug that causes incorrect code to be generated for the
-# vfmaddps instruction and therefore the bug is triggered with AVX_128_FMA.
-# (see: http://llvm.org/bugs/show_bug.cgi?id=15040).
-# We can work around this by not using the integrated assembler (except on OS X
-# which has an outdated assembler that does not support AVX instructions).
-if (${CMAKE_C_COMPILER_ID} MATCHES "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "3.3")
- set(GMX_USE_CLANG_C_FMA_BUG_WORKAROUND TRUE)
-endif()
-if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.3")
- set(GMX_USE_CLANG_CXX_FMA_BUG_WORKAROUND TRUE)
-endif()
-
-if (CMAKE_C_COMPILER_ID STREQUAL "PGI")
- message(WARNING "All tested PGI compiler versions (up to 12.9.0) generate binaries which produce incorrect results, or even fail to compile Gromacs. Highly recommended to use a different compiler. If you choose to use PGI, make sure to run the regressiontests.")
-endif()
-
-if(CMAKE_C_COMPILER_ID MATCHES "Intel" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "12.0.0")
- message(WARNING "Intel compilers before 12.0.0 are not routinely tested, so there may be problems. Version 11.1 with SSE4.1 is known to produce incorrect results. It is highly recommended to use a more up-to-date compiler. If you choose to use this version, make sure you run the regressiontests.")
-endif()
set(PKG_CFLAGS "")
if(GMX_DOUBLE)