<commit_before># This module finds cplex.
#
# User can give CPLEX_ROOT_DIR as a hint stored in the cmake cache.
#
# It sets the following variables:
#  CPLEX_FOUND              - Set to false, or undefined, if cplex isn't found.
#  CPLEX_INCLUDE_DIRS       - include directory
#  CPLEX_LIBRARIES          - library files

set(CPLEX_ROOT_DIR "" CACHE PATH "CPLEX root directory.")

if(WIN32)
  set(CPLEX_WIN_VERSION ${CPLEX_WIN_VERSION} CACHE STRING "CPLEX version to be used.")
  if(NOT CPLEX_ROOT_DIR)
    set(CPLEX_STUDIO_DIR CPLEX_STUDIO_DIR${CPLEX_WIN_VERSION})
    execute_process(COMMAND cmd /C set ${CPLEX_STUDIO_DIR} OUTPUT_VARIABLE CPLEX_STUDIO_DIR_VAR ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)

    if(NOT CPLEX_STUDIO_DIR_VAR)
      MESSAGE(FATAL_ERROR "Unable to find CPLEX: environment variable CPLEX_STUDIO_DIR<VERSION> not set.")
    endif()

    STRING(REGEX REPLACE "^CPLEX_STUDIO_DIR" "" CPLEX_STUDIO_DIR_VAR ${CPLEX_STUDIO_DIR_VAR})
    if(NOT CPLEX_WIN_VERSION)
      STRING(REGEX MATCH "^[0-9]+" CPLEX_WIN_VERSION ${CPLEX_STUDIO_DIR_VAR})
    endif()

    STRING(REGEX REPLACE "^[0-9]+=" "" CPLEX_STUDIO_DIR_VAR ${CPLEX_STUDIO_DIR_VAR})
    file(TO_CMAKE_PATH "${CPLEX_STUDIO_DIR_VAR}" CPLEX_ROOT_DIR)

  elseif(NOT CPLEX_WIN_VERSION)
    STRING(REGEX MATCH "[0-9]+$" CPLEX_WIN_VERSION ${CPLEX_ROOT_DIR})
    if(NOT CPLEX_WIN_VERSION)
      message(FATAL_ERROR "Unable to determine CPLEX version number. Specify CPLEX_WIN_VERSION")
    endif()
  endif()

  MESSAGE(STATUS "Found CLPEX version ${CPLEX_WIN_VERSION} at '${CPLEX_ROOT_DIR}'")

  STRING(REGEX REPLACE "/VC/bin/.*" "" VISUAL_STUDIO_PATH ${CMAKE_C_COMPILER})
  STRING(REGEX MATCH "Studio [0-9]+" CPLEX_WIN_VS_VERSION ${VISUAL_STUDIO_PATH})
  STRING(REGEX REPLACE "Studio " "" CPLEX_WIN_VS_VERSION ${CPLEX_WIN_VS_VERSION})

  set(CPLEX_WIN_VS_VERSION ${CPLEX_WIN_VS_VERSION} CACHE STRING "Visual Studio Version")

  if(${CPLEX_WIN_VS_VERSION} STREQUAL "9")
    set(CPLEX_WIN_VS_VERSION 2008)
  elseif(${CPLEX_WIN_VS_VERSION} STREQUAL "10")
    set(CPLEX_WIN_VS_VERSION 2010)
  elseif(${CPLEX_WIN_VS_VERSION} STREQUAL "11")
    set(CPLEX_WIN_VS_VERSION 2012)
  elseif(${CPLEX_WIN_VS_VERSION} STREQUAL "14")
    set(CPLEX_WIN_VS_VERSION 2015)
  else()
    MESSAGE(FATAL_ERROR "CPLEX: unknown Visual Studio version '${CPLEX_WIN_VS_VERSION}' at '${VISUAL_STUDIO_PATH}'.")
  endif()


  if("${CMAKE_C_COMPILER}" MATCHES "amd64")
    set(CPLEX_WIN_BITNESS x64)
  else()
    set(CPLEX_WIN_BITNESS x86)
  endif()

  set(CPLEX_WIN_BITNESS ${CPLEX_WIN_BITNESS} CACHE STRING "On Windows: x86 or x64 (32bit resp. 64bit)")

  MESSAGE(STATUS "FindCPLEX: using Visual Studio ${CPLEX_WIN_VS_VERSION} ${CPLEX_WIN_BITNESS} at '${VISUAL_STUDIO_PATH}'")

  if(NOT CPLEX_WIN_LINKAGE)
    set(CPLEX_WIN_LINKAGE mda CACHE STRING "CPLEX linkage variant on Windows. One of these: mda (dll, release), mdd (dll, debug), mta (static, release), mtd (static, debug)")
  endif(NOT CPLEX_WIN_LINKAGE)

  # now, generate platform string
  set(CPLEX_WIN_PLATFORM "${CPLEX_WIN_BITNESS}_windows_vs${CPLEX_WIN_VS_VERSION}/stat_${CPLEX_WIN_LINKAGE}")
  MESSAGE(STATUS "FindCPLEX: using platform string ${CPLEX_WIN_PLATFORM}")

else()

  set(CPLEX_ROOT_DIR "" CACHE PATH "CPLEX root directory.")
  set(CPLEX_WIN_PLATFORM "")

endif()


FIND_PATH(CPLEX_INCLUDE_DIR
  ilcplex/cplex.h
  HINTS ${CPLEX_ROOT_DIR}/cplex/include
        ${CPLEX_ROOT_DIR}/include
  PATHS ENV C_INCLUDE_PATH
        ENV C_PLUS_INCLUDE_PATH
        ENV INCLUDE_PATH
  )

FIND_PATH(CPLEX_CONCERT_INCLUDE_DIR
  ilconcert/iloenv.h
  HINTS ${CPLEX_ROOT_DIR}/concert/include
        ${CPLEX_ROOT_DIR}/include
  PATHS ENV C_INCLUDE_PATH
        ENV C_PLUS_INCLUDE_PATH
        ENV INCLUDE_PATH
  )

FIND_LIBRARY(CPLEX_LIBRARY
  NAMES cplex${CPLEX_WIN_VERSION} cplex
  HINTS ${CPLEX_ROOT_DIR}/cplex/lib/${CPLEX_WIN_PLATFORM} #windows
        ${CPLEX_ROOT_DIR}/cplex/lib/x86-64_debian4.0_4.1/static_pic #unix
        ${CPLEX_ROOT_DIR}/cplex/lib/x86-64_sles10_4.1/static_pic #unix
        ${CPLEX_ROOT_DIR}/cplex/lib/x86-64_osx/static_pic #osx
        ${CPLEX_ROOT_DIR}/cplex/lib/x86-64_darwin/static_pic #osx
  PATHS ENV LIBRARY_PATH #unix
        ENV LD_LIBRARY_PATH #unix
  )
message(STATUS "CPLEX Library: ${CPLEX_LIBRARY}")

