Refactor our integration of LFSC (#6201)
[cvc5.git] / cmake / FindGLPK.cmake
1 #####################
2 ## FindGLPK.cmake
3 ## Top contributors (to current version):
4 ## Mathias Preiner
5 ## This file is part of the CVC4 project.
6 ## Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
7 ## in the top-level source directory and their institutional affiliations.
8 ## All rights reserved. See the file COPYING in the top-level source
9 ## directory for licensing information.
10 ##
11 # Find GLPK-cut-log
12 # GLPK_FOUND - system has GLPK lib
13 # GLPK_INCLUDE_DIR - the GLPK include directory
14 # GLPK_LIBRARIES - Libraries needed to use GLPK
15
16
17 find_path(GLPK_INCLUDE_DIR NAMES glpk.h)
18 find_library(GLPK_LIBRARIES NAMES glpk)
19
20 # Check if we really have GLPK-cut-log.
21 if(GLPK_INCLUDE_DIR)
22 include(CheckSymbolExists)
23 set(CMAKE_REQUIRED_INCLUDES ${GLPK_INCLUDE_DIR})
24 set(CMAKE_REQUIRED_LIBRARIES ${GLPK_LIBRARIES} m)
25 check_symbol_exists(glp_ios_get_cut "glpk.h" HAVE_GLPK_CUT_LOG)
26 if(NOT HAVE_GLPK_CUT_LOG)
27 message(FATAL_ERROR "Could not link against GLPK-cut-log. "
28 "Did you forget to install GLPK-cut-log?")
29 endif()
30 endif()
31
32 include(FindPackageHandleStandardArgs)
33 find_package_handle_standard_args(GLPK
34 DEFAULT_MSG
35 GLPK_INCLUDE_DIR GLPK_LIBRARIES)
36
37 mark_as_advanced(GLPK_INCLUDE_DIR GLPK_LIBRARIES)
38 if(GLPK_LIBRARIES)
39 message(STATUS "Found GLPK libs: ${GLPK_LIBRARIES}")
40 endif()