2 # Once done this will define
4 # OCAML_FOUND - system has OCaml
5 # OCAML_OCAMLC_EXECUTABLE - the Libfacile include directory
6 # OCAML_OCAMLDEP_EXECUTABLE - Link these to use Libfacile
7 # OCAML_OCAMLOPT_EXECUTABLE - Compiler switches required for using Libfacile
10 # Copyright (c) 2006, Carsten Niehaus, <cniehaus@gmx.de>
11 # Copyright (c) 2006, Montel Laurent, <montel@kde.org>
12 # Redistribution and use is allowed according to the terms of the BSD license.
13 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
15 if ( OCAML_OCAMLC_EXECUTABLE AND OCAML_OCAMLDEP_EXECUTABLE AND OCAML_OCAMLOPT_EXECUTABLE)
20 else ( OCAML_OCAMLC_EXECUTABLE AND OCAML_OCAMLDEP_EXECUTABLE AND OCAML_OCAMLOPT_EXECUTABLE)
22 FIND_PROGRAM(OCAML_OCAMLC_EXECUTABLE NAMES ocamlc)
23 FIND_PROGRAM(OCAML_OCAMLDEP_EXECUTABLE NAMES ocamldep)
24 FIND_PROGRAM(OCAML_OCAMLOPT_EXECUTABLE NAMES ocamlopt)
26 if( OCAML_OCAMLC_EXECUTABLE AND OCAML_OCAMLDEP_EXECUTABLE AND OCAML_OCAMLOPT_EXECUTABLE)
27 EXECUTE_PROCESS(COMMAND ${OCAML_OCAMLC_EXECUTABLE} -where OUTPUT_VARIABLE OCAMLC_DIR)
28 STRING(REPLACE "\n" "" OCAMLC_DIR "${OCAMLC_DIR}")
29 #MESSAGE(STATUS "ocamlc directory <${OCAMLC_DIR}>")
31 # show the LIBFACILE_INCLUDE_DIR and LIBFACILE_LIBRARIES variables only in the advanced view
32 MARK_AS_ADVANCED(LIBFACILE_INCLUDE_DIR LIBFACILE_LIBRARIES )
35 else( OCAML_OCAMLC_EXECUTABLE AND OCAML_OCAMLDEP_EXECUTABLE AND OCAML_OCAMLOPT_EXECUTABLE)
37 if(NOT OCAML_OCAMLC_EXECUTABLE)
38 message(STATUS "ocamlc not found.")
39 endif(NOT OCAML_OCAMLC_EXECUTABLE)
40 if(NOT OCAML_OCAMLDEP_EXECUTABLE)
41 message(STATUS "ocamldep not found.")
42 endif(NOT OCAML_OCAMLDEP_EXECUTABLE)
43 if(NOT OCAML_OCAMLOPT_EXECUTABLE)
44 message(STATUS "ocamlopt not found.")
45 endif(NOT OCAML_OCAMLOPT_EXECUTABLE)
46 set(OCAML_FOUND FALSE)
47 endif( OCAML_OCAMLC_EXECUTABLE AND OCAML_OCAMLDEP_EXECUTABLE AND OCAML_OCAMLOPT_EXECUTABLE)
51 IF(NOT OCaml_FIND_QUIETLY)
52 MESSAGE(STATUS "Found OCaml: ${OCAML_OCAMLC_EXECUTABLE}")
53 ENDIF(NOT OCaml_FIND_QUIETLY)
55 IF(OCaml_FIND_REQUIRED)
56 MESSAGE(FATAL_ERROR "Could not find OCaml")
57 ENDIF(OCaml_FIND_REQUIRED)
60 endif ( OCAML_OCAMLC_EXECUTABLE AND OCAML_OCAMLDEP_EXECUTABLE AND OCAML_OCAMLOPT_EXECUTABLE)