2 # Once done this will define
4 # MOAB_DIR - directory in which MOAB resides
6 # If unset, try environment
8 set(MOAB_DIR $ENV{MOAB_DIR})
11 find_file(MOAB_VARIABLES_FILE moab.make HINTS ${MOAB_DIR}/lib)
13 if(NOT MOAB_VARIABLES_FILE)
14 message(FATAL_ERROR ${MOAB_VARIABLES_FILE})
15 endif(NOT MOAB_VARIABLES_FILE)
17 find_file (MBCONVERT NAMES mbconvert mbconvert.exe HINTS ${MOAB_DIR}/bin)
19 message(FATAL_ERROR ${MBCONVERT})
22 set(MOAB_INCLUDES_COUNTER 0)
24 file(STRINGS ${MOAB_VARIABLES_FILE} MOAB_VARIABLES)
25 foreach(LINE ${MOAB_VARIABLES})
26 if(NOT LINE MATCHES "^#.*")
27 string(REGEX REPLACE "=" ";" FIELDS ${LINE})
28 list(GET FIELDS 0 VAR)
29 string(REGEX REPLACE " " "" VARSTRIP ${VAR})
31 if(${VARSTRIP} STREQUAL MOAB_INCLUDES)
32 set(VARSTRIPEXT "${VARSTRIP}${MOAB_INCLUDES_COUNTER}")
33 string(REGEX REPLACE "${VARSTRIP} *=" "" VAL ${LINE})
34 set("${VARSTRIPEXT}" ${VAL} CACHE INTERNAL "moab varible")
35 set(MOAB_INCLUDES_COUNTER 1)
36 # message(STATUS ${VARSTRIPEXT})
37 # message(STATUS ${VAL})
38 else (${VARSTRIP} STREQUAL MOAB_INCLUDES)
39 string(REGEX REPLACE "${VARSTRIP} *=" "" VAL ${LINE})
40 # message(STATUS ${VARSTRIP})
41 # message(STATUS ${VAL})
42 set(${VARSTRIP} ${VAL} CACHE INTERNAL "moab varible")
43 endif(${VARSTRIP} STREQUAL MOAB_INCLUDES)
45 endif(NOT LINE MATCHES "^#.*")
46 endforeach(LINE ${MOAB_VARIABLES})
48 # Add moab definitions
50 resolve_definitions(MOAB_DEFINITIONS ${MOAB_CPPFLAGS})
51 message(STATUS ${MOAB_DEFINITIONS})
52 add_definitions(${MOAB_DEFINITIONS})
53 endif(MOAB_DEFINITIONS)
56 add_definitions("-DMOAB_HDF5_ENABLED")
57 set(MOAB_DEFINITIONS "-DMOAB_HDF5_ENABLED")
58 endif(MOAB_HDF5_ENABLED)