From 3209d1278fd38121178892a9d0582c007399795f Mon Sep 17 00:00:00 2001
From: Allen Byrne <byrn@hdfgroup.org>
Date: Tue, 2 Oct 2018 18:13:21 -0500
Subject: TRILAB-21 Intel flags

---
 config/cmake/HDF5UseFortran.cmake          |  72 +++++++++---------
 config/cmake/HDFCompilerFlags.cmake        |  77 +++++++++++++-------
 config/cmake_ext_mod/ConfigureChecks.cmake | 113 ++++++++++++++++-------------
 3 files changed, 147 insertions(+), 115 deletions(-)

diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake
index 1f66bad..1766ac8 100644
--- a/config/cmake/HDF5UseFortran.cmake
+++ b/config/cmake/HDF5UseFortran.cmake
@@ -31,10 +31,10 @@ endif ()
 # The provided CMake Fortran macros don't provide a general compile/run function
 # so this one is used.
 #-----------------------------------------------------------------------------
-macro (FORTRAN_RUN FUNCTION CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR RETURN)
+macro (FORTRAN_RUN FUNCTION_NAME SOURCE_CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR RETURN_VAR)
 #
 #  if (NOT DEFINED ${RUN_RESULT_VAR})
-    message (STATUS "Detecting Fortran ${FUNCTION}")
+    message (STATUS "Detecting Fortran ${FUNCTION_NAME}")
     if (CMAKE_REQUIRED_LIBRARIES)
       set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
           "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
@@ -43,18 +43,18 @@ macro (FORTRAN_RUN FUNCTION CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR RETURN)
     endif ()
     file (WRITE
         ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler1.f90
-        "${CODE}"
+        "${SOURCE_CODE}"
     )
     TRY_RUN (RUN_RESULT_VAR COMPILE_RESULT_VAR
         ${CMAKE_BINARY_DIR}
         ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler1.f90
         CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}"
-        RUN_OUTPUT_VARIABLE OUTPUT
+        RUN_OUTPUT_VARIABLE OUTPUT_VAR
     )
 
-    set(${RETURN} ${OUTPUT})
+    set(${RETURN_VAR} ${OUTPUT_VAR})
 
-    #message ( "Test result1 ${RETURN} ")
+    #message ( "Test result1 ${RETURN_VAR} ")
     #message ( "Test result3 ${RESULT} ")
     #message ( "Test result2 ${CMAKE_MATCH_0} ")
     #message ( "Test result4 ${CMAKE_MATCH_1} ")
@@ -66,34 +66,34 @@ macro (FORTRAN_RUN FUNCTION CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR RETURN)
 
     if (${COMPILE_RESULT_VAR})
       if (${RUN_RESULT_VAR} MATCHES 0)
-        message (STATUS "Testing Fortran ${FUNCTION} - OK")
+        message (STATUS "Testing Fortran ${FUNCTION_NAME} - OK")
         file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
-          "Determining if the Fortran ${FUNCTION} exists passed with the following output:\n"
-          "${OUTPUT}\n\n"
+          "Determining if the Fortran ${FUNCTION_NAME} exists passed with the following output:\n"
+          "${OUTPUT_VAR}\n\n"
         )
       else ()
-        message (STATUS "Testing Fortran ${FUNCTION} - Fail")
+        message (STATUS "Testing Fortran ${FUNCTION_NAME} - Fail")
         file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
-          "Determining if the Fortran ${FUNCTION} exists failed with the following output:\n"
-          "${OUTPUT}\n\n")
+          "Determining if the Fortran ${FUNCTION_NAME} exists failed with the following output:\n"
+          "${OUTPUT_VAR}\n\n")
       endif ()
     endif ()
 #  endif ()
 endmacro ()
 
 # Read source line beginning at the line matching Input:"START" and ending at the line matching Input:"END"
-macro (READ_SOURCE START END RETURN)
-  file (READ "${HDF5_SOURCE_DIR}/m4/aclocal_fc.f90" CODE)
-  string (REGEX MATCH "${START}[\\\t\\\n\\\r[].+]*${END}" CODE ${CODE})
-  set (RETURN "${CODE}")
+macro (READ_SOURCE SOURCE_START SOURCE_END RETURN_VAR)
+  file (READ "${HDF5_SOURCE_DIR}/m4/aclocal_fc.f90" SOURCE_CODE)
+  string (REGEX MATCH "${SOURCE_START}[\\\t\\\n\\\r[].+]*${SOURCE_END}" SOURCE_CODE ${SOURCE_CODE})
+  set (RETURN_VAR "${SOURCE_CODE}")
 endmacro ()
 
 #-----------------------------------------------------------------------------
 #  Check to see C_LONG_DOUBLE is available
 
-READ_SOURCE("PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE" "END PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE" CODE)
+READ_SOURCE("PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE" "END PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE" SOURCE_CODE)
 CHECK_FORTRAN_FEATURE(c_long_double
-  "${CODE}"
+  "${SOURCE_CODE}"
   FORTRAN_HAVE_C_LONG_DOUBLE
 )
 