FIND_LIBRARY(CPLEX_ILOCPLEX_LIBRARY
  ilocplex
  HINTS ${CPLEX_ROOT_DIR}/cplex/lib/${CPLEX_WIN_PLATFORM} #windows<commit_msg>tweak FindCPLEX for version 128[0] (lib name: cplex1280.lib)<commit_after># This module finds cplex.
#
# User can give CPLEX_ROOT_DIR as a hint stored in the cmake cache.
#
# It sets the following variables:
#  CPLEX_FOUND              - Set to false, or undefined, if cplex isn't found.
#  CPLEX_INCLUDE_DIRS       - include directory
#  CPLEX_LIBRARIES          - library files

set(CPLEX_ROOT_DIR "" CACHE PATH "CPLEX root directory.")

if(WIN32)
  set(CPLEX_WIN_VERSION ${CPLEX_WIN_VERSION} CACHE STRING "CPLEX version to be used.")
  if(NOT CPLEX_ROOT_DIR)
    set(CPLEX_STUDIO_DIR CPLEX_STUDIO_DIR${CPLEX_WIN_VERSION})
    execute_process(COMMAND cmd /C set ${CPLEX_STUDIO_DIR} OUTPUT_VARIABLE CPLEX_STUDIO_DIR_VAR ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)

    if(NOT CPLEX_STUDIO_DIR_VAR)
      MESSAGE(FATAL_ERROR "Unable to find CPLEX: environment variable CPLEX_STUDIO_DIR<VERSION> not set.")
    endif()

    STRING(REGEX REPLACE "^CPLEX_STUDIO_DIR" "" CPLEX_STUDIO_DIR_VAR ${CPLEX_STUDIO_DIR_VAR})
    if(NOT CPLEX_WIN_VERSION)
      STRING(REGEX MATCH "^[0-9]+" CPLEX_WIN_VERSION ${CPLEX_STUDIO_DIR_VAR})
    endif()

    STRING(REGEX REPLACE "^[0-9]+=" "" CPLEX_STUDIO_DIR_VAR ${CPLEX_STUDIO_DIR_VAR})
    file(TO_CMAKE_PATH "${CPLEX_STUDIO_DIR_VAR}" CPLEX_ROOT_DIR)

  elseif(NOT CPLEX_WIN_VERSION)
    STRING(REGEX MATCH "[0-9]+$" CPLEX_WIN_VERSION ${CPLEX_ROOT_DIR})
    if(NOT CPLEX_WIN_VERSION)
      message(FATAL_ERROR "Unable to determine CPLEX version number. Specify CPLEX_WIN_VERSION")
    endif()
  endif()

  MESSAGE(STATUS "Found CLPEX version ${CPLEX_WIN_VERSION} at '${CPLEX_ROOT_DIR}'")

  STRING(REGEX REPLACE "/VC/bin/.*" "" VISUAL_STUDIO_PATH ${CMAKE_C_COMPILER})
  STRING(REGEX MATCH "Studio [0-9]+" CPLEX_WIN_VS_VERSION ${VISUAL_STUDIO_PATH})
  STRING(REGEX REPLACE "Studio " "" CPLEX_WIN_VS_VERSION ${CPLEX_WIN_VS_VERSION})

  set(CPLEX_WIN_VS_VERSION ${CPLEX_WIN_VS_VERSION} CACHE STRING "Visual Studio Version")

  if(${CPLEX_WIN_VS_VERSION} STREQUAL "9")
    set(CPLEX_WIN_VS_VERSION 2008)
  elseif(${CPLEX_WIN_VS_VERSION} STREQUAL "10")
    set(CPLEX_WIN_VS_VERSION 2010)
  elseif(${CPLEX_WIN_VS_VERSION} STREQUAL "11")
    set(CPLEX_WIN_VS_VERSION 2012)
  elseif(${CPLEX_WIN_VS_VERSION} STREQUAL "14")
    set(CPLEX_WIN_VS_VERSION 2015)
  else()
    MESSAGE(FATAL_ERROR "CPLEX: unknown Visual Studio version '${CPLEX_WIN_VS_VERSION}' at '${VISUAL_STUDIO_PATH}'.")
  endif()


  if("${CMAKE_C_COMPILER}" MATCHES "amd64")
    set(CPLEX_WIN_BITNESS x64)
  else()
    set(CPLEX_WIN_BITNESS x86)
  endif()

  set(CPLEX_WIN_BITNESS ${CPLEX_WIN_BITNESS} CACHE STRING "On Windows: x86 or x64 (32bit resp. 64bit)")

  MESSAGE(STATUS "FindCPLEX: using Visual Studio ${CPLEX_WIN_VS_VERSION} ${CPLEX_WIN_BITNESS} at '${VISUAL_STUDIO_PATH}'")

  if(NOT CPLEX_WIN_LINKAGE)
    set(CPLEX_WIN_LINKAGE mda CACHE STRING "CPLEX linkage variant on Windows. One of these: mda (dll, release), mdd (dll, debug), mta (static, release), mtd (static, debug)")
  endif(NOT CPLEX_WIN_LINKAGE)

  # now, generate platform string
  set(CPLEX_WIN_PLATFORM "${CPLEX_WIN_BITNESS}_windows_vs${CPLEX_WIN_VS_VERSION}/stat_${CPLEX_WIN_LINKAGE}")
  MESSAGE(STATUS "FindCPLEX: using platform string ${CPLEX_WIN_PLATFORM}")

else()

  set(CPLEX_ROOT_DIR "" CACHE PATH "CPLEX root directory.")
  set(CPLEX_WIN_PLATFORM "")

endif()


FIND_PATH(CPLEX_INCLUDE_DIR
  ilcplex/cplex.h
  HINTS ${CPLEX_ROOT_DIR}/cplex/include
        ${CPLEX_ROOT_DIR}/include
  PATHS ENV C_INCLUDE_PATH
        ENV C_PLUS_INCLUDE_PATH
        ENV INCLUDE_PATH
  )
message(STATUS "CPLEX Include dir: ${CPLEX_INCLUDE_DIR}")

FIND_PATH(CPLEX_CONCERT_INCLUDE_DIR
  ilconcert/iloenv.h
  HINTS ${CPLEX_ROOT_DIR}/concert/include
        ${CPLEX_ROOT_DIR}/include
  PATHS ENV C_INCLUDE_PATH
        ENV C_PLUS_INCLUDE_PATH
        ENV INCLUDE_PATH
  )
message(STATUS "CONCERT Include dir: ${CPLEX_CONCERT_INCLUDE_DIR}")

FIND_LIBRARY(CPLEX_LIBRARY
  NAMES cplex${CPLEX_WIN_VERSION} cplex${CPLEX_WIN_VERSION}0 cplex
  HINTS ${CPLEX_ROOT_DIR}/cplex/lib/${CPLEX_WIN_PLATFORM} #windows
        ${CPLEX_ROOT_DIR}/cplex/lib/x86-64_debian4.0_4.1/static_pic #unix
        ${CPLEX_ROOT_DIR}/cplex/lib/x86-64_sles10_4.1/static_pic #unix
        ${CPLEX_ROOT_DIR}/cplex/lib/x86-64_osx/static_pic #osx
        ${CPLEX_ROOT_DIR}/cplex/lib/x86-64_darwin/static_pic #osx
  PATHS ENV LIBRARY_PATH #unix
        ENV LD_LIBRARY_PATH #unix
  )
message(STATUS "CPLEX Library: ${CPLEX_LIBRARY}")

FIND_LIBRARY(CPLEX_ILOCPLEX_LIBRARY
  ilocplex
  HINTS ${CPLEX_ROOT_DIR}/cplex/lib/${CPLEX_WIN_PLATFORM} #windows
{'fraction_non_alphanumeric': 0.10447928331466966, 'fraction_numerical': 0.01690929451287794, 'mean_word_length': 5.092087312414734, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7222239', 'n_tokens_mistral': 3930, 'n_tokens_neox': 3486, 'n_words': 649}