Brad King wrote: >> 0002-first-try-to-see-if-what-user-provided-produces-an-m.patch
> The check for whether the CMAKE_<LANG>_COMPILER is already a > MPI compiler requires a try_compile. Is there some other way > to check to see if there is any chance before the full test? 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() There is probably a better way to do this, but you get the idea. In my setup, I'm trying to get FindMPI.cmake to select mpiicpc over mpicc without manually setting the MPI_${lang}_COMPILER manually. > Also I'm not sure we fully support using a MPI compiler > as the main compiler. I can't think of anything that > definitely won't work, but we don't have nightly testing > for the case. My project does nightly regressions with and without the use of MPI compiler wrappers. I have never had a problem using the compiler wrappers (e.g.: mpicc, mpiicpc, Cray's CC). Additionally, I think Trilinos (trilinos.org) requires the use of compiler wrappers to build their code (cmake build system). -kt -- 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