diff options
author | Mathias Preiner <mathias.preiner@gmail.com> | 2018-08-29 08:20:31 -0700 |
---|---|---|
committer | Mathias Preiner <mathias.preiner@gmail.com> | 2018-09-22 16:30:59 -0700 |
commit | 8f311f52037a9fb6a82d062342fec4b5396173c6 (patch) | |
tree | d20966972af4872d7b30dca1de41c1fc55f2decf /cmake/FindGLPK.cmake | |
parent | 7be6be7dec00579cb7eaae32bed1217d6c35ee83 (diff) |
cmake: Add options for specifying install directories for dependencies.
Diffstat (limited to 'cmake/FindGLPK.cmake')
-rw-r--r-- | cmake/FindGLPK.cmake | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/cmake/FindGLPK.cmake b/cmake/FindGLPK.cmake index 7d7c1954f..e2b07faff 100644 --- a/cmake/FindGLPK.cmake +++ b/cmake/FindGLPK.cmake @@ -3,19 +3,30 @@ # GLPK_INCLUDE_DIR - the GLPK include directory # GLPK_LIBRARIES - Libraries needed to use GLPK -set(GLPK_DEFAULT_HOME ${PROJECT_SOURCE_DIR}/glpk-cut-log) + +# Check default location of GLPK built with contrib/get-glpk-cut-log. +# If the user provides a directory we will not search the default paths and +# fail if GLPK was not found in the specified directory. +if(NOT GLPK_HOME) + set(GLPK_HOME ${PROJECT_SOURCE_DIR}/glpk-cut-log) + set(CHECK_SYSTEM_VERSION TRUE) +endif() find_path(GLPK_INCLUDE_DIR NAMES glpk.h - PATHS ${GLPK_DEFAULT_HOME}/include + PATHS ${GLPK_HOME}/include NO_DEFAULT_PATH) find_library(GLPK_LIBRARIES NAMES glpk - PATHS ${GLPK_DEFAULT_HOME}/lib + PATHS ${GLPK_HOME}/lib NO_DEFAULT_PATH) +if(CHECK_SYSTEM_VERSION) + find_path(GLPK_INCLUDE_DIR NAMES glpk.h) + find_library(GLPK_LIBRARIES NAMES glpk) +endif() -# Check if we really have GLPK-cut-log +# Check if we really have GLPK-cut-log. if(GLPK_INCLUDE_DIR) include(CheckSymbolExists) set(CMAKE_REQUIRED_INCLUDES ${GLPK_INCLUDE_DIR}) |