Hi Kelly > I have been looking into this. For my setup, I found it useful to compare > the CMAKE_<LANG>_COMPILER to the list of known mpi wrapper names and prepend > _MPI_${lang}_COMPILER_NAMES with CMAKE_<LANG>_COMPILER so that the remaining > logic in FindMPI.cmake chooses the user supplied compiler/mpi-wrapper over > any of the other choices. Something like this: > > # append vendor-specific compilers to the list if we either don't know the > compiler id, > # or if we know it matches the regular compiler. > foreach (lang C CXX Fortran) > foreach (id GNU Intel PGI XL) > if (NOT CMAKE_${lang}_COMPILER_ID OR CMAKE_${lang}_COMPILER_ID STREQUAL > id) > list(APPEND _MPI_${lang}_COMPILER_NAMES > ${_MPI_${id}_${lang}_COMPILER_NAMES}) > endif() > unset(_MPI_${id}_${lang}_COMPILER_NAMES) # clean up the namespace here > endforeach() > > + # If cmake_$lang_compiler matches a known mpi compiler wrapper name, > + # prefer the provided value. > + get_filename_component( compiler_wo_path "${CMAKE_${lang}_COMPILER}" NAME ) > + set( ${lang}_compiler_is_mpiwrapper false ) > + foreach( mpiwrapper ${_MPI_${lang}_COMPILER_NAMES} ) > + if( "${mpiwrapper}" STREQUAL "${compiler_wo_path}" ) > + set( ${lang}_compiler_is_mpiwrapper true ) > + endif() > + endforeach() > + if( ${lang}_compiler_is_mpiwrapper ) > + list( REMOVE_ITEM _MPI_${lang}_COMPILER_NAMES ${compiler_wo_path} ) > + list( INSERT _MPI_${lang}_COMPILER_NAMES 0 ${compiler_wo_path} ) > + endif() > endforeach()
checked your patch and indeed works. In addition to that I have noticed that in the interrogate function we never check that we can actually generate a binary with the findings, shall we have a try_mpi_compile at the end of interrogate function? regards Alin -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers