cmake/FindILOG.cmake
author Peter Kovacs <kpeter@inf.elte.hu>
Sat, 17 Feb 2018 23:44:32 +0100
changeset 1202 4fd76139b69e
parent 1064 fc3854d936f7
child 1205 57abff252556
permissions -rw-r--r--
Add operator[] to Path structures (#250)
alpar@1062
     1
FIND_PATH(ILOG_ROOT_DIR
alpar@1062
     2
  NAMES cplex
alpar@1062
     3
  DOC "CPLEX STUDIO root directory"
alpar@1062
     4
  PATHS /opt/ibm/ILOG /usr/local/ibm/ILOG /usr/local/ILOG /usr/local/ilog
alpar@1062
     5
  PATHS "$ENV{HOME}/ILOG" "$ENV{HOME}/.local/ILOG"
alpar@1062
     6
  PATHS "$ENV{HOME}/ibm/ILOG" "$ENV{HOME}/.local/ibm/ILOG"
alpar@1062
     7
  PATHS "C:/Program Files/IBM/ILOG" 
alpar@1062
     8
  PATH_SUFFIXES "CPLEX_Studio126" "CPLEX_Studio125"
alpar@1062
     9
  "CPLEX_Studio124" "CPLEX_Studio123" "CPLEX_Studio122"
alpar@1062
    10
  NO_DEFAULT_PATH
ladanyi@635
    11
)
ladanyi@620
    12
alpar@1062
    13
IF(WIN32)
alpar@1062
    14
  IF(MSVC_VERSION STREQUAL "1400")
alpar@1062
    15
    SET(ILOG_WIN_COMPILER "windows_vs2005")
alpar@1062
    16
  ELSEIF(MSVC_VERSION STREQUAL "1500")
alpar@1062
    17
    SET(ILOG_WIN_COMPILER "windows_vs2008")
alpar@1062
    18
  ELSEIF(MSVC_VERSION STREQUAL "1600")
alpar@1062
    19
    SET(ILOG_WIN_COMPILER "windows_vs2010")
alpar@1062
    20
  ELSE()
alpar@1062
    21
    SET(ILOG_WIN_COMPILER "windows_vs2008")
alpar@1062
    22
  ENDIF()
alpar@1062
    23
  IF(CMAKE_CL_64)
alpar@1062
    24
    SET(ILOG_WIN_COMPILER "x64_${ILOG_WIN_COMPILER}")
alpar@1062
    25
    SET(ILOG_WIN_PLATFORM "x64_win32")
alpar@1062
    26
  ELSE()
alpar@1062
    27
    SET(ILOG_WIN_COMPILER "x86_${ILOG_WIN_COMPILER}")
alpar@1062
    28
    SET(ILOG_WIN_PLATFORM "x86_win32")
alpar@1062
    29
  ENDIF()
alpar@1062
    30
ENDIF()
ladanyi@620
    31
alpar@1062
    32
FIND_PATH(ILOG_CPLEX_ROOT_DIR
alpar@1062
    33
  NAMES include/ilcplex
alpar@1062
    34
  HINTS ${ILOG_ROOT_DIR}/cplex ${ILOG_ROOT_DIR}/cplex121
alpar@1062
    35
  ${ILOG_ROOT_DIR}/cplex122 ${ILOG_ROOT_DIR}/cplex123
alpar@1062
    36
  DOC "CPLEX root directory"
alpar@1062
    37
  NO_DEFAULT_PATH
ladanyi@635
    38
)
ladanyi@620
    39
alpar@1062
    40
FIND_PATH(ILOG_CONCERT_ROOT_DIR
alpar@1062
    41
  NAMES include/ilconcert
alpar@1062
    42
  HINTS ${ILOG_ROOT_DIR}/concert ${ILOG_ROOT_DIR}/concert29
alpar@1062
    43
  DOC "CONCERT root directory"
alpar@1062
    44
  NO_DEFAULT_PATH
alpar@1062
    45
)
alpar@1062
    46
alpar@1062
    47
FIND_PATH(ILOG_CPLEX_INCLUDE_DIR
alpar@1062
    48
  ilcplex/cplex.h
alpar@1062
    49
  HINTS ${ILOG_CPLEX_ROOT_DIR}/include
alpar@1062
    50
  NO_DEFAULT_PATH
alpar@1062
    51
)
alpar@1062
    52
alpar@1062
    53
FIND_PATH(ILOG_CONCERT_INCLUDE_DIR
alpar@1062
    54
  ilconcert/ilobasic.h
alpar@1062
    55
  HINTS ${ILOG_CONCERT_ROOT_DIR}/include
alpar@1062
    56
  NO_DEFAULT_PATH
alpar@1062
    57
)
alpar@1062
    58
alpar@1062
    59
FIND_LIBRARY(ILOG_CPLEX_LIBRARY
alpar@1062
    60
  cplex cplex121 cplex122 cplex123 cplex124
alpar@1062
    61
  HINTS ${ILOG_CPLEX_ROOT_DIR}/lib/x86_sles10_4.1/static_pic
alpar@1062
    62
  ${ILOG_CPLEX_ROOT_DIR}/lib/x86-64_sles10_4.1/static_pic
alpar@1062
    63
  ${ILOG_CPLEX_ROOT_DIR}/lib/x86_debian4.0_4.1/static_pic
alpar@1062
    64
  ${ILOG_CPLEX_ROOT_DIR}/lib/x86-64_debian4.0_4.1/static_pic
alpar@1126
    65
  ${ILOG_CPLEX_ROOT_DIR}/lib/x86_linux/static_pic
alpar@1126
    66
  ${ILOG_CPLEX_ROOT_DIR}/lib/x86-64_linux/static_pic
alpar@1062
    67
  ${ILOG_CPLEX_ROOT_DIR}/lib/${ILOG_WIN_COMPILER}/stat_mda
alpar@1062
    68
  NO_DEFAULT_PATH
alpar@1062
    69
  )
alpar@1062
    70
alpar@1062
    71
FIND_LIBRARY(ILOG_CONCERT_LIBRARY
alpar@1062
    72
  concert
alpar@1062
    73
  HINTS ${ILOG_CONCERT_ROOT_DIR}/lib/x86_sles10_4.1/static_pic
alpar@1062
    74
  ${ILOG_CONCERT_ROOT_DIR}/lib/x86-64_sles10_4.1/static_pic
alpar@1062
    75
  ${ILOG_CONCERT_ROOT_DIR}/lib/x86_debian4.0_4.1/static_pic
alpar@1062
    76
  ${ILOG_CONCERT_ROOT_DIR}/lib/x86-64_debian4.0_4.1/static_pic
alpar@1126
    77
  ${ILOG_CONCERT_ROOT_DIR}/lib/x86_linux/static_pic
alpar@1126
    78
  ${ILOG_CONCERT_ROOT_DIR}/lib/x86-64_linux/static_pic
alpar@1062
    79
  ${ILOG_CONCERT_ROOT_DIR}/lib/${ILOG_WIN_COMPILER}/stat_mda
alpar@1062
    80
  NO_DEFAULT_PATH
alpar@1062
    81
  )
alpar@1062
    82
alpar@1062
    83
FIND_FILE(ILOG_CPLEX_DLL
alpar@1062
    84
  cplex121.dll cplex122.dll cplex123.dll cplex124.dll
alpar@1062
    85
  HINTS ${ILOG_CPLEX_ROOT_DIR}/bin/${ILOG_WIN_PLATFORM}
alpar@1062
    86
  NO_DEFAULT_PATH
alpar@1062
    87
  )
alpar@1062
    88
alpar@1062
    89
INCLUDE(FindPackageHandleStandardArgs)
alpar@1062
    90
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ILOG
alpar@1062
    91
  DEFAULT_MSG ILOG_CPLEX_LIBRARY ILOG_CPLEX_INCLUDE_DIR
alpar@1062
    92
  )
