From 710ce946f907cf34f20b47f84a61ce6150047355 Mon Sep 17 00:00:00 2001 From: andreaslundell Date: Fri, 14 Jun 2024 17:03:06 +0300 Subject: [PATCH] Fix some CMake warnings --- CMakeLists.txt | 11 +++++-- misc/FindCBC.cmake | 35 +++++++++------------ misc/{FindGurobi.cmake => FindGUROBI.cmake} | 0 3 files changed, 22 insertions(+), 24 deletions(-) rename misc/{FindGurobi.cmake => FindGUROBI.cmake} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a1ce153..31eae8f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -191,7 +191,12 @@ file( # Cbc if(HAS_CBC) - find_package(CBC) + find_package(PkgConfig) + + if(PkgConfig_FOUND) + include(FindPkgConfig) + find_package(CBC) + endif() if(CBC_FOUND) link_directories(${CBC_LIBRARY_DIRS}) @@ -231,7 +236,7 @@ endif(HAS_CPLEX) # Gurobi if(HAS_GUROBI) - find_package(Gurobi) + find_package(GUROBI) add_definitions(-DHAS_GUROBI) if(GUROBI_FOUND) @@ -254,7 +259,7 @@ if(HAS_HIGHS) if(USE_EXTERNAL_HIGHS) find_package(Threads REQUIRED) - find_package(HIGHS REQUIRED EXACT PATHS ${HIGHS_EXTERNAL_DIR} NO_DEFAULT_PATH) + find_package(HIGHS REQUIRED PATHS ${HIGHS_EXTERNAL_DIR} NO_DEFAULT_PATH) endif() if(NOT(USE_EXTERNAL_HIGHS)) diff --git a/misc/FindCBC.cmake b/misc/FindCBC.cmake index fa711cff..c750642c 100644 --- a/misc/FindCBC.cmake +++ b/misc/FindCBC.cmake @@ -1,28 +1,21 @@ -find_package(PkgConfig) - set(CBC_FOUND false) -if(PkgConfig_FOUND) - include(FindPkgConfig) - - set(ENV{PKG_CONFIG_PATH} "${CBC_DIR}/lib/pkgconfig") - pkg_search_module(CBC cbc) +set(ENV{PKG_CONFIG_PATH} "${CBC_DIR}/lib/pkgconfig") +pkg_search_module(CBC cbc) - if(CBC_FOUND) - message("-- Cbc found using Pkg-config:") - message(" Include directories found: ${CBC_INCLUDE_DIRS}") - message(" Library directories found: ${CBC_LIBRARY_DIRS}") +if(CBC_FOUND) + message("-- Cbc found using Pkg-config:") + message(" Include directories found: ${CBC_INCLUDE_DIRS}") + message(" Library directories found: ${CBC_LIBRARY_DIRS}") - # Handle the QUIETLY and REQUIRED arguments and set CBC_FOUND to TRUE if all listed variables are TRUE. - find_package_handle_standard_args(CBC - DEFAULT_MSG - CBC_LIBRARIES - CBC_INCLUDE_DIRS - CBC_LIBRARY_DIRS) - mark_as_advanced(CBC_LIBRARIES CBC_INCLUDE_DIRS CBC_LIBRARY_DIRS) - endif(CBC_FOUND) - -endif(PkgConfig_FOUND) + # Handle the QUIETLY and REQUIRED arguments and set CBC_FOUND to TRUE if all listed variables are TRUE. + find_package_handle_standard_args(CBC + DEFAULT_MSG + CBC_LIBRARIES + CBC_INCLUDE_DIRS + CBC_LIBRARY_DIRS) + mark_as_advanced(CBC_LIBRARIES CBC_INCLUDE_DIRS CBC_LIBRARY_DIRS) +endif(CBC_FOUND) if(NOT (CBC_FOUND)) diff --git a/misc/FindGurobi.cmake b/misc/FindGUROBI.cmake similarity index 100% rename from misc/FindGurobi.cmake rename to misc/FindGUROBI.cmake