1 # Copyright (C) 2013-2024 CEA, EDF, OPEN CASCADE
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 # Author: Adrien Bruneton
22 # Medfile detection for Salome
24 # !! Please read the generic detection procedure in SalomeMacros.cmake !!
27 SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(MEDFile MEDFILE_INCLUDE_DIRS 1)
30 SET(MED_INT_IS_LONG FALSE) # fallback value
32 SALOME_ACCUMULATE_HEADERS(MEDFILE_INCLUDE_DIRS)
33 SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH ${MEDFILE_LIBRARIES})
35 # Check size of med_int
36 SET(_med_int_cxx ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_med_int_size.cxx)
37 FILE(WRITE ${_med_int_cxx}
38 "#include <med.h>\n#include <stdio.h>\nint main(){printf(\"%d\", sizeof(med_int)); return 0;}")
39 TRY_RUN(_med_int_run_result _med_int_compile_results
40 ${CMAKE_BINARY_DIR} ${_med_int_cxx}
41 CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${MEDFILE_INCLUDE_DIRS};${HDF5_INCLUDE_DIR}"
42 LINK_LIBRARIES ${MEDFILE_C_LIBRARIES} ${HDF5_LIBRARIES}
43 RUN_OUTPUT_VARIABLE _med_int_output)
44 IF(_med_int_compile_results)
45 SET(MED_INT_SIZE ${_med_int_output})
47 SET(MED_INT_SIZE UNKNOWN)
49 IF(MED_INT_SIZE EQUAL 8)
50 SET(MED_INT_IS_LONG TRUE)
52 SET(MED_INT_IS_LONG FALSE)
54 MESSAGE(STATUS "MEDFile: size of med_int is ${MED_INT_SIZE}")
56 UNSET(_med_int_run_result)
57 UNSET(_med_int_compile_results)
58 UNSET(_med_int_output)