[Cmake-commits] CMake branch, next, updated. v2.8.4-1806-g0d5fcf9

Todd Gamblin tgamblin at llnl.gov
Tue Jun 21 17:09:13 EDT 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  0d5fcf9e761131432667aa93d1ba42ee3f185585 (commit)
       via  8756e77fb40eabe1441889f4e82cb2997833bc82 (commit)
      from  e355a1263163b201bbeeafe9c974b8f914075cf2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0d5fcf9e761131432667aa93d1ba42ee3f185585
commit 0d5fcf9e761131432667aa93d1ba42ee3f185585
Merge: e355a12 8756e77
Author:     Todd Gamblin <tgamblin at llnl.gov>
AuthorDate: Tue Jun 21 17:08:50 2011 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Jun 21 17:08:50 2011 -0400

    Merge topic 'FindMPI-try-regular-compiler' into next
    
    8756e77 Fix issues with removing try_compile input file.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8756e77fb40eabe1441889f4e82cb2997833bc82
commit 8756e77fb40eabe1441889f4e82cb2997833bc82
Author:     Todd Gamblin <tgamblin at llnl.gov>
AuthorDate: Tue Jun 21 14:02:01 2011 -0700
Commit:     Todd Gamblin <tgamblin at llnl.gov>
CommitDate: Tue Jun 21 14:02:01 2011 -0700

    Fix issues with removing try_compile input file.
    
    - Don't remove input file
    - Put output in ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}
    - Remove try_compile variable from the cache after using

diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index d251088..250d8a6 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -443,10 +443,14 @@ function (interrogate_mpi_compiler lang try_libs)
 endfunction()
 
 
+# This function attempts to compile with the regular compiler, to see if MPI programs
+# work with it.  This is a last ditch attempt after we've tried interrogating mpicc and
+# friends, and after we've tried to find generic libraries.  Works on machines like
+# Cray XE6, where the modules environment changes what MPI version cc, CC, and ftn use.
 function(try_regular_compiler lang success)
-  # last ditch attempt: just try to compile something with the regular compiler
+  set(scratch_directory ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY})
   if (${lang} STREQUAL Fortran)
-    set(test_file ${CMAKE_CURRENT_BINARY_DIR}/cmake_mpi_test.f90)
+    set(test_file ${scratch_directory}/cmake_mpi_test.f90)
     file(WRITE ${test_file}
       "program hello\n"
       "include 'mpif.h'\n"
@@ -456,9 +460,9 @@ function(try_regular_compiler lang success)
       "end\n")
   else()
     if (${lang} STREQUAL CXX)
-      set(test_file ${CMAKE_CURRENT_BINARY_DIR}/cmake_mpi_test.cpp)
+      set(test_file ${scratch_directory}/cmake_mpi_test.cpp)
     else()
-      set(test_file ${CMAKE_CURRENT_BINARY_DIR}/cmake_mpi_test.c)
+      set(test_file ${scratch_directory}/cmake_mpi_test.c)
     endif()
     file(WRITE ${test_file}
       "#include <mpi.h>\n"
@@ -467,8 +471,8 @@ function(try_regular_compiler lang success)
       "  MPI_Finalize();\n"
       "}\n")
   endif()
-  try_compile(worked ${CMAKE_CURRENT_BINARY_DIR} ${test_file})
-  if (worked)
+  try_compile(compiler_has_mpi ${scratch_directory} ${test_file})
+  if (compiler_has_mpi)
     set(MPI_${lang}_NO_INTERROGATE ${CMAKE_${lang}_COMPILER} CACHE STRING "Whether to interrogate MPI ${lang} compiler" FORCE)
     set(MPI_${lang}_COMPILER       ${CMAKE_${lang}_COMPILER} CACHE STRING "MPI ${lang} compiler"                        FORCE)
     set(MPI_${lang}_COMPILE_FLAGS  ""                        CACHE STRING "MPI ${lang} compilation flags"               FORCE)
@@ -476,8 +480,8 @@ function(try_regular_compiler lang success)
     set(MPI_${lang}_LINK_FLAGS     ""                        CACHE STRING "MPI ${lang} linking flags"                   FORCE)
     set(MPI_${lang}_LIBRARIES      ""                        CACHE STRING "MPI ${lang} libraries to link against"       FORCE)
   endif()
-  set(${success} ${worked} PARENT_SCOPE)
-  file(REMOVE ${test_file})
+  set(${success} ${compiler_has_mpi} PARENT_SCOPE)
+  unset(compiler_has_mpi CACHE)
 endfunction()
 
 # End definitions, commence real work here.

-----------------------------------------------------------------------

Summary of changes:
 Modules/FindMPI.cmake |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list