forked from google/or-tools
-
Notifications
You must be signed in to change notification settings - Fork 1
/
FindXPRESS.cmake
74 lines (60 loc) · 2.02 KB
/
FindXPRESS.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
#[=======================================================================[.rst:
FindXPRESS
--------
This module determines the XPRESS library of the system.
IMPORTED Targets
^^^^^^^^^^^^^^^^
This module defines :prop_tgt:`IMPORTED` target ``XPRESS::XPRESS``, if
XPRESS has been found.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
::
XPRESS_FOUND - True if XPRESS found.
Hints
^^^^^
A user may set ``XPRESS_ROOT`` to a XPRESS installation root to tell this
module where to look.
#]=======================================================================]
set(XPRESS_FOUND FALSE)
if(CMAKE_C_COMPILER_LOADED)
include (CheckIncludeFile)
include (CheckCSourceCompiles)
elseif(CMAKE_CXX_COMPILER_LOADED)
include (CheckIncludeFileCXX)
include (CheckCXXSourceCompiles)
else()
message(FATAL_ERROR "FindXPRESS only works if either C or CXX language is enabled")
endif()
if(NOT XPRESS_ROOT)
set(XPRESS_ROOT $ENV{XPRESS_ROOT})
endif()
message(STATUS "XPRESS_ROOT: ${XPRESS_ROOT}")
if(NOT XPRESS_ROOT)
message(FATAL_ERROR "XPRESS_ROOT: not found")
else()
set(XPRESS_FOUND TRUE)
endif()
if(XPRESS_FOUND AND NOT TARGET XPRESS::XPRESS)
add_library(XPRESS::XPRESS UNKNOWN IMPORTED)
if(UNIX)
set_target_properties(XPRESS::XPRESS PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${XPRESS_ROOT}/include")
endif()
if(APPLE)
set_target_properties(XPRESS::XPRESS PROPERTIES
#INSTALL_RPATH_USE_LINK_PATH TRUE
#BUILD_WITH_INSTALL_RPATH TRUE
#INTERFACE_LINK_DIRECTORIES "${XPRESS_ROOT}/lib"
#INSTALL_RPATH "${XPRESS_ROOT}/lib;${INSTALL_RPATH}"
IMPORTED_LOCATION "${XPRESS_ROOT}/lib/libxprs.dylib")
elseif(UNIX)
set_target_properties(XPRESS::XPRESS PROPERTIES
INTERFACE_LINK_DIRECTORIES "${XPRESS_ROOT}/lib"
IMPORTED_LOCATION ${XPRESS_ROOT}/lib/libxprs.so)
elseif(MSVC)
set_target_properties(XPRESS::XPRESS PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${XPRESS_ROOT}\\include"
IMPORTED_LOCATION "${XPRESS_ROOT}\\lib\\xprs.lib")
endif()
endif()