Skip to content

Commit

Permalink
Fix variable change check
Browse files Browse the repository at this point in the history
$CACHE{SC_ENABLE_MPI} does not give the previous setting.
  • Loading branch information
tim-griesbach committed Nov 11, 2024
1 parent c371874 commit 07f473a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmake/config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,13 @@ set(SC_ENABLE_PTHREAD ${CMAKE_USE_PTHREADS_INIT})
set(SC_ENABLE_MEMALIGN 1)

# user has requested a different MPI setting, so we need to clear these cache variables to recheck
if(NOT "${SC_ENABLE_MPI}" STREQUAL "$CACHE{SC_ENABLE_MPI}")
if(NOT "${SC_ENABLE_MPI}" STREQUAL "${CACHED_SC_ENABLE_MPI}")
unset(SC_ENABLE_MPICOMMSHARED CACHE)
unset(SC_ENABLE_MPITHREAD CACHE)
unset(SC_ENABLE_MPIWINSHARED CACHE)
unset(SC_ENABLE_MPIIO CACHE)
# Update cached variable
set(CACHED_SC_ENABLE_MPI "${SC_ENABLE_MPI}" CACHE STRING "Cached value of SC_ENABLE_MPI")
endif()

if( SC_ENABLE_MPI )
Expand Down
3 changes: 3 additions & 0 deletions cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ endif()
if (DEFINED mpi)
set_property(CACHE SC_ENABLE_MPI PROPERTY VALUE "${mpi}")
endif()

# Store the MPI setting for the case the user changes the value
set(CACHED_SC_ENABLE_MPI "${SC_ENABLE_MPI}" CACHE STRING "Cached value of SC_ENABLE_MPI")

0 comments on commit 07f473a

Please sign in to comment.