summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2021-02-21 07:04:28 (GMT)
committerBrad King <brad.king@kitware.com>2021-02-22 16:02:37 (GMT)
commitd7c80305410b728fce426ff0891ac9a28c4168e5 (patch)
tree18084c140df5f4105561fd1871cdee89239e446d
parente360dcdec189bdfdf3cdb8c51590fc5246cd7724 (diff)
downloadCMake-d7c80305410b728fce426ff0891ac9a28c4168e5.zip
CMake-d7c80305410b728fce426ff0891ac9a28c4168e5.tar.gz
CMake-d7c80305410b728fce426ff0891ac9a28c4168e5.tar.bz2
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.
-rw-r--r--Modules/FortranCInterface/Detect.cmake19
1 files changed, 11 insertions, 8 deletions
diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake
index 998faf1..9e5726b 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()