summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorMathias Preiner <mathias.preiner@gmail.com>2018-08-24 23:14:32 -0700
committerMathias Preiner <mathias.preiner@gmail.com>2018-09-22 16:30:59 -0700
commit7be6be7dec00579cb7eaae32bed1217d6c35ee83 (patch)
tree27ea1d88cb613b0d508588969958b1e1e808327b /cmake
parent0b4926e10f7788f209bbc515e13d1884a8590bb4 (diff)
cmake: Add module finder for GLPK-cut-log.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindGLPK.cmake35
1 files changed, 35 insertions, 0 deletions
diff --git a/cmake/FindGLPK.cmake b/cmake/FindGLPK.cmake
new file mode 100644
index 000000000..7d7c1954f
--- /dev/null
+++ b/cmake/FindGLPK.cmake
@@ -0,0 +1,35 @@
+# Find GLPK-cut-log
+# GLPK_FOUND - system has GLPK lib
+# GLPK_INCLUDE_DIR - the GLPK include directory
+# GLPK_LIBRARIES - Libraries needed to use GLPK
+
+set(GLPK_DEFAULT_HOME ${PROJECT_SOURCE_DIR}/glpk-cut-log)
+
+find_path(GLPK_INCLUDE_DIR
+ NAMES glpk.h
+ PATHS ${GLPK_DEFAULT_HOME}/include
+ NO_DEFAULT_PATH)
+find_library(GLPK_LIBRARIES
+ NAMES glpk
+ PATHS ${GLPK_DEFAULT_HOME}/lib
+ NO_DEFAULT_PATH)
+
+
+# Check if we really have GLPK-cut-log
+if(GLPK_INCLUDE_DIR)
+ include(CheckSymbolExists)
+ set(CMAKE_REQUIRED_INCLUDES ${GLPK_INCLUDE_DIR})
+ set(CMAKE_REQUIRED_LIBRARIES ${GLPK_LIBRARIES} m)
+ check_symbol_exists(glp_ios_get_cut "glpk.h" HAVE_GLPK_CUT_LOG)
+ if(NOT HAVE_GLPK_CUT_LOG)
+ message(FATAL_ERROR "Could not link against GLPK-cut-log. "
+ "Did you forget to install GLPK-cut-log?")
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GLPK
+ DEFAULT_MSG
+ GLPK_INCLUDE_DIR GLPK_LIBRARIES)
+
+mark_as_advanced(GLPK_INCLUDE_DIR GLPK_LIBRARIES)
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback