Merge remote-tracking branch 'gerrit/release-4-5-patches' into release-4-6
[alexxy/gromacs.git] / CMakeLists.txt
index 110a66679557038e0f35d4b945fa19424ca779b1..ba633cffc381a072b1be29023ee6429c9ba7af24 100644 (file)
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.6)
+cmake_minimum_required(VERSION 2.8)
 
 project(Gromacs)
 include(Dart)
@@ -12,7 +12,7 @@ mark_as_advanced(DART_ROOT)
 # machine with no git. 
 #
 # NOTE: when releasing the "-dev" suffix needs to be stripped off!
-set(PROJECT_VERSION "4.5.5-dev")
+set(PROJECT_VERSION "4.6-dev")
 set(CUSTOM_VERSION_STRING ""
     CACHE STRING "Custom version string (if empty, use hard-coded default)")
 mark_as_advanced(CUSTOM_VERSION_STRING)
@@ -22,8 +22,8 @@ endif (CUSTOM_VERSION_STRING)
 set(SOVERSION 6)
 # It is a bit irritating, but this has to be set separately for now!
 SET(CPACK_PACKAGE_VERSION_MAJOR "4")
-SET(CPACK_PACKAGE_VERSION_MINOR "5")
-SET(CPACK_PACKAGE_VERSION_PATCH "5")
+SET(CPACK_PACKAGE_VERSION_MINOR "6")
+#SET(CPACK_PACKAGE_VERSION_PATCH "0")
 
 
 # Cmake modules/macros are in a subdirectory to keep this file cleaner
@@ -194,7 +194,16 @@ if(GMX_MPI)
         set(GMX_THREADS OFF CACHE BOOL 
             "Thread-based parallelization conflicts with MPI." FORCE)
     endif(GMX_THREADS)
-    find_package(MPI)
+
+    # Work-around for Cray MPI
+    TRY_COMPILE(MPI_FOUND ${CMAKE_BINARY_DIR}
+      "${CMAKE_SOURCE_DIR}/cmake/TestMPI.c"
+      COMPILE_DEFINITIONS )
+    if(NOT MPI_FOUND)
+      # search for normal MPI installations
+      find_package(MPI)
+    endif(NOT MPI_FOUND)
+
     if(MPI_FOUND)
         set(GROMACS_C_FLAGS ${GROMACS_FLAGS} ${MPI_COMPILE_FLAGS})
        set(GROMACS_LINKER_FLAGS ${GROMACS_LINKER_FLAGS} ${MPI_LINK_FLAGS})
@@ -472,12 +481,22 @@ endif(CYGWIN)
 if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
     if(USE_VERSION_H)
         # We need at least git v1.5.1 be able to parse git's date output. If not 
-        # fund or the version is too small, we can't generate version information.
-        find_package(Git 1.5.1)
-        # this should at some point become VERSION_LESS
-        if(NOT Git_FOUND OR Git_VERSION STRLESS "1.5.1")
-            message("No compatible git version found, won't be able to generate proper development version information.")
-            set(USE_VERSION_H OFF)
+        # found or the version is too small, we can't generate version information.
+        find_package(Git)
+
+       # Find out the git version
+       if(GIT_FOUND AND NOT GIT_VERSION)
+         execute_process(COMMAND ${GIT_EXECUTABLE} "--version"
+            OUTPUT_VARIABLE _exec_out
+            OUTPUT_STRIP_TRAILING_WHITESPACE)
+         string(REGEX REPLACE "git version (.*)" "\\1" GIT_VERSION ${_exec_out})
+         set(GIT_VERSION ${GIT_VERSION} CACHE STRING "Git version")
+         mark_as_advanced(GIT_VERSION)
+       endif()
+
+        if(NOT GIT_FOUND OR GIT_VERSION VERSION_LESS "1.5.1")
+          message("No compatible git version found, won't be able to generate proper development version information.")
+          set(USE_VERSION_H OFF)
         endif()
     endif()
 else()
@@ -870,7 +889,6 @@ include(CTest)
 mark_as_advanced(BUILD_TESTING)
 IF(BUILD_TESTING)
        enable_testing()
-       add_test(TestBuildAll make)
        add_subdirectory(tests)
 ENDIF()