1 # - Try to find MESHKIT
3 # If unset, try environment
6 set(MESHKIT_DIR $ENV{MESHKIT_DIR})
9 find_file(MESHKIT_VARIABLES_FILE meshkit.make HINTS ${MESHKIT_DIR}/lib)
11 if(MESHKIT_VARIABLES_FILE)
13 set(MESHKIT_INCLUDES_COUNTER 0)
15 file(STRINGS ${MESHKIT_VARIABLES_FILE} MESHKIT_VARIABLES)
16 foreach(LINE ${MESHKIT_VARIABLES})
17 if(NOT LINE MATCHES "^#.*")
18 string(REGEX REPLACE "=" ";" FIELDS ${LINE})
19 list(GET FIELDS 0 VAR)
20 string(REGEX REPLACE " " "" VARSTRIP ${VAR})
22 if(${VARSTRIP} STREQUAL MESHKIT_INCLUDES)
23 set(VARSTRIPEXT "${VARSTRIP}${MESHKIT_INCLUDES_COUNTER}")
24 string(REGEX REPLACE "${VARSTRIP} *=" "" VAL ${LINE})
25 set("${VARSTRIPEXT}" ${VAL} CACHE INTERNAL "moab varible")
26 set(MESHKIT_INCLUDES_COUNTER 1)
27 # message(STATUS ${VARSTRIPEXT})
28 # message(STATUS ${VAL})
29 else (${VARSTRIP} STREQUAL MESHKIT_INCLUDES)
30 string(REGEX REPLACE "${VARSTRIP} *=" "" VAL ${LINE})
31 # message(STATUS ${VARSTRIP})
32 # message(STATUS ${VAL})
33 set(${VARSTRIP} ${VAL} CACHE INTERNAL "moab varible")
34 endif(${VARSTRIP} STREQUAL MESHKIT_INCLUDES)
36 endif(NOT LINE MATCHES "^#.*")
37 endforeach(LINE ${MESHKIT_VARIABLES})
39 # Add meshkit definitions
40 if(MESHKIT_DEFINITIONS)
41 resolve_definitions(MESHKIT_DEFINITIONS ${MESHKIT_CPPFLAGS})
42 message(STATUS ${MESHKIT_DEFINITIONS})
43 add_definitions(${MESHKIT_DEFINITIONS})
44 endif(MESHKIT_DEFINITIONS)
46 add_definitions(-DWITH_MESHKIT)
48 endif(MESHKIT_VARIABLES_FILE)