alpar@1062
    93
alpar@1062
    94
IF(ILOG_FOUND)
alpar@1062
    95
  SET(ILOG_INCLUDE_DIRS ${ILOG_CPLEX_INCLUDE_DIR} ${ILOG_CONCERT_INCLUDE_DIR})
alpar@1062
    96
  SET(ILOG_LIBRARIES ${ILOG_CPLEX_LIBRARY} ${ILOG_CONCERT_LIBRARY})
ladanyi@636
    97
  IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
alpar@1062
    98
    # SET(CPLEX_LIBRARIES "${CPLEX_LIBRARIES};m;pthread")
alpar@1062
    99
    SET(ILOG_LIBRARIES ${ILOG_LIBRARIES} "m" "pthread")
ladanyi@636
   100
  ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
alpar@1062
   101
ENDIF(ILOG_FOUND)
ladanyi@620
   102
alpar@1062
   103
MARK_AS_ADVANCED(
alpar@1062
   104
  ILOG_CPLEX_LIBRARY ILOG_CPLEX_INCLUDE_DIR ILOG_CPLEX_DLL
alpar@1062
   105
  ILOG_CONCERT_LIBRARY ILOG_CONCERT_INCLUDE_DIR ILOG_CONCERT_DLL
alpar@1062
   106
  )