From 4eaab0652be85431d922ad6b62cd9e38f3c5fbcc Mon Sep 17 00:00:00 2001 From: Gleb Belov Date: Mon, 22 Apr 2024 13:43:09 +1000 Subject: [PATCH] FindGUROBI.cmake: Gurobi 11 --- CMakeLists.txt | 6 +++ support/cmake/FindGUROBI.cmake | 73 ++++++++++++++++------------------ 2 files changed, 40 insertions(+), 39 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 679751005..11cff6bc2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -564,3 +564,9 @@ if (NOT SKIP_BUILD_MP) endif() endif() ## NOT SKIP_BUILD_MP + +############## Features summary ############## +if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) + include(FeatureSummary) + feature_summary(WHAT ALL) +endif() diff --git a/support/cmake/FindGUROBI.cmake b/support/cmake/FindGUROBI.cmake index e86f83e92..51a717ee7 100644 --- a/support/cmake/FindGUROBI.cmake +++ b/support/cmake/FindGUROBI.cmake @@ -1,51 +1,46 @@ -# Try to find the GUROBI library +# Find GUROBI library # # The original file was downloaded from -# https://support.gurobi.com/hc/en-us/articles/360039499751-CMake-C-C-compilation-of-Gurobi-projects -# on March 11, 2020 +# https://support.gurobi.com/hc/en-us/articles/360039499751-How-do-I-use-CMake-to-build-Gurobi-C-C-projects +# on April 22, 2024 +# +# Modified to check GUROBI_INCLUDE_DIRS and some lib subdirs find_path(GUROBI_INCLUDE_DIRS - NAMES gurobi_c.h - HINTS ${GUROBI_DIR} $ENV{GUROBI_HOME} - PATH_SUFFIXES include) + NAMES gurobi_c.h + HINTS ${GUROBI_DIR} $ENV{GUROBI_HOME} + PATH_SUFFIXES include) find_library(GUROBI_LIBRARY - NAMES gurobi gurobi105 gurobi102 gurobi101 gurobi100 gurobi95 gurobi92 gurobi91 gurobi90 gurobi81 - HINTS ${GUROBI_DIR} $ENV{GUROBI_HOME} - PATH_SUFFIXES lib lib/linux64 lib/osx64 lib/win64) + NAMES gurobi gurobi110 gurobi100 + HINTS ${GUROBI_DIR} $ENV{GUROBI_HOME} + PATH_SUFFIXES lib lib/linux64 lib/osx64 lib/win64) if(CXX) - if(MSVC) - # determine Visual Studio year - if(MSVC_TOOLSET_VERSION EQUAL 142) - set(MSVC_YEAR "2019") - elseif(MSVC_TOOLSET_VERSION EQUAL 141) - set(MSVC_YEAR "2017") - elseif(MSVC_TOOLSET_VERSION EQUAL 140) - set(MSVC_YEAR "2015") - endif() + if(MSVC) + set(MSVC_YEAR "2017") + + if(MT) + set(M_FLAG "mt") + else() + set(M_FLAG "md") + endif() - if(MT) - set(M_FLAG "mt") - else() - set(M_FLAG "md") - endif() - - find_library(GUROBI_CXX_LIBRARY - NAMES gurobi_c++${M_FLAG}${MSVC_YEAR} - HINTS ${GUROBI_DIR} $ENV{GUROBI_HOME} - PATH_SUFFIXES lib) - find_library(GUROBI_CXX_DEBUG_LIBRARY - NAMES gurobi_c++${M_FLAG}d${MSVC_YEAR} - HINTS ${GUROBI_DIR} $ENV{GUROBI_HOME} - PATH_SUFFIXES lib) - else() - find_library(GUROBI_CXX_LIBRARY - NAMES gurobi_c++ - HINTS ${GUROBI_DIR} $ENV{GUROBI_HOME} - PATH_SUFFIXES lib) - set(GUROBI_CXX_DEBUG_LIBRARY ${GUROBI_CXX_LIBRARY}) - endif() + find_library(GUROBI_CXX_LIBRARY + NAMES gurobi_c++${M_FLAG}${MSVC_YEAR} + HINTS ${GUROBI_DIR} $ENV{GUROBI_HOME} + PATH_SUFFIXES lib) + find_library(GUROBI_CXX_DEBUG_LIBRARY + NAMES gurobi_c++${M_FLAG}d${MSVC_YEAR} + HINTS ${GUROBI_DIR} $ENV{GUROBI_HOME} + PATH_SUFFIXES lib) + else() + find_library(GUROBI_CXX_LIBRARY + NAMES gurobi_c++ + HINTS ${GUROBI_DIR} $ENV{GUROBI_HOME} + PATH_SUFFIXES lib) + set(GUROBI_CXX_DEBUG_LIBRARY ${GUROBI_CXX_LIBRARY}) + endif() endif() include(FindPackageHandleStandardArgs)