Skip to content

Commit

Permalink
install_prefix: test writable
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Aug 27, 2024
1 parent e58b1e5 commit 69f288c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions scripts/mpi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@ include(ExternalProject)

option(mpich "Build MPICH instead of OpenMPI")

if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
message(FATAL_ERROR "Please specify MPI install location:
cmake -DCMAKE_INSTALL_PREFIX=...")
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX})
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.29)
if(NOT IS_WRITABLE ${CMAKE_INSTALL_PREFIX})
message(FATAL_ERROR "CMAKE_INSTALL_PREFIX is not writable: ${CMAKE_INSTALL_PREFIX}")
endif()
else()
file(TOUCH ${CMAKE_INSTALL_PREFIX}/.cmake_writable "")
endif()

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake)
Expand Down

0 comments on commit 69f288c

Please sign in to comment.