@@ -105,9 +105,9 @@ endif ()
 
 # Check to see C_LONG_DOUBLE is different from C_DOUBLE
 
-READ_SOURCE("MODULE type_mod" "END PROGRAM PROG_FC_C_LONG_DOUBLE_EQ_C_DOUBLE" CODE)
+READ_SOURCE("MODULE type_mod" "END PROGRAM PROG_FC_C_LONG_DOUBLE_EQ_C_DOUBLE" SOURCE_CODE)
 CHECK_FORTRAN_FEATURE(c_long_double
-  "${CODE}"
+  "${SOURCE_CODE}"
   FORTRAN_C_LONG_DOUBLE_IS_UNIQUE
 )
 if (${FORTRAN_C_LONG_DOUBLE_IS_UNIQUE})
@@ -133,9 +133,9 @@ endif ()
 # Determine the available KINDs for REALs and INTEGERs
 #-----------------------------------------------------------------------------
 
-READ_SOURCE ("PROGRAM FC_AVAIL_KINDS" "END PROGRAM FC_AVAIL_KINDS" CODE)
+READ_SOURCE ("PROGRAM FC_AVAIL_KINDS" "END PROGRAM FC_AVAIL_KINDS" SOURCE_CODE)
 FORTRAN_RUN ("REAL and INTEGER KINDs"
-  "${CODE}"
+  "${SOURCE_CODE}"
   XX
   YY
   PROG_OUTPUT
@@ -372,8 +372,8 @@ ENABLE_LANGUAGE (C)
 # The provided CMake C macros don't provide a general compile/run function
 # so this one is used.
 #-----------------------------------------------------------------------------
-macro (C_RUN FUNCTION CODE RETURN)
-    message (STATUS "Detecting C ${FUNCTION}")
+macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR)
+    message (STATUS "Detecting C ${FUNCTION_NAME}")
     if (CMAKE_REQUIRED_LIBRARIES)
       set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
           "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
@@ -382,16 +382,16 @@ macro (C_RUN FUNCTION CODE RETURN)
     endif ()
     file (WRITE
         ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c
-        ${CODE}
+        ${SOURCE_CODE}
     )
     TRY_RUN (RUN_RESULT_VAR COMPILE_RESULT_VAR
         ${CMAKE_BINARY_DIR}
         ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c
         CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}"
-        RUN_OUTPUT_VARIABLE OUTPUT
+        RUN_OUTPUT_VARIABLE OUTPUT_VAR
     )
 
-    set (${RETURN} ${OUTPUT})
+    set (${RETURN_VAR} ${OUTPUT_VAR})
 
     #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
     #message ( "Test COMPILE_RESULT_VAR ${COMPILE_RESULT_VAR} ")
@@ -401,21 +401,21 @@ macro (C_RUN FUNCTION CODE RETURN)
 
     if (${COMPILE_RESULT_VAR})
       if (${RUN_RESULT_VAR} MATCHES 1)
-        set (${RUN_RESULT_VAR} 1 CACHE INTERNAL "Have C function ${FUNCTION}")
-        message (STATUS "Testing C ${FUNCTION} - OK")
+        set (${RUN_RESULT_VAR} 1 CACHE INTERNAL "Have C function ${FUNCTION_NAME}")
+        message (STATUS "Testing C ${FUNCTION_NAME} - OK")
         file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
-            "Determining if the C ${FUNCTION} exists passed with the following output:\n"
-            "${OUTPUT}\n\n"
+            "Determining if the C ${FUNCTION_NAME} exists passed with the following output:\n"
+            "${OUTPUT_VAR}\n\n"
         )
       else ()
-        message (STATUS "Testing C ${FUNCTION} - Fail")
-        set (${RUN_RESULT_VAR} 0 CACHE INTERNAL "Have C function ${FUNCTION}")
+        message (STATUS "Testing C ${FUNCTION_NAME} - Fail")
+        set (${RUN_RESULT_VAR} 0 CACHE INTERNAL "Have C function ${FUNCTION_NAME}")
         file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
-            "Determining if the C ${FUNCTION} exists failed with the following output:\n"
-            "${OUTPUT}\n\n")
+            "Determining if the C ${FUNCTION_NAME} exists failed with the following output:\n"
+            "${OUTPUT_VAR}\n\n")
       endif ()
     else ()
-        message (FATAL_ERROR "Compilation of C ${FUNCTION} - Failed")
+        message (FATAL_ERROR "Compilation of C ${FUNCTION_NAME} - Failed")
     endif ()
 endmacro ()
 
diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake
index ec13272..93ebc3c 100644
--- a/config/cmake/HDFCompilerFlags.cmake
+++ b/config/cmake/HDFCompilerFlags.cmake
@@ -24,7 +24,7 @@ if (CMAKE_COMPILER_IS_GNUCC)
       set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Og -ftrapv -fno-common")
     endif ()
   else ()
-    if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0)
+    if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0)
       set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstdarg-opt")
     endif ()
   endif ()
