From 724b3b2a04866f4279030041b5e7b78b39f174fa Mon Sep 17 00:00:00 2001 From: "Balos, Cody, J" Date: Mon, 28 Oct 2024 13:49:16 -0700 Subject: [PATCH] conditional to avoid extra whitespace --- cmake/macros/SundialsAddTest.cmake | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/cmake/macros/SundialsAddTest.cmake b/cmake/macros/SundialsAddTest.cmake index 1811efa9ea..4b4733820e 100644 --- a/cmake/macros/SundialsAddTest.cmake +++ b/cmake/macros/SundialsAddTest.cmake @@ -185,13 +185,25 @@ macro(SUNDIALS_ADD_TEST NAME EXECUTABLE) if((SUNDIALS_ADD_TEST_MPI_NPROCS) AND ((MPIEXEC_EXECUTABLE) OR (SUNDIALS_TEST_MPIRUN_COMMAND))) if(SUNDIALS_TEST_MPIRUN_COMMAND) - set(RUN_COMMAND - "${SUNDIALS_TEST_MPIRUN_COMMAND} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${SUNDIALS_ADD_TEST_MPI_NPROCS}" - ) + if(MPIEXEC_PREFLAGS) + set(RUN_COMMAND + "${SUNDIALS_TEST_MPIRUN_COMMAND} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${SUNDIALS_ADD_TEST_MPI_NPROCS}" + ) + else() + set(RUN_COMMAND + "${SUNDIALS_TEST_MPIRUN_COMMAND} ${MPIEXEC_NUMPROC_FLAG} ${SUNDIALS_ADD_TEST_MPI_NPROCS}" + ) + endif() elseif(MPIEXEC_EXECUTABLE) - set(RUN_COMMAND - "${MPIEXEC_EXECUTABLE} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${SUNDIALS_ADD_TEST_MPI_NPROCS}" - ) + if(MPIEXEC_PREFLAGS) + set(RUN_COMMAND + "${MPIEXEC_EXECUTABLE} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${SUNDIALS_ADD_TEST_MPI_NPROCS}" + ) + else() + set(RUN_COMMAND + "${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${SUNDIALS_ADD_TEST_MPI_NPROCS}" + ) + endif() endif() # remove trailing white space (empty MPIEXEC_PREFLAGS) as it can cause