From c9b360bda5a17141f986681c4d570e398d2a67c2 Mon Sep 17 00:00:00 2001 From: Michele Alberti Date: Wed, 10 Nov 2021 15:21:18 +0100 Subject: [PATCH] [configuration] Make cmake configuration fail early upon boost or openBLAS installation failure with a clear message. --- CMakeLists.txt | 12 +++++++++--- tools/download_boost.sh | 2 +- tools/download_openBLAS.sh | 3 ++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a2badaf9f..54f35c1d4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -186,7 +186,10 @@ find_package(Boost COMPONENTS program_options timer chrono thread) if (NOT ${Boost_FOUND}) # bash file that downloads and install boost 1_68_0, the name need to match # BOOST_DIR variable - execute_process(COMMAND ${TOOLS_DIR}/download_boost.${SCRIPT_EXTENSION}) + execute_process(COMMAND ${TOOLS_DIR}/download_boost.${SCRIPT_EXTENSION} EXIT_CODE exit_code) + if (NOT exit_code EQUAL "0") + message(FATAL_ERROR "The installation of boost has failed") + endif() find_package(Boost REQUIRED COMPONENTS program_options timer chrono thread) endif() set(LIBS_INCLUDES ${Boost_INCLUDE_DIRS}) @@ -226,10 +229,13 @@ if (${ENABLE_OPENBLAS}) add_compile_definitions(ENABLE_OPENBLAS) #OpenBLAS if(NOT EXISTS "${OPENBLAS_DIR}/installed/lib/libopenblas.a") - message("Can't find open blas, installing. If open blas is isntalled please use the OPENBLAS_DIR parameter to pass the path") + message("Can't find openblas, installing. If openblas is installed please use the OPENBLAS_DIR parameter to pass the path") if (${OPENBLAS_DIR} STREQUAL ${OPENBLAS_DEFAULT_DIR}) message("installing openblas") - execute_process(COMMAND ${TOOLS_DIR}/download_openBLAS.sh) + execute_process(COMMAND ${TOOLS_DIR}/download_openBLAS.sh EXIT_CODE exit_code) + if (NOT exit_code EQUAL "0") + message(FATAL_ERROR "The installation of openblas has failed") + endif() else() message(FATAL_ERROR "Can't find openblas in the supplied directory") endif() diff --git a/tools/download_boost.sh b/tools/download_boost.sh index da001ca7b2..6b8298200b 100755 --- a/tools/download_boost.sh +++ b/tools/download_boost.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e curdir=$pwd mydir="${0%/*}" diff --git a/tools/download_openBLAS.sh b/tools/download_openBLAS.sh index ff881fca57..faa224ef9f 100755 --- a/tools/download_openBLAS.sh +++ b/tools/download_openBLAS.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#!/bin/bash -e + curdir=$pwd mydir="${0%/*}"