From 6c93c60e8fbaa7f901d2df7bc9a8a9c19b71d315 Mon Sep 17 00:00:00 2001
From: Chuck Atkins <chuck.atkins@kitware.com>
Date: Mon, 24 Apr 2017 11:28:56 -0400
Subject: [PATCH] Prevent ADIOSConfig.h from regenerating every time

---
 cmake/GenerateADIOSConfig.cmake | 40 +++++----------------------------
 source/adios2/ADIOSConfig.h.in  | 27 ++++++++++++++++++++++
 2 files changed, 33 insertions(+), 34 deletions(-)

diff --git a/cmake/GenerateADIOSConfig.cmake b/cmake/GenerateADIOSConfig.cmake
index 914e235ec..d976a3eb2 100644
--- a/cmake/GenerateADIOSConfig.cmake
+++ b/cmake/GenerateADIOSConfig.cmake
@@ -4,45 +4,17 @@
 #------------------------------------------------------------------------------#
 
 function(GenerateADIOSConfig)
-  configure_file(
-    ${ADIOS_SOURCE_DIR}/source/adios2/ADIOSConfig.h.in
-    ${ADIOS_BINARY_DIR}/adios2/ADIOSConfig.h
-  )
-
-  foreach(L IN ITEMS C CXX Fortran)
-    if(NOT CMAKE_${L}_COMPILER)
-      continue()
-    endif()
-    file(APPEND ${ADIOS_BINARY_DIR}/adios2/ADIOSConfig.h
-      " *   ${L}: ${CMAKE_${L}_COMPILER}\n"
-    )
-    if(CMAKE_${L}_COMPILER_WRAPPER)
-      file(APPEND ${ADIOS_BINARY_DIR}/adios2/ADIOSConfig.h
-        " *    Wrapper: ${CMAKE_${L}_COMPILER_WRAPPER}\n"
-      )
-    endif()
-    file(APPEND ${ADIOS_BINARY_DIR}/adios2/ADIOSConfig.h
-      " *    Id: ${CMAKE_${L}_COMPILER_ID} ${CMAKE_${L}_COMPILER_VERSION}\n"
-    )
-  endforeach()
-  file(APPEND ${ADIOS_BINARY_DIR}/adios2/ADIOSConfig.h " */\n")
-
   foreach(OPT IN LISTS ARGN)
     string(TOUPPER ${OPT} OPT_UPPER)
-    file(APPEND ${ADIOS_BINARY_DIR}/adios2/ADIOSConfig.h
-      "\n/* CMake Option: ADIOS_USE_${OPT}=${ADIOS_USE_${OPT}} */\n"
-    )
     if(ADIOS_USE_${OPT})
-      file(APPEND ${ADIOS_BINARY_DIR}/adios2/ADIOSConfig.h
-        "#define ADIOS2_HAVE_${OPT_UPPER} 1\n"
-      )
+      set(ADIOS2_HAVE_${OPT_UPPER} 1)
     else()
-      file(APPEND ${ADIOS_BINARY_DIR}/adios2/ADIOSConfig.h
-        "#undef ADIOS2_HAVE_${OPT_UPPER}\n"
-      )
+      set(ADIOS2_HAVE_${OPT_UPPER})
     endif()
   endforeach()
-  file(APPEND ${ADIOS_BINARY_DIR}/adios2/ADIOSConfig.h
-    "\n#endif /* ADIOSCONFIG_H_ */\n"
+
+  configure_file(
+    ${ADIOS_SOURCE_DIR}/source/adios2/ADIOSConfig.h.in
+    ${ADIOS_BINARY_DIR}/adios2/ADIOSConfig.h
   )
 endfunction()
diff --git a/source/adios2/ADIOSConfig.h.in b/source/adios2/ADIOSConfig.h.in
index 90fb88224..fdbb69b58 100644
--- a/source/adios2/ADIOSConfig.h.in
+++ b/source/adios2/ADIOSConfig.h.in
@@ -16,3 +16,30 @@
  * ADIOS Build Information:
  *
  * Compiler:
+ *   C: @CMAKE_C_COMPILER@
+ *     Id: @CMAKE_C_COMPILER_ID@ @CMAKE_C_COMPILER_VERSION@
+ *   CXX: @CMAKE_CXX_COMPILER@
+ *     Id: @CMAKE_CXX_COMPILER_ID@ @CMAKE_CXX_COMPILER_VERSION@
+ *   Fortran: @CMAKE_CXX_COMPILER@
+ *     Id: @CMAKE_Fortran_COMPILER_ID@ @CMAKE_CXX_COMPILER_VERSION@
+ */
+
+/* CMake Option: ADIOS_USE_MPI=OFF */
+#cmakedefine ADIOS2_HAVE_MPI
+
+/* CMake Option: ADIOS_USE_ZFP=OFF */
+#cmakedefine ADIOS2_HAVE_ZFP
+
+/* CMake Option: ADIOS_USE_BZip2=OFF */
+#cmakedefine ADIOS2_HAVE_BZIP2
+
+/* CMake Option: ADIOS_USE_ADIOS1=ON */
+#cmakedefine ADIOS2_HAVE_ADIOS1
+
+/* CMake Option: ADIOS_USE_HDF5=On */
+#cmakedefine ADIOS2_HAVE_HDF5
+
+/* CMake Option: ADIOS_USE_DataMan=TRUE */
+#cmakedefine ADIOS2_HAVE_DATAMAN
+
+#endif /* ADIOSCONFIG_H_ */
-- 
GitLab