Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Keep optimization (only_if_different) when cmake is recent enough.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sun, 6 Mar 2022 21:27:45 +0000 (22:27 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sun, 6 Mar 2022 21:29:52 +0000 (22:29 +0100)
[ci-skip]

teshsuite/smpi/MBI/CMakeLists.txt

index 1f7816c..cd70deb 100644 (file)
@@ -35,8 +35,12 @@ if (enable_smpi_MBI_testsuite)
 
   file(GLOB cfiles RELATIVE ${CMAKE_BINARY_DIR}/MBI/tmp ${CMAKE_BINARY_DIR}/MBI/tmp/*.c )
   foreach(cfile ${cfiles})
-    # Copy the generated files only if different
-    file(COPY ${CMAKE_BINARY_DIR}/MBI/tmp/${cfile} DESTINATION ${CMAKE_BINARY_DIR}/MBI/)
+    # Copy the generated files only if different (needs cmake ≥ 3.21)
+    if (CMAKE_VERSION VERSION_LESS 3.21)
+      file(COPY ${CMAKE_BINARY_DIR}/MBI/tmp/${cfile} DESTINATION ${CMAKE_BINARY_DIR}/MBI/)
+    else()
+      file(COPY_FILE ${CMAKE_BINARY_DIR}/MBI/tmp/${cfile} ${CMAKE_BINARY_DIR}/MBI/${cfile} ONLY_IF_DIFFERENT)
+    endif()
     string(REGEX REPLACE "[.]c" "" basefile ${cfile})
     
     # Generate an executable for each of them