remove hh_fileinfo
[hiphop-php.git] / CMake / FindOCaml.cmake
blobe85f5d76fec577b642dd8d607ce48d255d2d0aec
1 set(OCAMLC_FOUND FALSE)
2 set(OCAMLC_OPT_SUFFIX "")
4 find_program(OCAMLC_EXECUTABLE ocamlc DOC "path to ocamlc")
5 mark_as_advanced(OCAMLC_EXECUTABLE)
7 if(OCAMLC_EXECUTABLE)
8   message(STATUS "Found ocamlc: ${OCAMLC_EXECUTABLE}")
9   execute_process(COMMAND ${OCAMLC_EXECUTABLE} -version
10     OUTPUT_VARIABLE OCAMLC_VERSION
11     OUTPUT_STRIP_TRAILING_WHITESPACE)
12   if ("${OCAMLC_VERSION}" VERSION_LESS "4.01")
13     message(FATAL_ERROR "OCaml version ${OCAMLC_VERSION} is too old "
14       "to build the Hack typechecker, need at least 4.01. Directions "
15       "at https://github.com/facebook/hhvm/wiki/Building-and-Installing-HHVM "
16       "may have instructions how to get a newer version for your distro.")
17   else()
18     set(OCAMLC_FOUND TRUE)
20     find_program(OCAMLC_OPT_EXECUTABLE ocamlc.opt DOC "path to ocamlc.opt")
21     mark_as_advanced(OCAMLC_OPT_EXECUTABLE)
23     if (OCAMLC_OPT_EXECUTABLE)
24       message(STATUS "Found ocamlc.opt: ${OCAMLC_OPT_EXECUTABLE}")
25       set(OCAMLC_OPT_SUFFIX ".opt")
26     else()
27       message(STATUS "Could not find ocamlc.opt, "
28         "Hack typechecker build will be slow")
29     endif()
30   endif()
31 else()
32   message(FATAL_ERROR "OCaml not found, can not build Hack typechecker")
33 endif()