Skip to content

Commit 7bafa13

Browse files
authored
Merge pull request #371 from sourceryinstitute/address-cmake-issue-16804-comment
Fix typo in top-level CMakeLists.txt
2 parents ae0a625 + 177fdd0 commit 7bafa13

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,15 @@ endif()
156156
find_package( MPI )
157157

158158
if ( (NOT MPI_C_FOUND) OR (NOT MPI_Fortran_FOUND) OR (NOT MPIEXEC))
159+
# Get default install location of MPICH from install.sh
160+
execute_process( COMMAND "./install.sh" -P mpich
161+
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
162+
OUTPUT_VARIABLE DEFAULT_MPICH_INSTALL_LOC
163+
OUTPUT_QUIET
164+
OUTPUT_STRIP_TRAILING_WHITES_SPACE
165+
)
159166
find_program (MY_MPI_EXEC NAMES mpirun mpiexec lamexec srun
160-
PATHS "${CMAKE_SOURCE_DIR/prerequisites/installations/mpich/3.1.4}" "${CMAKE_SOURCE_DIR}/prerequisites/installations/mpich/*" ENV PATH
167+
PATHS "${DEFAULT_MPICH_INSTALL_LOC}" ENV PATH
161168
HINTS "${FTN_COMPILER_DIR}" "${C_COMPILER_DIR}"
162169
PATH_SUFFIXES bin)
163170
set ( MPI_HOME "${MPI_HOME}" "${MY_MPI_EXEC}" "${MY_MPI_EXEC}/.." )

prerequisites/install-functions/build_opencoarrays.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ build_opencoarrays()
2323
# Set CC to the MPI implementation's gcc command...
2424
CC="${MPICC_show[0]}"
2525
# try to find mpiexec
26-
MPIEXEC_CANDIDATES=($(find "${MPICC%/*}" -name 'mpiexec' -o -name 'mpirun' -o -name 'lamexec' -o -name 'srun'))
26+
MPI_BIN_DIR="$(type -P "${MPICC}")"
27+
MPIEXEC_CANDIDATES=($(find "${MPI_BIN_DIR%/*}" -name 'mpiexec' -o -name 'mpirun' -o -name 'lamexec' -o -name 'srun'))
2728
if ! ((${#MPIEXEC_CANDIDATES[@]} >= 1)); then
2829
emergency "Could not find a suitable \`mpiexec\` in directory containing mpi wrappers (${MPICC%/*})"
2930
else

0 commit comments

Comments
 (0)