@@ -36,7 +36,7 @@ if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
       set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ftrapv -fno-common")
     endif ()
   else ()
-    if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
+    if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
       set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstdarg-opt")
     endif ()
   endif ()
@@ -94,16 +94,29 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC)
     #
     # NOTE: Don't add -Wpadded here since we can't/won't fix the (many)
     # warnings that are emitted. If you need it, add it at configure time.
-    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra")
-    set (H5_CFLAGS0 "${H5_CFLAGS0} -Wbad-function-cast -Wc++-compat -Wcast-align")
-    set (H5_CFLAGS0 "${H5_CFLAGS0} -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal")
-    set (H5_CFLAGS0 "${H5_CFLAGS0} -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs")
-    set (H5_CFLAGS0 "${H5_CFLAGS0} -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith")
-    set (H5_CFLAGS0 "${H5_CFLAGS0} -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-default -Wswitch-enum")
-    set (H5_CFLAGS0 "${H5_CFLAGS0} -Wundef -Wunused-macros -Wunsafe-loop-optimizations -Wwrite-strings")
-    # gcc automatically inlines based on the optimization level
-    # this is just a failsafe
-    set (H5_CFLAGS0 "${H5_CFLAGS0} -finline-functions")
+    if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
+      set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wcheck -Wall")
+      set (H5_CFLAGS0 "${H5_CFLAGS0} -Wcomment -Wdeprecated -Wmain -Wmissing-declarations -Wmissing-prototypes -Wp64 -Wpointer-arith")
+      set (H5_CFLAGS0 "${H5_CFLAGS0} -Wreturn-type -Wstrict-prototypes -Wuninitialized")
+      set (H5_CFLAGS0 "${H5_CFLAGS0} -Wunknown-pragmas -Wunused-function -Wunused-variable")
+      # this is just a failsafe
+      set (H5_CFLAGS0 "${H5_CFLAGS0} -finline-functions")
+      if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 18.0)
+        set (H5_CFLAGS0 "${H5_CFLAGS0} -Wextra-tokens -Wformat -Wformat-security -Wic-pointer -Wshadow")
+        set (H5_CFLAGS0 "${H5_CFLAGS0} -Wsign-compare -Wtrigraphs -Wwrite-strings")
+      endif()
+    elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU")
+      set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra")
+      set (H5_CFLAGS0 "${H5_CFLAGS0} -Wbad-function-cast -Wc++-compat -Wcast-align")
+      set (H5_CFLAGS0 "${H5_CFLAGS0} -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal")
+      set (H5_CFLAGS0 "${H5_CFLAGS0} -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs")
+      set (H5_CFLAGS0 "${H5_CFLAGS0} -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith")
+      set (H5_CFLAGS0 "${H5_CFLAGS0} -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-default -Wswitch-enum")
+      set (H5_CFLAGS0 "${H5_CFLAGS0} -Wundef -Wunused-macros -Wunsafe-loop-optimizations -Wwrite-strings")
+      # gcc automatically inlines based on the optimization level
+      # this is just a failsafe
+      set (H5_CFLAGS0 "${H5_CFLAGS0} -finline-functions")
+    endif ()
   endif ()
 
     #-----------------------------------------------------------------------------
@@ -113,28 +126,36 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC)
     option (HDF5_ENABLE_DEV_WARNINGS "Enable HDF5 developer group warnings" OFF)
     if (HDF5_ENABLE_DEV_WARNINGS)
       message (STATUS "....HDF5 developer group warnings are enabled")
-      set (H5_CFLAGS0 "${H5_CFLAGS0} -Winline -Waggregate-return -Wmissing-format-attribute -Wmissing-noreturn")
+      if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
+        set (H5_CFLAGS0 "${H5_CFLAGS0} -Winline -Wreorder -Wport -Wstrict-aliasing")
+      elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU")
+        set (H5_CFLAGS0 "${H5_CFLAGS0} -Winline -Waggregate-return -Wmissing-format-attribute -Wmissing-noreturn")
+      endif ()
     else ()
-      set (H5_CFLAGS0 "${H5_CFLAGS0} -Wno-inline -Wno-aggregate-return -Wno-missing-format-attribute -Wno-missing-noreturn")
+      if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
+        set (H5_CFLAGS0 "${H5_CFLAGS0} -Wno-inline -Wno-aggregate-return -Wno-missing-format-attribute -Wno-missing-noreturn")
+      endif ()
     endif ()
 
 
-    # Append warning flags that only gcc 4.3+ knows about
-    #
-    # Technically, variable-length arrays are part of the C99 standard, but
-    #   we should approach them a bit cautiously... -QAK
-    set (H5_CFLAGS1 "${H5_CFLAGS1} -Wlogical-op -Wlarger-than=2048 -Wvla")
+    if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
+      # Append warning flags that only gcc 4.3+ knows about
+      #
+      # Technically, variable-length arrays are part of the C99 standard, but
+      #   we should approach them a bit cautiously... -QAK
+      set (H5_CFLAGS1 "${H5_CFLAGS1} -Wlogical-op -Wlarger-than=2048 -Wvla")
 
