From 22fcbddc46e09735af9b94ab61cc09bd334013b5 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Mon, 2 Dec 2024 23:22:33 +0100 Subject: [PATCH] Error when execute_process fails via COMMAND_ERROR_IS_FATAL ANY Added in cmake 3.19, cf https://cmake.org/cmake/help/latest/command/execute_process.html --- CMakeLists.txt | 2 +- cmake/RunSimulation.cmake | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d9416a4470..0dfe8fef252 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.17) +cmake_minimum_required(VERSION 3.19) # Use ccache if available, has to be before "project()" find_program(CCACHE_PROGRAM NAMES ccache sccache) diff --git a/cmake/RunSimulation.cmake b/cmake/RunSimulation.cmake index acdc8ef61a2..2a80d73db3a 100644 --- a/cmake/RunSimulation.cmake +++ b/cmake/RunSimulation.cmake @@ -71,7 +71,7 @@ if(BUILD_FORTRAN) find_program(PARAMETRIC_EXE ParametricPreprocessor PATHS "${PRODUCT_PATH}" NO_DEFAULT_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH NO_CMAKE_FIND_ROOT_PATH) execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${IDF_PATH}" "${OUTPUT_DIR_PATH}") - execute_process(COMMAND "${PARAMETRIC_EXE}" "${IDF_FILE}" WORKING_DIRECTORY "${OUTPUT_DIR_PATH}") + execute_process(COMMAND "${PARAMETRIC_EXE}" "${IDF_FILE}" WORKING_DIRECTORY "${OUTPUT_DIR_PATH}" COMMAND_ERROR_IS_FATAL ANY) # this handles the LBuildingAppGRotPar parametric file if(EXISTS "${OUTPUT_DIR_PATH}/${IDF_NAME}-G000.idf") @@ -100,7 +100,7 @@ if(BUILD_FORTRAN) execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${IDF_PATH}" "${OUTPUT_DIR_PATH}/in.idf") execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${EPW_PATH}" "${OUTPUT_DIR_PATH}/in.epw") execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${PRODUCT_PATH}/Energy+.idd" "${OUTPUT_DIR_PATH}") - execute_process(COMMAND "${EXPANDOBJECTS_EXE}" WORKING_DIRECTORY "${OUTPUT_DIR_PATH}") + execute_process(COMMAND "${EXPANDOBJECTS_EXE}" WORKING_DIRECTORY "${OUTPUT_DIR_PATH}" COMMAND_ERROR_IS_FATAL ANY) if("${SLAB_RESULT}" GREATER -1) # Copy files needed for Slab @@ -109,7 +109,7 @@ if(BUILD_FORTRAN) find_program(SLAB_EXE Slab PATHS "${PRODUCT_PATH}" NO_DEFAULT_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH NO_CMAKE_FIND_ROOT_PATH) message("Executing Slab from ${SLAB_EXE}") - execute_process(COMMAND "${SLAB_EXE}" WORKING_DIRECTORY "${OUTPUT_DIR_PATH}") + execute_process(COMMAND "${SLAB_EXE}" WORKING_DIRECTORY "${OUTPUT_DIR_PATH}" COMMAND_ERROR_IS_FATAL ANY) # Then copy slab results into the expanded file file(READ "${OUTPUT_DIR_PATH}/SLABSurfaceTemps.TXT" SLAB_CONTENTS) file(APPEND "${OUTPUT_DIR_PATH}/expanded.idf" "${SLAB_CONTENTS}") @@ -118,11 +118,12 @@ if(BUILD_FORTRAN) if("${BASEMENT_RESULT}" GREATER -1) # Copy files needed for Basement file(COPY "${SOURCE_DIR}/idd/BasementGHT.idd" DESTINATION "${OUTPUT_DIR_PATH}") + file(COPY "${OUTPUT_DIR_PATH}/in.idf" DESTINATION "${OUTPUT_DIR_PATH}/BasementGHTIn.idf") # Find and run basement find_program(BASEMENT_EXE Basement PATHS "${PRODUCT_PATH}" NO_DEFAULT_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH NO_CMAKE_FIND_ROOT_PATH) message("Executing Basement from ${BASEMENT_EXE}") - execute_process(COMMAND "${BASEMENT_EXE}" WORKING_DIRECTORY "${OUTPUT_DIR_PATH}") + execute_process(COMMAND "${BASEMENT_EXE}" WORKING_DIRECTORY "${OUTPUT_DIR_PATH}" COMMAND_ERROR_IS_FATAL ANY) # Then copy basement results into the expanded file file(READ "${OUTPUT_DIR_PATH}/EPObjects.TXT" BASEMENT_CONTENTS) file(APPEND "${OUTPUT_DIR_PATH}/expanded.idf" "${BASEMENT_CONTENTS}")