summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScot Breitenfeld <brtnfld@hdfgroup.org>2015-08-24 16:07:17 (GMT)
committerScot Breitenfeld <brtnfld@hdfgroup.org>2015-08-24 16:07:17 (GMT)
commit47d97ed2c072926a2039e29f0ddda561fcaf502d (patch)
treefbcab2b0db5417a9827ca37bb0d7167f8e5016cf
parent9d625c0580409601de0f69c1317c7be4af9a122f (diff)
downloadhdf5-47d97ed2c072926a2039e29f0ddda561fcaf502d.zip
hdf5-47d97ed2c072926a2039e29f0ddda561fcaf502d.tar.gz
hdf5-47d97ed2c072926a2039e29f0ddda561fcaf502d.tar.bz2
[svn-r27557] Added build_mod directory and updated the C try_run macro to not check for definitions and does not return unused arguments.
-rw-r--r--config/cmake/HDF5UseFortran.cmake30
-rw-r--r--hl/fortran/src/CMakeLists.txt28
2 files changed, 26 insertions, 32 deletions
diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake
index 02f97f0..f445f54 100644
--- a/config/cmake/HDF5UseFortran.cmake
+++ b/config/cmake/HDF5UseFortran.cmake
@@ -381,9 +381,7 @@ 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 RUN_RESULT_VAR COMPILE_RESULT_VAR RETURN)
-# MSB CHECK WHY THIS CHECK?
-# if (NOT DEFINED ${RUN_RESULT_VAR})
+MACRO (C_RUN FUNCTION CODE RETURN)
message (STATUS "Detecting C ${FUNCTION}")
if (CMAKE_REQUIRED_LIBRARIES)
set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
@@ -395,7 +393,7 @@ MACRO (C_RUN FUNCTION CODE RUN_RESULT_VAR COMPILE_RESULT_VAR RETURN)
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c
${CODE}
)
- TRY_RUN (${RUN_RESULT_VAR} ${COMPILE_RESULT_VAR}
+ 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}"
@@ -404,18 +402,14 @@ MACRO (C_RUN FUNCTION CODE RUN_RESULT_VAR COMPILE_RESULT_VAR RETURN)
set(${RETURN} ${OUTPUT})
- #message ( "Test result1 ${RETURN} ")
- #message ( "Test result3 ${RESULT} ")
- #message ( "Test result2 ${CMAKE_MATCH_0} ")
- #message ( "Test result4 ${CMAKE_MATCH_1} ")
#message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
- #message ( "Test result ${COMPILE_RESULT_VAR} ")
+ #message ( "Test COMPILE_RESULT_VAR ${COMPILE_RESULT_VAR} ")
#message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
- #message ( "Test result ${RUN_RESULT_VAR} ")
+ #message ( "Test RUN_RESULT_VAR ${RUN_RESULT_VAR} ")
#message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
if (${COMPILE_RESULT_VAR})
- if (${RUN_RESULT_VAR} MATCHES 0)
+ if (${RUN_RESULT_VAR} MATCHES 1)
set (${RUN_RESULT_VAR} 1 CACHE INTERNAL "Have C function ${FUNCTION}")
message (STATUS "Testing C ${FUNCTION} - OK")
file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
@@ -424,13 +418,14 @@ MACRO (C_RUN FUNCTION CODE RUN_RESULT_VAR COMPILE_RESULT_VAR RETURN)
)
else ()
message (STATUS "Testing C ${FUNCTION} - Fail")
- set (${RUN_RESULT_VAR} "" CACHE INTERNAL "Have C function ${FUNCTION}")
+ set (${RUN_RESULT_VAR} 0 CACHE INTERNAL "Have C function ${FUNCTION}")
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")
endif ()
+ else ()
+ message (FATAL_ERROR "Compilation of C ${FUNCTION} - Failed")
endif()
-# endif (NOT DEFINED ${RUN_RESULT_VAR})
ENDMACRO (C_RUN)
set(PROG_SRC
@@ -455,17 +450,14 @@ set(PROG_SRC
#else
#define C_LDBL_DIG LDBL_DIG
#endif
- void main() {
+ int main() {
printf(\"%d\\\\n%d\\\\n\", C_LDBL_DIG, C_FLT128_DIG)\\\;
+ return 1\\\;
}
"
)
-C_RUN("maximum decimal precision for C" ${PROG_SRC}
- XX
- YY
- PROG_OUTPUT
-)
+C_RUN("maximum decimal precision for C" ${PROG_SRC} PROG_OUTPUT)
# dnl The output from the above program will be:
# dnl -- LINE 1 -- long double decimal precision
diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt
index 9d110a8..ed2e542 100644
--- a/hl/fortran/src/CMakeLists.txt
+++ b/hl/fortran/src/CMakeLists.txt
@@ -36,6 +36,20 @@ set_target_properties (H5HL_buildiface PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}
)
+if (BUILD_SHARED_LIBS)
+ if (WIN32)
+ set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/\${BUILD_TYPE})
+ else (WIN32)
+ set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared)
+ endif (WIN32)
+else (BUILD_SHARED_LIBS)
+ if (WIN32)
+ set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/\${BUILD_TYPE})
+ else (WIN32)
+ set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
+ endif (WIN32)
+endif (BUILD_SHARED_LIBS)
+
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
@@ -44,6 +58,7 @@ INCLUDE_DIRECTORIES (
${HDF5_F90_SRC_DIR}/src
${HDF5_F90_BINARY_DIR}
${CMAKE_Fortran_MODULE_DIRECTORY}
+ ${MOD_BUILD_DIR}
)
#-----------------------------------------------------------------------------
@@ -169,19 +184,6 @@ endif (BUILD_SHARED_LIBS)
# Add file(s) to CMake Install
#-----------------------------------------------------------------------------
-if (BUILD_SHARED_LIBS)
- if (WIN32)
- set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/\${BUILD_TYPE})
- else (WIN32)
- set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared)
- endif (WIN32)
-else (BUILD_SHARED_LIBS)
- if (WIN32)
- set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/\${BUILD_TYPE})
- else (WIN32)
- set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
- endif (WIN32)
-endif (BUILD_SHARED_LIBS)
set (mod_files
${MOD_BUILD_DIR}/h5ds.mod