Commit cd6b46f6 authored by Niccolò Iardella's avatar Niccolò Iardella

Fix a bug in Clp find module

parent 683ad21b
......@@ -63,7 +63,7 @@ if (Clp_FOUND)
target_include_directories(
NDOFiOracle PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/CutPlane>)
target_link_libraries(NDOFiOracle PUBLIC Coin::Clp)
target_link_libraries(NDOFiOracle PUBLIC Coin::OsiClp)
if (CPLEX_FOUND AND OsiCpx_FOUND)
message(STATUS "CPLEX and OsiCpx found, configuring OSIMPSolver")
......
......@@ -167,7 +167,7 @@ static double defOptEps = 1e-10;
static double defFsbEps = 1e-10;
#if WHICH_OSISOLVER == 1
static CPXFILEptr logfile; // the same for each OSIMPSolver ... but
static FILE* logfile; // the same for each OSIMPSolver ... but
// anyway the file name was the same, so ...
#endif
......
......@@ -9,6 +9,8 @@
# Provides the following imported targets: #
# #
# - Coin::Clp - the Clp library #
# - Coin::ClpSolver - the ClpSolver library #
# - Coin::OsiClp - the OsiClp library #
# #
# Niccolo' Iardella #
# Operations Research Group #
......@@ -18,7 +20,7 @@
include(FindPackageHandleStandardArgs)
# ----- Requirements -------------------------------------------------------- #
find_package(Osi REQUIRED)
find_package(Osi)
# ----- Clp ----------------------------------------------------------------- #
# Find headers
......@@ -67,7 +69,68 @@ if (Clp_FOUND)
set_target_properties(
Coin::Clp PROPERTIES
IMPORTED_LOCATION "${Clp_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${Clp_INCLUDE_DIR}")
endif ()
endif ()
# ----- ClpSolver ----------------------------------------------------------- #
# Find library
find_library(ClpSolver_LIBRARY
NAMES ClpSolver
HINTS ${CLP_LIB}
DOC "ClpSolver library")
mark_as_advanced(ClpSolver_LIBRARY)
# Handle standard arguments
find_package_handle_standard_args(
ClpSolver
REQUIRED_VARS ClpSolver_LIBRARY Clp_INCLUDE_DIR
VERSION_VAR Clp_VERSION)
# Define target
if (ClpSolver_FOUND)
set(ClpSolver_INCLUDE_DIRS "${Clp_INCLUDE_DIR}")
set(ClpSolver_LIBRARIES "${ClpSolver_LIBRARY}")
if (NOT TARGET Coin::ClpSolver)
add_library(Coin::ClpSolver UNKNOWN IMPORTED)
set_target_properties(
Coin::ClpSolver PROPERTIES
IMPORTED_LOCATION "${ClpSolver_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${Clp_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "Coin::Osi")
INTERFACE_LINK_LIBRARIES "Coin::Clp")
endif ()
endif ()
# ----- OsiClp -------------------------------------------------------------- #
if (Osi_FOUND)
# Find library
find_library(OsiClp_LIBRARY
NAMES OsiClp
HINTS ${CLP_LIB}
DOC "OsiClp library")
mark_as_advanced(OsiClp_LIBRARY)
# Handle standard arguments
find_package_handle_standard_args(
OsiClp
REQUIRED_VARS OsiClp_LIBRARY Clp_INCLUDE_DIR
VERSION_VAR Clp_VERSION)
# Define target
if (OsiClp_FOUND)
set(OsiClp_INCLUDE_DIRS "${Clp_INCLUDE_DIR}")
set(OsiClp_LIBRARIES "${OsiClp_LIBRARY}")
if (NOT TARGET Coin::OsiClp)
add_library(Coin::OsiClp UNKNOWN IMPORTED)
set_target_properties(
Coin::OsiClp PROPERTIES
IMPORTED_LOCATION "${OsiClp_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${Clp_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "Coin::Clp;Coin::ClpSolver;Coin::Osi")
endif ()
endif ()
endif()
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