3 # If unset, try environment
6 set(CGM_DIR $ENV{CGM_DIR})
9 find_file(CGM_VARIABLES_FILE cgm.make HINTS ${CGM_DIR}/lib)
11 if(CGM_VARIABLES_FILE)
13 set(CGM_INCLUDES_COUNTER 0)
15 file(STRINGS ${CGM_VARIABLES_FILE} CGM_VARIABLES)
16 foreach(LINE ${CGM_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 CGM_INCLUDES)
23 set(VARSTRIPEXT "${VARSTRIP}${CGM_INCLUDES_COUNTER}")
24 string(REGEX REPLACE "${VARSTRIP} *=" "" VAL ${LINE})
25 set("${VARSTRIPEXT}" ${VAL} CACHE INTERNAL "moab varible")
26 set(CGM_INCLUDES_COUNTER 1)
27 # message(STATUS ${VARSTRIPEXT})
28 # message(STATUS ${VAL})
29 else (${VARSTRIP} STREQUAL CGM_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 CGM_INCLUDES)
36 endif(NOT LINE MATCHES "^#.*")
37 endforeach(LINE ${CGM_VARIABLES})
39 # Add moab definitions
41 resolve_definitions(CGM_DEFINITIONS ${CGM_CPPFLAGS})
42 message(STATUS ${CGM_DEFINITIONS})
43 add_definitions(${CGM_DEFINITIONS})
44 endif(CGM_DEFINITIONS)
46 endif(CGM_VARIABLES_FILE)