From d7c80305410b728fce426ff0891ac9a28c4168e5 Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Sun, 21 Feb 2021 18:04:28 +1100 Subject: FortranCInterface: Fix misuse of IS_NEWER_THAN in timestamp check When using a file system which only has second resolution timestamps, there is a reasonably high likelihood of timestamps being the same. The IS_NEWER_THAN test returns true when timestamps are the same, so don't redo detection when they match exactly. --- Modules/FortranCInterface/Detect.cmake | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'Modules/FortranCInterface') diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake index 998faf1ecc..9e5726b03a 100644 --- a/Modules/FortranCInterface/Detect.cmake +++ b/Modules/FortranCInterface/Detect.cmake @@ -6,14 +6,17 @@ configure_file(${FortranCInterface_SOURCE_DIR}/Input.cmake.in # Detect the Fortran/C interface on the first run or when the # configuration changes. -if(${FortranCInterface_BINARY_DIR}/Input.cmake - IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Output.cmake - OR ${FortranCInterface_SOURCE_DIR}/Output.cmake.in - IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Output.cmake - OR ${FortranCInterface_SOURCE_DIR}/CMakeLists.txt - IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Output.cmake - OR ${CMAKE_CURRENT_LIST_FILE} - IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Output.cmake +if(NOT EXISTS ${FortranCInterface_BINARY_DIR}/Output.cmake + OR NOT EXISTS ${FortranCInterface_BINARY_DIR}/Input.cmake + OR NOT EXISTS ${FortranCInterface_BINARY_DIR}/Output.cmake.in + OR NOT ${FortranCInterface_BINARY_DIR}/Output.cmake + IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Input.cmake + OR NOT ${FortranCInterface_SOURCE_DIR}/Output.cmake + IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Output.cmake.in + OR NOT ${FortranCInterface_BINARY_DIR}/Output.cmake + IS_NEWER_THAN ${FortranCInterface_SOURCE_DIR}/CMakeLists.txt + OR NOT ${FortranCInterface_BINARY_DIR}/Output.cmake + IS_NEWER_THAN ${CMAKE_CURRENT_LIST_FILE} ) message(CHECK_START "Detecting Fortran/C Interface") else() -- cgit v1.2.1