-    # Append more extra warning flags that only gcc 4.4+ know about
-    set (H5_CFLAGS1 "${H5_CFLAGS1} -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat")
+      # Append more extra warning flags that only gcc 4.4+ know about
+      set (H5_CFLAGS1 "${H5_CFLAGS1} -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat")
+    endif ()
 
     # Append more extra warning flags that only gcc 4.5+ know about
-    if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5)
+    if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5)
       set (H5_CFLAGS1 "${H5_CFLAGS1} -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants")
     endif ()
 
     # Append more extra warning flags that only gcc 4.6+ know about
-    if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
+    if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
       set (H5_CFLAGS2 "${H5_CFLAGS2} -Wdouble-promotion -Wtrampolines")
       if (HDF5_ENABLE_DEV_WARNINGS)
         set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsuggest-attribute=const")
@@ -144,7 +165,7 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC)
     endif ()
 
     # Append more extra warning flags that only gcc 4.7+ know about
-    if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7)
+    if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7)
       set (H5_CFLAGS2 "${H5_CFLAGS2} -Wstack-usage=8192 -Wvector-operation-performance")
       if (HDF5_ENABLE_DEV_WARNINGS)
         set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn")
@@ -154,7 +175,7 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC)
     endif ()
 
     # Append more extra warning flags that only gcc 4.8+ know about
-    if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8)
+    if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8)
       if (HDF5_ENABLE_DEV_WARNINGS)
         set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsuggest-attribute=format")
       else ()
@@ -163,17 +184,17 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC)
     endif ()
 
     # Append more extra warning flags that only gcc 4.9+ know about
-    if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9)
+    if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9)
       set (H5_CFLAGS2 "${H5_CFLAGS2} -Wdate-time")
     endif ()
 
     # Append more extra warning flags that only gcc 5.1+ know about
-    if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.1)
+    if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.1)
       set (H5_CFLAGS3 "${H5_CFLAGS3} -Warray-bounds=2 -Wc99-c11-compat")
     endif ()
 
     # Append more extra warning flags that only gcc 6.x+ know about
-    if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0)
+    if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0)
       set (H5_CFLAGS4 "${H5_CFLAGS4} -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa")
     endif ()
 
diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake
index 9be30f7..3ab47fc 100644
--- a/config/cmake_ext_mod/ConfigureChecks.cmake
+++ b/config/cmake_ext_mod/ConfigureChecks.cmake
@@ -279,36 +279,42 @@ if (NOT WINDOWS)
   option (HDF_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON)
   if (HDF_ENABLE_LARGE_FILE)
     set (msg "Performing TEST_LFS_WORKS")
-    TRY_RUN (TEST_LFS_WORKS_RUN   TEST_LFS_WORKS_COMPILE
-        ${CMAKE_BINARY_DIR}
-        ${HDF_RESOURCES_EXT_DIR}/HDFTests.c
-        CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=-DTEST_LFS_WORKS
-        OUTPUT_VARIABLE OUTPUT
-    )
+    if (CMAKE_CROSSCOMPILING)
+      set (TEST_LFS_WORKS 1 CACHE INTERNAL ${msg})
+      set (LARGEFILE 1)
+      set (HDF_EXTRA_FLAGS ${HDF_EXTRA_FLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE)
+      message (STATUS "${msg} with presets... yes")
+    else ()
+      TRY_RUN (TEST_LFS_WORKS_RUN   TEST_LFS_WORKS_COMPILE
+          ${CMAKE_BINARY_DIR}
+          ${HDF_RESOURCES_EXT_DIR}/HDFTests.c
+          CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=-DTEST_LFS_WORKS
+      )
 
-    # The LARGEFILE definitions were from the transition period
-    # and are probably no longer needed. The FILE_OFFSET_BITS
-    # check should be generalized for all POSIX systems as it
-    # is in the Autotools.
-    if (TEST_LFS_WORKS_COMPILE)
-      if (TEST_LFS_WORKS_RUN MATCHES 0)
-        set (TEST_LFS_WORKS 1 CACHE INTERNAL ${msg})
-        set (LARGEFILE 1)
-        set (HDF_EXTRA_FLAGS ${HDF_EXTRA_FLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE)
-        message (STATUS "${msg}... yes")
+      # The LARGEFILE definitions were from the transition period
+      # and are probably no longer needed. The FILE_OFFSET_BITS
+      # check should be generalized for all POSIX systems as it
+      # is in the Autotools.
+      if (TEST_LFS_WORKS_COMPILE)
+        if (TEST_LFS_WORKS_RUN MATCHES 0)
+          set (TEST_LFS_WORKS 1 CACHE INTERNAL ${msg})
+          set (LARGEFILE 1)
+          set (HDF_EXTRA_FLAGS ${HDF_EXTRA_FLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE)
+          message (STATUS "${msg}... yes")
+        else ()
+          set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg})
+          message (STATUS "${msg}... no")
+          file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+                "Test TEST_LFS_WORKS Run failed with the following exit code:\n ${TEST_LFS_WORKS_RUN}\n"
+          )
+        endif ()
       else ()
         set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg})
         message (STATUS "${msg}... no")
         file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
-              "Test TEST_LFS_WORKS Run failed with the following output and exit code:\n ${OUTPUT}\n"
+            "Test TEST_LFS_WORKS Compile failed\n"
         )
       endif ()
-    else ()
-      set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg})
-      message (STATUS "${msg}... no")
-      file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
-          "Test TEST_LFS_WORKS Compile failed with the following output:\n ${OUTPUT}\n"
-      )
     endif ()
   endif ()
   set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${HDF_EXTRA_FLAGS})
@@ -641,37 +647,42 @@ endforeach ()
 if (NOT ${HDF_PREFIX}_PRINTF_LL_WIDTH OR ${HDF_PREFIX}_PRINTF_LL_WIDTH MATCHES "unknown")
   set (PRINT_LL_FOUND 0)
   message (STATUS "Checking for appropriate format for 64 bit long:")
-  set (CURRENT_TEST_DEFINITIONS "-DPRINTF_LL_WIDTH")
-  if (${HDF_PREFIX}_SIZEOF_LONG_LONG)
-    set (CURRENT_TEST_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -DHAVE_LONG_LONG")
-  endif ()
-  TRY_RUN (${HDF_PREFIX}_PRINTF_LL_TEST_RUN   ${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE
-      ${CMAKE_BINARY_DIR}
-      ${HDF_RESOURCES_EXT_DIR}/HDFTests.c
-      CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CURRENT_TEST_DEFINITIONS}
-      OUTPUT_VARIABLE OUTPUT
-  )
-  if (${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE)
-    if (${HDF_PREFIX}_PRINTF_LL_TEST_RUN MATCHES 0)
-      string(REGEX REPLACE ".*PRINTF_LL_WIDTH=\\[(.*)\\].*" "\\1" ${HDF_PREFIX}_PRINTF_LL "${OUTPUT}")
-      set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"${${HDF_PREFIX}_PRINTF_LL}\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll")
-      set (PRINT_LL_FOUND 1)
-    else ()
-      message ("Width test failed with result: ${${HDF_PREFIX}_PRINTF_LL_TEST_RUN}")
-    endif ()
+  if (CMAKE_CROSSCOMPILING)
+      set (${HDF_PREFIX}_PRINTF_LL_WIDTH ${PRESET_PRINTF_LL})
+      message (STATUS "Checking for appropriate format for 64 bit long: force ${${HDF_PREFIX}_PRINTF_LL_WIDTH}")
   else ()
-    file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
-        "Test ${HDF_PREFIX}_PRINTF_LL_WIDTH failed with the following output:\n ${OUTPUT}\n"
+    set (CURRENT_TEST_DEFINITIONS "-DPRINTF_LL_WIDTH")
+    if (${HDF_PREFIX}_SIZEOF_LONG_LONG)
+      set (CURRENT_TEST_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -DHAVE_LONG_LONG")
+    endif ()
+    TRY_RUN (${HDF_PREFIX}_PRINTF_LL_TEST_RUN   ${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE
+        ${CMAKE_BINARY_DIR}
+        ${HDF_RESOURCES_EXT_DIR}/HDFTests.c
+        CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CURRENT_TEST_DEFINITIONS}
+        RUN_OUTPUT_VARIABLE OUTPUT
     )
-  endif ()
+    if (${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE)
+      if (${HDF_PREFIX}_PRINTF_LL_TEST_RUN MATCHES 0)
+        string(REGEX REPLACE ".*PRINTF_LL_WIDTH=\\[(.*)\\].*" "\\1" ${HDF_PREFIX}_PRINTF_LL "${OUTPUT}")
+        set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"${${HDF_PREFIX}_PRINTF_LL}\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll")
+        set (PRINT_LL_FOUND 1)
+      else ()
+        message ("Width test failed with result: ${${HDF_PREFIX}_PRINTF_LL_TEST_RUN}")
+      endif ()
+    else ()
+      file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
+          "Test ${HDF_PREFIX}_PRINTF_LL_WIDTH failed\n"
+      )
+    endif ()
 
-  if (PRINT_LL_FOUND)
-    message (STATUS "Checking for appropriate format for 64 bit long: found ${${HDF_PREFIX}_PRINTF_LL_WIDTH}")
-  else ()
-    message (STATUS "Checking for appropriate format for 64 bit long: not found")
-    set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"unknown\"" CACHE INTERNAL
-        "Width for printf for type `long long' or `__int64', us. `ll"
-    )
+    if (PRINT_LL_FOUND)
+      message (STATUS "Checking for appropriate format for 64 bit long: found ${${HDF_PREFIX}_PRINTF_LL_WIDTH}")
+    else ()
+      message (STATUS "Checking for appropriate format for 64 bit long: not found")
+      set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"unknown\"" CACHE INTERNAL
+          "Width for printf for type `long long' or `__int64', us. `ll"
+      )
+    endif ()
   endif ()
 endif ()
 
-- 
cgit v0.12


From c5256dcd9d8a20f08e2e4a73f1c9b4be71abe0a9 Mon Sep 17 00:00:00 2001
From: Allen Byrne <byrn@hdfgroup.org>
Date: Wed, 3 Oct 2018 16:24:46 -0500
Subject: Fix undef for Xl compilers

---
 fortran/src/H5config_f.inc.cmake | 36 +++++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/fortran/src/H5config_f.inc.cmake b/fortran/src/H5config_f.inc.cmake
index b8d5355..aa3d135 100644
--- a/fortran/src/H5config_f.inc.cmake
+++ b/fortran/src/H5config_f.inc.cmake
@@ -12,16 +12,19 @@
 ! fortran/src/H5config_f.inc. Generated from fortran/src/H5config_f.inc.in by configure
 
 ! Define if we have parallel support
-#cmakedefine H5_HAVE_PARALLEL @H5_HAVE_PARALLEL@
+#cmakedefine01 H5_HAVE_PARALLEL @H5_HAVE_PARALLEL@
+#if H5_HAVE_PARALLEL == 0
+#undef H5_HAVE_PARALLEL
+#endif
 
 ! Define if the intrinsic function STORAGE_SIZE exists
-#cmakedefine H5_FORTRAN_HAVE_STORAGE_SIZE @H5_FORTRAN_HAVE_STORAGE_SIZE@
+#define H5_FORTRAN_HAVE_STORAGE_SIZE @H5_FORTRAN_HAVE_STORAGE_SIZE@
 
 ! Define if the intrinsic function SIZEOF exists
-#cmakedefine H5_FORTRAN_HAVE_SIZEOF @H5_FORTRAN_HAVE_SIZEOF@
+#define H5_FORTRAN_HAVE_SIZEOF @H5_FORTRAN_HAVE_SIZEOF@
 
 ! Define if the intrinsic function C_SIZEOF exists
-#cmakedefine H5_FORTRAN_HAVE_C_SIZEOF @H5_FORTRAN_HAVE_C_SIZEOF@
+#define H5_FORTRAN_HAVE_C_SIZEOF @H5_FORTRAN_HAVE_C_SIZEOF@
 
 ! Define if the intrinsic C_LONG_DOUBLE exists
 #define H5_FORTRAN_HAVE_C_LONG_DOUBLE @H5_FORTRAN_HAVE_C_LONG_DOUBLE@
@@ -30,41 +33,40 @@
 #define H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE @H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE@
 
 ! Define if the intrinsic module ISO_FORTRAN_ENV exists
-#cmakedefine H5_HAVE_ISO_FORTRAN_ENV @H5_HAVE_ISO_FORTRAN_ENV@
-
+#define H5_HAVE_ISO_FORTRAN_ENV @H5_HAVE_ISO_FORTRAN_ENV@
 
 ! should this be ${HDF_PREFIX} instead of H5 MSB
-#cmakedefine H5_SIZEOF_DOUBLE @H5_SIZEOF_DOUBLE@
+#define H5_SIZEOF_DOUBLE @H5_SIZEOF_DOUBLE@
 
 ! should this be ${HDF_PREFIX} instead of H5 MSB
-#cmakedefine H5_SIZEOF_LONG_DOUBLE @H5_SIZEOF_LONG_DOUBLE@
+#define H5_SIZEOF_LONG_DOUBLE @H5_SIZEOF_LONG_DOUBLE@
 
 ! Define the maximum decimal precision for reals
-#cmakedefine H5_PAC_FC_MAX_REAL_PRECISION @H5_PAC_FC_MAX_REAL_PRECISION@
+#define H5_PAC_FC_MAX_REAL_PRECISION @H5_PAC_FC_MAX_REAL_PRECISION@
 
 ! If C has quad precision
-#cmakedefine H5_HAVE_FLOAT128 @H5_HAVE_FLOAT128@
+#define H5_HAVE_FLOAT128 @H5_HAVE_FLOAT128@
 
 ! Define if INTEGER*16 is available
 #define H5_HAVE_Fortran_INTEGER_SIZEOF_16 @H5_HAVE_Fortran_INTEGER_SIZEOF_16@
 
 ! Maximum decimal precision for C
-#cmakedefine H5_PAC_C_MAX_REAL_PRECISION @H5_PAC_C_MAX_REAL_PRECISION@
+#define H5_PAC_C_MAX_REAL_PRECISION @H5_PAC_C_MAX_REAL_PRECISION@
 
 ! number of valid REAL KINDs
-#cmakedefine H5_H5CONFIG_F_NUM_RKIND @H5_H5CONFIG_F_NUM_RKIND@
+#define H5_H5CONFIG_F_NUM_RKIND @H5_H5CONFIG_F_NUM_RKIND@
 
 ! valid REAL KINDs (need to have a matching C counter-part)
-#cmakedefine H5_H5CONFIG_F_RKIND @H5_H5CONFIG_F_RKIND@
+#define H5_H5CONFIG_F_RKIND @H5_H5CONFIG_F_RKIND@
 
 ! valid REAL KINDs (need to have a matching C counter-part)
-#cmakedefine H5_H5CONFIG_F_RKIND_SIZEOF @H5_H5CONFIG_F_RKIND_SIZEOF@
+#define H5_H5CONFIG_F_RKIND_SIZEOF @H5_H5CONFIG_F_RKIND_SIZEOF@
 
 ! number of valid INTEGER KINDs
-#cmakedefine H5_H5CONFIG_F_NUM_IKIND @H5_H5CONFIG_F_NUM_IKIND@
+#define H5_H5CONFIG_F_NUM_IKIND @H5_H5CONFIG_F_NUM_IKIND@
 
 ! valid INTEGER KINDs (need to have a matching C counter-part)
-#cmakedefine H5_H5CONFIG_F_IKIND @H5_H5CONFIG_F_IKIND@
+#define H5_H5CONFIG_F_IKIND @H5_H5CONFIG_F_IKIND@
 
 ! Fortran compiler id
-#cmakedefine H5_Fortran_COMPILER_ID @Fortran_COMPILER_ID@
+#define H5_Fortran_COMPILER_ID @CMAKE_Fortran_COMPILER_ID@
-- 
cgit v0.12


From 284cb8ffc06e39d16fe0e436beff7587be54ed50 Mon Sep 17 00:00:00 2001
From: Allen Byrne <byrn@hdfgroup.org>
Date: Thu, 4 Oct 2018 10:42:44 -0500
Subject: TRILABS-21 Add intel compiler support

---
 MANIFEST                                | 2 ++
 config/cmake/HDF5UseFortran.cmake       | 6 +++++-
 config/cmake_ext_mod/HDFLibMacros.cmake | 9 +++++++++
 config/intel.cmake                      | 8 ++++++++
 4 files changed, 24 insertions(+), 1 deletion(-)
 create mode 100644 config/intel.cmake

diff --git a/MANIFEST b/MANIFEST
index 117c531..317e156 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -3148,6 +3148,8 @@
 ./java/lib/ext/slf4j-simple-1.7.25.jar
 
 # CMake-specific Files
+./config/intel.cmake
+
 ./config/cmake/cacheinit.cmake
 ./config/cmake/CMakeFindJavaCommon.cmake
 ./config/cmake/ConversionTests.c
diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake
index 1766ac8..e260f0c 100644
--- a/config/cmake/HDF5UseFortran.cmake
+++ b/config/cmake/HDF5UseFortran.cmake
@@ -33,7 +33,11 @@ endif ()
 #-----------------------------------------------------------------------------
 macro (FORTRAN_RUN FUNCTION_NAME SOURCE_CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR RETURN_VAR)
 #
-#  if (NOT DEFINED ${RUN_RESULT_VAR})
+#   if (CMAKE_CROSSCOMPILING)
+#      set (${OUTPUT_VAR} ${PRESET_${FUNCTION_NAME}})
+#      message (STATUS "Detecting Fortran ${FUNCTION_NAME}: force ${OUTPUT_VAR}")
+#      set(${RETURN_VAR} ${OUTPUT_VAR})
+#  else ()
     message (STATUS "Detecting Fortran ${FUNCTION_NAME}")
     if (CMAKE_REQUIRED_LIBRARIES)
       set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
diff --git a/config/cmake_ext_mod/HDFLibMacros.cmake b/config/cmake_ext_mod/HDFLibMacros.cmake
index 54e408b..8a37af3 100644
--- a/config/cmake_ext_mod/HDFLibMacros.cmake
+++ b/config/cmake_ext_mod/HDFLibMacros.cmake
@@ -30,6 +30,7 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic)
             -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
             -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY}
             -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic}
+            -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
     )
   elseif (${compress_type} MATCHES "GIT")
     EXTERNALPROJECT_ADD (JPEG
@@ -47,6 +48,7 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic)
             -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
             -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY}
             -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic}
+            -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
     )
   elseif (${compress_type} MATCHES "TGZ")
     EXTERNALPROJECT_ADD (JPEG
@@ -64,6 +66,7 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic)
             -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
             -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY}
             -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic}
+            -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
     )
   endif ()
   externalproject_get_property (JPEG BINARY_DIR SOURCE_DIR)
@@ -121,6 +124,7 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding)
             -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY}
             -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
             -DSZIP_ENABLE_ENCODING:BOOL=${encoding}
+            -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
     )
   elseif (${compress_type} MATCHES "GIT")
     EXTERNALPROJECT_ADD (SZIP
@@ -139,6 +143,7 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding)
             -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY}
             -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
             -DSZIP_ENABLE_ENCODING:BOOL=${encoding}
+            -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
     )
   elseif (${compress_type} MATCHES "TGZ")
     EXTERNALPROJECT_ADD (SZIP
@@ -157,6 +162,7 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding)
             -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY}
             -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
             -DSZIP_ENABLE_ENCODING:BOOL=${encoding}
+            -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
     )
   endif ()
   externalproject_get_property (SZIP BINARY_DIR SOURCE_DIR)
@@ -213,6 +219,7 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type)
             -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
             -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY}
             -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
+            -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
     )
   elseif (${compress_type} MATCHES "GIT")
     EXTERNALPROJECT_ADD (ZLIB
@@ -230,6 +237,7 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type)
             -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
             -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY}
             -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
+            -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
     )
   elseif (${compress_type} MATCHES "TGZ")
     EXTERNALPROJECT_ADD (ZLIB
@@ -247,6 +255,7 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type)
             -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
             -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY}
             -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
+            -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
     )
   endif ()
   externalproject_get_property (ZLIB BINARY_DIR SOURCE_DIR)
diff --git a/config/intel.cmake b/config/intel.cmake
new file mode 100644
index 0000000..ee16a0f
--- /dev/null
+++ b/config/intel.cmake
@@ -0,0 +1,8 @@
+#set(CMAKE_SYSTEM_NAME Linux)
+set(CMAKE_COMPILER_VENDOR "intel")
+
+set(CMAKE_C_COMPILER icc)
+set(CMAKE_CXX_COMPILER icpc)
+set(CMAKE_Fortran_COMPILER ifort)
+ 
+set(PRESET_PRINTF_LL "ll")
-- 
cgit v0.12


From 2a95ab5acbe032f58891b653f56b9db8a4938d95 Mon Sep 17 00:00:00 2001
From: Allen Byrne <byrn@hdfgroup.org>
Date: Thu, 4 Oct 2018 11:40:33 -0500
Subject: TRILABS-21 add toolchain related info and files

---
 config/cmake/scripts/HDF5options.cmake |  5 +++++
 config/intel.cmake                     |  6 ++++--
 release_docs/INSTALL_CMake.txt         | 28 ++++++++++++++++++++++++++++
 3 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake
index 3e6aad0..80a28d3 100755
--- a/config/cmake/scripts/HDF5options.cmake
+++ b/config/cmake/scripts/HDF5options.cmake
@@ -96,3 +96,8 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING
 set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACKAGE_EXTLIBS:BOOL=ON")
 
 #############################################################################################
+### use a toolchain file
+
+#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/intel.cmake")
+
+#############################################################################################
diff --git a/config/intel.cmake b/config/intel.cmake
index ee16a0f..5ef9282 100644
--- a/config/intel.cmake
+++ b/config/intel.cmake
@@ -1,8 +1,10 @@
+# Uncomment the following to use cross-compiling
 #set(CMAKE_SYSTEM_NAME Linux)
 set(CMAKE_COMPILER_VENDOR "intel")
 
 set(CMAKE_C_COMPILER icc)
 set(CMAKE_CXX_COMPILER icpc)
 set(CMAKE_Fortran_COMPILER ifort)
- 
-set(PRESET_PRINTF_LL "ll")
+
+# the following is used if cross-compiling
+set(PRESET_PRINTF_LL "l")
diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt
index 7352dae..edd876a 100644
--- a/release_docs/INSTALL_CMake.txt
+++ b/release_docs/INSTALL_CMake.txt
@@ -324,6 +324,34 @@ IV. Further considerations
                -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF \
                -DCMAKE_BUILD_TYPE:STRING=Release ..
 
+   6. CMake uses a toolchain of utilities to compile, link libraries and
+      create archives, and other tasks to drive the build. The toolchain
+      utilities available are determined by the languages enabled. In normal
+      builds, CMake automatically determines the toolchain for host builds
+      based on system introspection and defaults. In cross-compiling
+      scenarios, a toolchain file may be specified with information about
+      compiler and utility paths.
+                Variables and Properties
+      Several variables relate to the language components of a toolchain which
+      are enabled. CMAKE_<LANG>_COMPILER is the full path to the compiler used
+      for <LANG>. CMAKE_<LANG>_COMPILER_ID is the identifier used by CMake for
+      the compiler and CMAKE_<LANG>_COMPILER_VERSION is the version of the compiler.
+
+      The CMAKE_<LANG>_FLAGS variables and the configuration-specific equivalents
+      contain flags that will be added to the compile command when compiling a
+      file of a particular language.
+
+      As the linker is invoked by the compiler driver, CMake needs a way to
+      determine which compiler to use to invoke the linker. This is calculated
+      by the LANGUAGE of source files in the target, and in the case of static
+      libraries, the language of the dependent libraries. The choice CMake makes
+      may be overridden with the LINKER_LANGUAGE target property.
+
+      See the CMake help for more information on using toolchain files.
+
+      To use a toolchain file with the supplied cmake scripts, see the
+      HDF5options.cmake file under the toolchain section.
+
 Notes: CMake and HDF5
 
    1. Using CMake for building and using HDF5 is under active development.
-- 
cgit v0.12