diff --git a/cmake/HPX_SetupGasnet.cmake b/cmake/HPX_SetupGasnet.cmake index 2914e0130b60..26653ac1d944 100644 --- a/cmake/HPX_SetupGasnet.cmake +++ b/cmake/HPX_SetupGasnet.cmake @@ -153,15 +153,23 @@ macro(hpx_setup_gasnet) endif() if(${MPI_C_COMPILER}) - set(CMAKE_C_COMPILER ${MPI_C_COMPILER}) + set(MPI_C_COMPILER ${CMAKE_C_COMPILER}) + set(MPI_CC ${CMAKE_C_COMPILER}) + set(ENV{MPI_CC} ${CMAKE_C_COMPILER}) elseif(${MPI_CC}) - set(CMAKE_C_COMPILER ${MPI_CC}) - elseif(ENV{MPI_CC}) - set(CMAKE_C_COMPILER ENV{MPI_CC}) + set(MPI_CC ${CMAKE_C_COMPILER}) + set(ENV{MPI_CC} ${CMAKE_C_COMPILER}) + elseif($ENV{MPI_CC}) + set(MPI_CC ${CMAKE_C_COMPILER}) + set(ENV{MPI_CC} ${CMAKE_C_COMPILER}) else() message(FATAL_ERROR "GASNet MPI Conduit selected; $MPI_CC not found!") endif() + if(NOT "$CMAKE_C_COMPILER" STREQUAL "${MPI_CC}") + message(FATAL_ERROR "GASNet MPI: $MPI_CC != $CMAKE_C_COMPILER!") + endif() + execute_process( COMMAND bash -c