1. This is a boolean property which must be set to TRUE or FALSE If TRUE, the default, cmake will use @rpath as directory portion (aka prefix) of the install_name (otool LC_ID_DYLIB) note: CMP0042 set it to TRUE by default 2. To change this prefix you must use INSTALL_NAME_DIR 3. To change the INSTALL_RPATH (otool LC_RPATH) (e.g. to set it to @loader_path) you must use the INSTALL_RPATH property. ref: https://cmake.org/cmake/help/latest/variable/CMAKE_MACOSX_RPATH.html https://cmake.org/cmake/help/latest/prop_tgt/MACOSX_RPATH.html https://cmake.org/cmake/help/latest/prop_tgt/INSTALL_RPATH.html https://cmake.org/cmake/help/latest/policy/CMP0042.html
180 lines
6.3 KiB
Diff
180 lines
6.3 KiB
Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 38ac7845..9b0d4fcb 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -38,9 +38,11 @@ set(CPACK_PACKAGE_VENDOR "Zuse Institute Berlin")
|
|
set(CPACK_PACKAGE_CONTACT "http://scipopt.org")
|
|
include(CPack)
|
|
|
|
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
|
|
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
|
|
-set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
|
|
+if(CMAKE_PROJECT_NAME EQUAL "SCIP")
|
|
+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
|
|
+ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
|
|
+ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
|
|
+endif()
|
|
|
|
if(SCIPOptSuite_BINARY_DIR)
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${SCIPOptSuite_BINARY_DIR}/bin)
|
|
@@ -239,7 +241,7 @@ if(DEBUGSOL)
|
|
endif()
|
|
|
|
#set the correct rpath for OS X
|
|
-set(CMAKE_MACOSX_RPATH ON)
|
|
+set(CMAKE_MACOSX_RPATH TRUE)
|
|
|
|
#set defines for Windows
|
|
if(WIN32)
|
|
@@ -412,22 +414,11 @@ endif()
|
|
#search the selected LP solver library
|
|
message(STATUS "Finding Solver \"${LPS}\"")
|
|
if(LPS STREQUAL "spx")
|
|
- message(STATUS "Finding Soplex")
|
|
- find_package(SOPLEX CONFIG HINTS ${SOPLEX_DIR})
|
|
- if(NOT SOPLEX_FOUND)
|
|
- # Utilities to automatically download missing dependencies
|
|
- include(cmake/Dependencies.cmake)
|
|
- find_or_download_package(
|
|
- NAME SOPLEX
|
|
- VERSION 7.0.1
|
|
- URL https://github.com/scipopt/soplex/archive/refs/tags/release-701.tar.gz
|
|
- URL_HASH SHA256=80cce994dcbe45fd52b60e31a3aeb5d2c60a7ddbaae495e0ce6bf58481675696
|
|
- COMPONENTS soplex)
|
|
- find_package(SOPLEX REQUIRED CONFIG HINTS _deps/local)
|
|
- endif()
|
|
- if(NOT SOPLEX_FOUND)
|
|
+ message(STATUS "Finding Soplex...")
|
|
+ if(NOT TARGET libsoplex-pic OR NOT TARGET libsoplex)
|
|
message(FATAL_ERROR "Requested LP solver SoPlex not found.")
|
|
endif()
|
|
+ set(SOPLEX_FOUND TRUE)
|
|
if (DEFINED SOPLEX_WITH_PAPILO)
|
|
message(STATUS "SOPLEX links PAPILO")
|
|
if((NOT SCIP_WITH_PAPILO)) # TODO not sure how to handle AUTOBUILD
|
|
@@ -502,9 +493,9 @@ if(SOPLEX_FOUND)
|
|
message(STATUS "Finding SOPLEX - found")
|
|
# SoPlex headers can be directly included
|
|
include_directories(${SOPLEX_INCLUDE_DIRS})
|
|
- set(LPS_LIBRARIES ${SOPLEX_LIBRARIES})
|
|
+ set(LPS_LIBRARIES libsoplex)
|
|
if(SHARED)
|
|
- set(LPS_PIC_LIBRARIES ${SOPLEX_PIC_LIBRARIES})
|
|
+ set(LPS_PIC_LIBRARIES libsoplex-pic)
|
|
else()
|
|
set(LPS_PIC_LIBRARIES ${LPS_LIBRARIES})
|
|
endif()
|
|
@@ -514,7 +505,7 @@ if(SOPLEX_FOUND)
|
|
set(lpi lpi/lpi_spx2.cpp)
|
|
endif()
|
|
else()
|
|
- message(STATUS "Support SOPLEX: OFF")
|
|
+ message(FATAL_ERROR "SOPLEX not found !")
|
|
endif()
|
|
|
|
if(CLP_FOUND)
|
|
diff --git a/scip-config.cmake.in b/scip-config.cmake.in
|
|
index 559552f9..682ac40a 100644
|
|
--- a/scip-config.cmake.in
|
|
+++ b/scip-config.cmake.in
|
|
@@ -1,17 +1,16 @@
|
|
if(NOT TARGET libscip)
|
|
- include("${CMAKE_CURRENT_LIST_DIR}/scip-targets.cmake")
|
|
-endif()
|
|
+ include(CMakeFindDependencyMacro)
|
|
+ if(@ZIMPL_NEEDED@)
|
|
+ find_dependency(ZIMPL REQUIRED NO_MODULE)
|
|
+ endif()
|
|
+ if(@SOPLEX_NEEDED@)
|
|
+ find_dependency(SOPLEX REQUIRED NO_MODULE)
|
|
+ endif()
|
|
|
|
-if(@ZIMPL_NEEDED@)
|
|
- set(ZIMPL_DIR "@CONF_ZIMPL_DIR@")
|
|
- find_package(ZIMPL QUIET CONFIG)
|
|
-endif()
|
|
-
|
|
-if(@SOPLEX_NEEDED@)
|
|
- set(SOPLEX_DIR "@CONF_SOPLEX_DIR@")
|
|
- find_package(SOPLEX QUIET CONFIG)
|
|
+ include("${CMAKE_CURRENT_LIST_DIR}/scip-targets.cmake")
|
|
endif()
|
|
|
|
+# Legacy
|
|
set(SCIP_LIBRARIES libscip)
|
|
set(SCIP_INCLUDE_DIRS "@CONF_INCLUDE_DIRS@")
|
|
set(SCIP_FOUND TRUE)
|
|
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
|
index d6dd3acf..a146ddec 100644
|
|
--- a/src/CMakeLists.txt
|
|
+++ b/src/CMakeLists.txt
|
|
@@ -5,8 +5,8 @@ include(GNUInstallDirs)
|
|
|
|
function(setLibProperties targetname outputname)
|
|
set_target_properties(${targetname} PROPERTIES
|
|
- OUTPUT_NAME ${outputname}
|
|
- MACOSX_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
|
|
+ OUTPUT_NAME ${outputname}
|
|
+ )
|
|
endfunction(setLibProperties)
|
|
|
|
set(CMAKE_C_STANDARD 99)
|
|
@@ -1112,6 +1112,13 @@ target_link_libraries(scip
|
|
add_dependencies(libscip scip_update_githash)
|
|
add_dependencies(scip scip_update_githash)
|
|
|
|
+if(APPLE)
|
|
+ set_target_properties(libscip PROPERTIES
|
|
+ INSTALL_RPATH "@loader_path")
|
|
+elseif(UNIX)
|
|
+ set_target_properties(libscip PROPERTIES
|
|
+ INSTALL_RPATH "$ORIGIN")
|
|
+endif()
|
|
set_target_properties(libscip PROPERTIES
|
|
VERSION ${SCIP_VERSION_MAJOR}.${SCIP_VERSION_MINOR}.${SCIP_VERSION_PATCH}.${SCIP_VERSION_SUB}
|
|
SOVERSION ${SCIP_VERSION_MAJOR}.${SCIP_VERSION_MINOR}
|
|
@@ -1150,17 +1157,8 @@ install(TARGETS scip libscip EXPORT scip-targets
|
|
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
|
|
|
# Add all targets to the build-tree export set
|
|
-export(TARGETS scip libscip
|
|
- FILE "${PROJECT_BINARY_DIR}/scip-targets.cmake")
|
|
-
|
|
-# make soplex and zimpl dir absolute for the config file
|
|
-if(SOPLEX_NEEDED)
|
|
- get_filename_component(CONF_SOPLEX_DIR ${SOPLEX_DIR} REALPATH BASE_DIR ${CMAKE_SOURCE_DIR})
|
|
-endif()
|
|
-
|
|
-if(ZIMPL_NEEDED)
|
|
- get_filename_component(CONF_ZIMPL_DIR ${ZIMPL_DIR} REALPATH BASE_DIR ${CMAKE_SOURCE_DIR})
|
|
-endif()
|
|
+#export(TARGETS scip libscip
|
|
+# FILE "${PROJECT_BINARY_DIR}/scip-targets.cmake")
|
|
|
|
# configure the config file for the build tree
|
|
set(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src" "${PROJECT_BINARY_DIR}")
|
|
@@ -1176,18 +1174,16 @@ ${PROJECT_BINARY_DIR}/scip-config-version.cmake
|
|
|
|
#configure the config file for the install
|
|
set(CONF_INCLUDE_DIRS "\${CMAKE_CURRENT_LIST_DIR}/../../../include")
|
|
-if(SOPLEX_NEEDED)
|
|
- set(CONF_SOPLEX_DIR "\${CMAKE_CURRENT_LIST_DIR}/../soplex")
|
|
-endif()
|
|
-if(ZIMPL_NEEDED)
|
|
- set(CONF_ZIMPL_DIR "\${CMAKE_CURRENT_LIST_DIR}/../zimpl")
|
|
-endif()
|
|
configure_file(${PROJECT_SOURCE_DIR}/scip-config.cmake.in
|
|
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/scip-config.cmake" @ONLY)
|
|
|
|
# install the targets of the scip export group and the config file so that other projects
|
|
# can link easily against scip
|
|
-install(EXPORT scip-targets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/scip)
|
|
+install(EXPORT scip-targets
|
|
+ NAMESPACE SCIP::
|
|
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/scip
|
|
+ COMPONENT Devel
|
|
+)
|
|
install(FILES "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/scip-config.cmake"
|
|
${PROJECT_BINARY_DIR}/scip-config-version.cmake
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/scip)
|