From a063111082a6e54725fc2cfbe7a817d03ed2c131 Mon Sep 17 00:00:00 2001 From: ClemensBuechner Date: Tue, 17 Oct 2023 14:37:20 +0200 Subject: [PATCH] [issue1122] Link CPLEX static libraries if dynamic not found. --- src/search/cmake/FindCplex.cmake | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/search/cmake/FindCplex.cmake b/src/search/cmake/FindCplex.cmake index 58a6139f05..27827664da 100644 --- a/src/search/cmake/FindCplex.cmake +++ b/src/search/cmake/FindCplex.cmake @@ -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}" ) @@ -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() @@ -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 )