# - Find MED file installation
#
# The following variable are set:
-# MEDFILE_INCLUDE_DIRS
-# MEDFILE_LIBRARIES
-# MEDFILE_C_LIBRARIES
-# MEDFILE_F_LIBRARIES
+# MEDFILE_INCLUDE_DIRS - medfile headers directory
+# MEDFILE_LIBRARIES - medfile libraries
+# MEDFILE_C_LIBRARIES - medfile C libraries
+# MEDFILE_F_LIBRARIES - medfile Fortran libraries
+# MED_INT_SIZE - size of med_int type (bytes): 4 (int) or 8 (long)
+# MED_INT_IS_LONG - boolean flag which is TRUE if med_int is of 8 bytes (long)
#
# The CMake (or environment) variable MEDFILE_ROOT_DIR can be set to
# guide the detection and indicate a root directory to look into.
ENDIF(MEDFILE_ROOT_DIR)
FIND_PATH(MEDFILE_INCLUDE_DIRS med.h)
-#FIND_PROGRAM(MDUMP mdump)
FIND_LIBRARY(MEDFILE_C_LIBRARIES NAMES medC)
FIND_LIBRARY(MEDFILE_F_LIBRARIES NAMES med)
IF(MEDFILE_F_LIBRARIES)
SET(MEDFILE_LIBRARIES ${MEDFILE_C_LIBRARIES} ${MEDFILE_F_LIBRARIES})
ELSE(MEDFILE_F_LIBRARIES)
- SET(MEDFILE_LIBRARIES ${MEDFILE_C_LIBRARIES})
+ SET(MEDFILE_LIBRARIES ${MEDFILE_C_LIBRARIES})
ENDIF(MEDFILE_F_LIBRARIES)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MEDFile REQUIRED_VARS MEDFILE_INCLUDE_DIRS MEDFILE_LIBRARIES)
+SET(MED_INT_IS_LONG FALSE) # fallback value
IF(MEDFile_FOUND)
# Check size of med_int
SET(_med_int_cxx ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_med_int_size.cxx)
ELSE()
SET(MED_INT_SIZE UNKNOWN)
ENDIF()
+ IF(MED_INT_SIZE EQUAL 8)
+ SET(MED_INT_IS_LONG TRUE)
+ ELSE()
+ SET(MED_INT_IS_LONG FALSE)
+ ENDIF()
MESSAGE(STATUS "Size of med_int is ${MED_INT_SIZE}")
UNSET(_med_int_cxx)
UNSET(_med_int_run_result)