Prefix native systemlibs with /:systemlib
[hiphop-php.git] / CMake / FindOCaml.cmake
blobc4a0694a5cc25fb8b89631f4e24b437eaee41642
1 set(OCAMLC_FOUND FALSE)
2 set(OCAMLC_OPT_SUFFIX "")
4 if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux")
5   message(STATUS "Not on Linux, cannot build Hack typechecker")
6   return()
7 endif()
9 find_program(OCAMLC_EXECUTABLE ocamlc DOC "path to ocamlc")
10 mark_as_advanced(OCAMLC_EXECUTABLE)
12 if(OCAMLC_EXECUTABLE)
13   message(STATUS "Found ocamlc: ${OCAMLC_EXECUTABLE}")
14   execute_process(COMMAND ${OCAMLC_EXECUTABLE} -version
15     OUTPUT_VARIABLE OCAMLC_VERSION
16     OUTPUT_STRIP_TRAILING_WHITESPACE)
17   if ("${OCAMLC_VERSION}" VERSION_LESS "3.12")
18     message(STATUS "OCaml version ${OCAMLC_VERSION} is too old "
19       "to build the Hack typechecker, need at least 3.12")
20   else()
21     set(OCAMLC_FOUND TRUE)
23     find_program(OCAMLC_OPT_EXECUTABLE ocamlc.opt DOC "path to ocamlc.opt")
24     mark_as_advanced(OCAMLC_OPT_EXECUTABLE)
26     if (OCAMLC_OPT_EXECUTABLE)
27       message(STATUS "Found ocamlc.opt: ${OCAMLC_OPT_EXECUTABLE}")
28       set(OCAMLC_OPT_SUFFIX ".opt")
29     else()
30       message(STATUS "Could not find ocamlc.opt, "
31         "Hack typechecker build will be slow")
32     endif()
33   endif()
34 else()
35   message(STATUS "OCaml not found, will not build Hack typechecker")
36 endif()