Skip to content

Commit

Permalink
[issue1122] Link CPLEX static libraries if dynamic not found.
Browse files Browse the repository at this point in the history
  • Loading branch information
ClemensBuechner authored Oct 17, 2023
1 parent 34d1acb commit a063111
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/search/cmake/FindCplex.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
set(IMPORTED_CONFIGURATIONS "Debug" "Release")
set(HINT_PATHS ${cplex_DIR} $ENV{cplex_DIR})

add_library(cplex::cplex IMPORTED SHARED)
add_library(cplex::cplex IMPORTED UNKNOWN)
set_target_properties(cplex::cplex PROPERTIES
IMPORTED_CONFIGURATIONS "${IMPORTED_CONFIGURATIONS}"
)
Expand Down Expand Up @@ -157,18 +157,20 @@ foreach(CONFIG_ORIG ${IMPORTED_CONFIGURATIONS})
list(APPEND REQUIRED_LIBRARIES CPLEX_SHARED_LIBRARY_${CONFIG} CPLEX_IMPLIB_${CONFIG})
else()
# CPLEX stores .so files in /bin
find_library(CPLEX_SHARED_LIBRARY_${CONFIG}
find_library(CPLEX_LIBRARY_${CONFIG}
NAMES
cplex${CPLEX_VERSION_NO_DOTS}
cplex
HINTS
${HINT_PATHS}/bin
${HINT_PATHS}/lib
PATH_SUFFIXES
${SUFFIXES_${CONFIG}}
)
set_target_properties(cplex::cplex PROPERTIES
IMPORTED_LOCATION_${CONFIG} ${CPLEX_SHARED_LIBRARY_${CONFIG}}
IMPORTED_LOCATION_${CONFIG} ${CPLEX_LIBRARY_${CONFIG}}
)
list(APPEND REQUIRED_LIBRARIES CPLEX_SHARED_LIBRARY_${CONFIG})
list(APPEND REQUIRED_LIBRARIES CPLEX_LIBRARY_${CONFIG})
endif()
endforeach()

Expand All @@ -186,5 +188,5 @@ mark_as_advanced(
CPLEX_VERSION_SUBMINOR CPLEX_VERSION_NO_DOTS BITWIDTH_HINTS PLATFORM_HINTS
LIBRARY_TYPE_HINTS_RELEASE LIBRARY_TYPE_HINTS_DEBUG SUFFIXES_RELEASE
SUFFIXES_DEBUG FIND_OPTIONS COMPILER_HINTS COMPILER_HINT CPLEX_IMPLIB_DEBUG
CPLEX_IMPLIB_RELEASE CPLEX_SHARED_LIBRARY_DEBUG CPLEX_SHARED_LIBRARY_RELEASE
CPLEX_IMPLIB_RELEASE CPLEX_LIBRARY_DEBUG CPLEX_LIBRARY_RELEASE
)

0 comments on commit a063111

Please sign in to comment.