ladanyi@684: SET(GLPK_ROOT_DIR "" CACHE PATH "GLPK root directory") ladanyi@684: ladanyi@496: SET(GLPK_REGKEY "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Glpk;InstallPath]") ladanyi@496: GET_FILENAME_COMPONENT(GLPK_ROOT_PATH ${GLPK_REGKEY} ABSOLUTE) ladanyi@496: ladanyi@496: FIND_PATH(GLPK_INCLUDE_DIR ladanyi@496: glpk.h ladanyi@684: PATHS ${GLPK_REGKEY}/include ladanyi@684: HINTS ${GLPK_ROOT_DIR}/include ladanyi@684: ) ladanyi@496: FIND_LIBRARY(GLPK_LIBRARY ladanyi@684: glpk ladanyi@684: PATHS ${GLPK_REGKEY}/lib ladanyi@684: HINTS ${GLPK_ROOT_DIR}/lib ladanyi@684: ) ladanyi@496: ladanyi@685: IF(GLPK_INCLUDE_DIR AND GLPK_LIBRARY) ladanyi@685: FILE(READ ${GLPK_INCLUDE_DIR}/glpk.h GLPK_GLPK_H) ladanyi@685: ladanyi@685: STRING(REGEX MATCH "define[ ]+GLP_MAJOR_VERSION[ ]+[0-9]+" GLPK_MAJOR_VERSION_LINE "${GLPK_GLPK_H}") ladanyi@685: STRING(REGEX REPLACE "define[ ]+GLP_MAJOR_VERSION[ ]+([0-9]+)" "\\1" GLPK_VERSION_MAJOR "${GLPK_MAJOR_VERSION_LINE}") ladanyi@685: ladanyi@685: STRING(REGEX MATCH "define[ ]+GLP_MINOR_VERSION[ ]+[0-9]+" GLPK_MINOR_VERSION_LINE "${GLPK_GLPK_H}") ladanyi@685: STRING(REGEX REPLACE "define[ ]+GLP_MINOR_VERSION[ ]+([0-9]+)" "\\1" GLPK_VERSION_MINOR "${GLPK_MINOR_VERSION_LINE}") ladanyi@685: ladanyi@685: SET(GLPK_VERSION_STRING "${GLPK_VERSION_MAJOR}.${GLPK_VERSION_MINOR}") ladanyi@685: ladanyi@685: IF(GLPK_FIND_VERSION) ladanyi@685: IF(GLPK_FIND_VERSION_COUNT GREATER 2) ladanyi@685: MESSAGE(SEND_ERROR "unexpected version string") ladanyi@685: ENDIF(GLPK_FIND_VERSION_COUNT GREATER 2) ladanyi@685: ladanyi@685: MATH(EXPR GLPK_REQUESTED_VERSION "${GLPK_FIND_VERSION_MAJOR}*100 + ${GLPK_FIND_VERSION_MINOR}") ladanyi@685: MATH(EXPR GLPK_FOUND_VERSION "${GLPK_VERSION_MAJOR}*100 + ${GLPK_VERSION_MINOR}") ladanyi@685: ladanyi@685: IF(GLPK_FOUND_VERSION LESS GLPK_REQUESTED_VERSION) ladanyi@685: SET(GLPK_PROPER_VERSION_FOUND FALSE) ladanyi@685: ELSE(GLPK_FOUND_VERSION LESS GLPK_REQUESTED_VERSION) ladanyi@685: SET(GLPK_PROPER_VERSION_FOUND TRUE) ladanyi@685: ENDIF(GLPK_FOUND_VERSION LESS GLPK_REQUESTED_VERSION) ladanyi@685: ELSE(GLPK_FIND_VERSION) ladanyi@685: SET(GLPK_PROPER_VERSION_FOUND TRUE) ladanyi@685: ENDIF(GLPK_FIND_VERSION) ladanyi@685: ENDIF(GLPK_INCLUDE_DIR AND GLPK_LIBRARY) ladanyi@685: ladanyi@496: INCLUDE(FindPackageHandleStandardArgs) ladanyi@685: FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLPK DEFAULT_MSG GLPK_LIBRARY GLPK_INCLUDE_DIR GLPK_PROPER_VERSION_FOUND) ladanyi@496: ladanyi@496: IF(GLPK_FOUND) ladanyi@666: SET(GLPK_INCLUDE_DIRS ${GLPK_INCLUDE_DIR}) ladanyi@496: SET(GLPK_LIBRARIES ${GLPK_LIBRARY}) ladanyi@496: SET(GLPK_BIN_DIR ${GLPK_ROOT_PATH}/bin) ladanyi@496: ENDIF(GLPK_FOUND) ladanyi@496: ladanyi@496: MARK_AS_ADVANCED(GLPK_LIBRARY GLPK_INCLUDE_DIR GLPK_BIN_DIR) ladanyi@666: ladanyi@666: IF(GLPK_FOUND) ladanyi@674: SET(LEMON_HAVE_LP TRUE) ladanyi@674: SET(LEMON_HAVE_MIP TRUE) ladanyi@674: SET(LEMON_HAVE_GLPK TRUE) ladanyi@666: ENDIF(GLPK_FOUND) alpar@1230: