Commit 36fad208 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit Committed by Kenneth Moreland
Browse files

Fixed build issues when FindMPI picks mpicxx by default.

On several machines, FindMPI picks mpicxx by default. Linking with this C++
library causes issues with the C-based test executables.

FindMPI.cmake has gone revisions in recent versions of cmake (in 2.8.6 for
example). FindMPI now provides language specific MPI flags. Fixed the code to
use these MPI_<lang>_<variable> flags to avoid the afforementioned issue.
parent 327e8a62
......@@ -109,16 +109,26 @@ ENDIF (ICET_USE_OPENGL)
# Configure MPI support.
IF (ICET_USE_MPI)
FIND_PACKAGE(MPI REQUIRED)
MARK_AS_ADVANCED(CLEAR MPI_INCLUDE_PATH)
MARK_AS_ADVANCED(CLEAR MPI_LIBRARY)
MARK_AS_ADVANCED(CLEAR MPI_EXTRA_LIBRARY)
INCLUDE_DIRECTORIES(${MPI_INCLUDE_PATH})
SET(ICET_MPI_LIBRARIES ${MPI_LIBRARY})
IF(MPI_EXTRA_LIBRARY)
SET(ICET_MPI_LIBRARIES ${ICET_MPI_LIBRARIES} ${MPI_EXTRA_LIBRARY})
ENDIF(MPI_EXTRA_LIBRARY)
# Mark certain variables as non-advanced.
IF (DEFINED MPI_C_COMPILER)
# Using newer MPI module.
# Older MPI module
MARK_AS_ADVANCED(CLEAR MPI_C_INCLUDE_PATH)
MARK_AS_ADVANCED(CLEAR MPI_C_LIBRARY)
MARK_AS_ADVANCED(CLEAR MPI_C_EXTRA_LIBRARY)
INCLUDE_DIRECTORIES(${MPI_C_INCLUDE_PATH})
SET (ICET_MPI_LIBRARIES ${MPI_C_LIBRARY} ${MPI_C_EXTRA_LIBRARY})
ELSE (DEFINED MPI_C_COMPILER)
# Older MPI module
MARK_AS_ADVANCED(CLEAR MPI_INCLUDE_PATH)
MARK_AS_ADVANCED(CLEAR MPI_LIBRARY)
MARK_AS_ADVANCED(CLEAR MPI_EXTRA_LIBRARY)
INCLUDE_DIRECTORIES(${MPI_INCLUDE_PATH})
SET(ICET_MPI_LIBRARIES ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY})
ENDIF(DEFINED MPI_C_COMPILER)
# Set up variables used to run MPI programs. In CMake 2.8 or later, they are
# defined by the FindMPI module.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment