diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2018-10-04 18:04:53 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2018-10-04 18:04:53 (GMT) |
commit | 36594716c34547d2fa4cfdf576193022a64557a8 (patch) | |
tree | fa8b2911bafa42e15e0d40e59d6cddf9f509e701 /config/cmake/HDF5UseFortran.cmake | |
parent | d581cbeb9e06e4670f06608eb24bd65e17cd2b14 (diff) | |
parent | 2a95ab5acbe032f58891b653f56b9db8a4938d95 (diff) | |
download | hdf5-36594716c34547d2fa4cfdf576193022a64557a8.zip hdf5-36594716c34547d2fa4cfdf576193022a64557a8.tar.gz hdf5-36594716c34547d2fa4cfdf576193022a64557a8.tar.bz2 |
Merge pull request #1277 in HDFFV/hdf5 from ~BYRN/hdf5_adb:develop to develop
* commit '2a95ab5acbe032f58891b653f56b9db8a4938d95':
TRILABS-21 add toolchain related info and files
TRILABS-21 Add intel compiler support
Fix undef for Xl compilers
TRILAB-21 Intel flags
Diffstat (limited to 'config/cmake/HDF5UseFortran.cmake')
-rw-r--r-- | config/cmake/HDF5UseFortran.cmake | 78 |
1 files changed, 41 insertions, 37 deletions
diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index 1f66bad..e260f0c 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -31,10 +31,14 @@ 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}") +# 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 "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") @@ -43,18 +47,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 +70,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 +109,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 +137,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 +376,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 +386,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 +405,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 () |