forked from google/or-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FindSCIP.cmake
80 lines (66 loc) · 2.02 KB
/
FindSCIP.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#[=======================================================================[.rst:
FindSCIP
--------
This module determines the SCIP library of the system.
IMPORTED Targets
^^^^^^^^^^^^^^^^
This module defines :prop_tgt:`IMPORTED` target ``SCIP::SCIP``, if
SCIP has been found.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
::
SCIP_FOUND - True if SCIP found.
Hints
^^^^^
A user may set ``SCIP_ROOT`` to a SCIP installation root to tell this
module where to look.
#]=======================================================================]
set(SCIP_FOUND FALSE)
if(CMAKE_C_COMPILER_LOADED)
include (CheckIncludeFile)
include (CheckCSourceCompiles)
elseif(CMAKE_CXX_COMPILER_LOADED)
include (CheckIncludeFileCXX)
include (CheckCXXSourceCompiles)
else()
message(FATAL_ERROR "FindSCIP only works if either C or CXX language is enabled")
endif()
if(NOT SCIP_ROOT)
set(SCIP_ROOT $ENV{SCIP_ROOT})
endif()
message(STATUS "SCIP_ROOT: ${SCIP_ROOT}")
if(NOT SCIP_ROOT)
message(FATAL_ERROR "SCIP_ROOT: not found")
else()
set(SCIP_FOUND TRUE)
endif()
if(SCIP_FOUND AND NOT TARGET SCIP::SCIP)
add_library(SCIP::SCIP UNKNOWN IMPORTED)
set_target_properties(SCIP::SCIP PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${SCIP_ROOT}/include")
if(APPLE)
set(SCIP_ARCH darwin.x86_64.gnu.opt)
set_property(TARGET SCIP::SCIP TARGET_PROPERTY IMPORTED_LOCATION
-force_load
${SCIP_ROOT}/lib/libscip.a
${SCIP_ROOT}/lib/libscipopt.a
${SCIP_ROOT}/lib/libsoplex.a
${SCIP_ROOT}/lib/libsoplex.${SCIP_ARCH}.a
)
elseif(UNIX)
set(SCIP_ARCH linux.x86_64.gnu.opt)
set_property(TARGET SCIP::SCIP TARGET_PROPERTY IMPORTED_LOCATION
${SCIP_ROOT}/lib/libscip.a
${SCIP_ROOT}/lib/libscipopt.a
${SCIP_ROOT}/lib/libsoplex.a
${SCIP_ROOT}/lib/libsoplex.${SCIP_ARCH}.a
)
elseif(MSVC)
set_property(TARGET SCIP::SCIP TARGET_PROPERTY IMPORTED_LOCATION
${SCIP_ROOT}/lib/scip.lib
${SCIP_ROOT}/lib/soplex.lib
ignore:4006
)
endif()
endif()