From af00f71d481ad612a108605d39bf3be294066fca Mon Sep 17 00:00:00 2001 From: vsr Date: Fri, 9 Oct 2020 12:46:35 +0300 Subject: [PATCH] Add option MED_INT_SIZE to know when medfile is built with med_int=long --- cmake/FindMEDFile.cmake | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/cmake/FindMEDFile.cmake b/cmake/FindMEDFile.cmake index 1e40c63..b12f50b 100644 --- a/cmake/FindMEDFile.cmake +++ b/cmake/FindMEDFile.cmake @@ -1,10 +1,12 @@ # - 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. @@ -41,18 +43,18 @@ IF(MEDFILE_ROOT_DIR) 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) @@ -68,6 +70,11 @@ IF(MEDFile_FOUND) 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) -- 2.39.2