cmake/FindGLPK.cmake
author Akos Ladanyi <ladanyi@tmit.bme.hu>
Tue, 28 Apr 2009 14:47:25 +0100
changeset 634 4629e096e3af
parent 619 ec817dfc2cb7
child 637 4faa0c763906
permissions -rw-r--r--
Look for COIN libraries with and without the lib prefix too (#277)

This is necessary because on Windows when built using autotools the COIN
libraries are named in UNIX style, i.e. libCbc.lib insetad of Cbc.lib.
     1 SET(GLPK_REGKEY "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Glpk;InstallPath]")
     2 GET_FILENAME_COMPONENT(GLPK_ROOT_PATH ${GLPK_REGKEY} ABSOLUTE)
     3 
     4 FIND_PATH(GLPK_INCLUDE_DIR
     5   glpk.h
     6   PATHS ${GLPK_REGKEY}/include)
     7 
     8 FIND_LIBRARY(GLPK_LIBRARY
     9   NAMES glpk
    10   PATHS ${GLPK_REGKEY}/lib)
    11 
    12 INCLUDE(FindPackageHandleStandardArgs)
    13 FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLPK DEFAULT_MSG GLPK_LIBRARY GLPK_INCLUDE_DIR)
    14 
    15 IF(GLPK_FOUND)
    16   SET(GLPK_INCLUDE_DIRS ${GLPK_INCLUDE_DIR})
    17   SET(GLPK_LIBRARIES ${GLPK_LIBRARY})
    18   SET(GLPK_BIN_DIR ${GLPK_ROOT_PATH}/bin)
    19 ENDIF(GLPK_FOUND)
    20 
    21 MARK_AS_ADVANCED(GLPK_LIBRARY GLPK_INCLUDE_DIR GLPK_BIN_DIR)
    22 
    23 IF(GLPK_FOUND)
    24   SET(LEMON_HAVE_LP TRUE)
    25   SET(LEMON_HAVE_MIP TRUE)
    26   SET(LEMON_HAVE_GLPK TRUE)
    27 ENDIF(GLPK_FOUND)