Commit 266a6d1e authored by Martin Heistermann's avatar Martin Heistermann

gurobi cmake cleanup

parent 16a8cfce
Pipeline #12188 failed with stages
in 7 minutes and 32 seconds
......@@ -16,6 +16,7 @@ find_path(GUROBI_INCLUDE_DIR
HINTS
"${GUROBI_HOME}/include"
)
mark_as_advanced(GUROBI_INCLUDE_DIR)
set(GUROBI_BIN_DIR "${GUROBI_HOME}/bin")
set(GUROBI_LIB_DIR "${GUROBI_HOME}/lib")
......@@ -70,6 +71,7 @@ if (WIN32)
PATHS
${GUROBI_LIB_DIR}
)
mark_as_advanced(GUROBI_IMPLIB)
else ()
find_library(GUROBI_LIBRARY
NAMES "gurobi${GUROBI_LIBRARY_VERSION}"
......@@ -77,6 +79,7 @@ else ()
${GUROBI_LIB_DIR}
)
endif()
mark_as_advanced(GUROBI_LIBRARY)
if(GUROBI_LIBRARY AND NOT TARGET Gurobi::GurobiC)
add_library(Gurobi::GurobiC SHARED IMPORTED)
......@@ -94,6 +97,7 @@ endif()
# (Note: doing this is motivated by actual sometimes-subtle ABI compatibility bugs)
find_path(GUROBI_SRC_DIR NAMES "Model.h" PATHS "${GUROBI_HOME}/src/cpp/")
mark_as_advanced(GUROBI_SRC_DIR)
file(GLOB GUROBI_CXX_SRC CONFIGURE_DEPENDS ${GUROBI_SRC_DIR}/*.cpp)
if(TARGET Gurobi::GurobiC AND GUROBI_CXX_SRC AND NOT TARGET Gurobi::GurobiCXX)
......@@ -109,20 +113,12 @@ if(TARGET Gurobi::GurobiC AND GUROBI_CXX_SRC AND NOT TARGET Gurobi::GurobiCXX)
# We need to be able to link this into a shared library:
set_target_properties(GurobiCXX PROPERTIES POSITION_INDEPENDENT_CODE ON)
set(GUROBI_CXX_LIBRARY "Gurobi::GurobiCXX")
endif()
# legacy support:
set(GUROBI_INCLUDE_DIRS "${GUROBI_INCLUDE_DIR}" )
set(GUROBI_LIBRARIES "${GUROBI_CXX_LIBRARY};${GUROBI_LIBRARY}" )
set(GUROBI_INCLUDE_DIRS "${GUROBI_INCLUDE_DIR}")
set(GUROBI_LIBRARIES Gurobi::GurobiC Gurobi::GurobiCXX)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Gurobi DEFAULT_MSG
GUROBI_LIBRARY
GUROBI_INCLUDE_DIR
GUROBI_SRC_DIR
GUROBI_CXX_LIBRARY
)
mark_as_advanced(GUROBI_INCLUDE_DIR GUROBI_LIBRARY GUROBI_CXX_LIBRARY GUROBI_BIN_DIR GUROBI_SRC_DIR)
find_package_handle_standard_args(Gurobi DEFAULT_MSG GUROBI_LIBRARY GUROBI_INCLUDE_DIR GUROBI_SRC_DIR)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment