~ubuntu-branches/ubuntu/precise/kalzium/precise

« back to all changes in this revision

Viewing changes to cmake/modules/FindOCaml.cmake

  • Committer: Bazaar Package Importer
  • Author(s): Philip Muškovac
  • Date: 2011-07-03 12:28:58 UTC
  • Revision ID: james.westby@ubuntu.com-20110703122858-q1yyxncs89e4w0hs
Tags: upstream-4.6.90+repack
Import upstream version 4.6.90+repack

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# - Try to find OCaml
 
2
# Once done this will define
 
3
#
 
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
 
8
#  OCAMLC_DIR
 
9
#
 
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.
 
14
 
 
15
if ( OCAML_OCAMLC_EXECUTABLE AND OCAML_OCAMLDEP_EXECUTABLE AND OCAML_OCAMLOPT_EXECUTABLE)
 
16
 
 
17
  # in cache already
 
18
  set(OCAML_FOUND TRUE)
 
19
 
 
20
else ( OCAML_OCAMLC_EXECUTABLE AND OCAML_OCAMLDEP_EXECUTABLE AND OCAML_OCAMLOPT_EXECUTABLE)
 
21
 
 
22
FIND_PROGRAM(OCAML_OCAMLC_EXECUTABLE NAMES ocamlc)
 
23
FIND_PROGRAM(OCAML_OCAMLDEP_EXECUTABLE NAMES ocamldep)
 
24
FIND_PROGRAM(OCAML_OCAMLOPT_EXECUTABLE NAMES ocamlopt)
 
25
 
 
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}>")
 
30
 
 
31
     # show the LIBFACILE_INCLUDE_DIR and LIBFACILE_LIBRARIES variables only in the advanced view
 
32
     MARK_AS_ADVANCED(LIBFACILE_INCLUDE_DIR LIBFACILE_LIBRARIES )
 
33
 
 
34
   set(OCAML_FOUND TRUE)
 
35
else( OCAML_OCAMLC_EXECUTABLE AND OCAML_OCAMLDEP_EXECUTABLE AND OCAML_OCAMLOPT_EXECUTABLE)
 
36
 
 
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)
 
48
 
 
49
 
 
50
IF(OCAML_FOUND)
 
51
   IF(NOT OCaml_FIND_QUIETLY)
 
52
      MESSAGE(STATUS "Found OCaml: ${OCAML_OCAMLC_EXECUTABLE}")
 
53
   ENDIF(NOT OCaml_FIND_QUIETLY)
 
54
ELSE(OCAML_FOUND)
 
55
   IF(OCaml_FIND_REQUIRED)
 
56
      MESSAGE(FATAL_ERROR "Could not find OCaml")
 
57
   ENDIF(OCaml_FIND_REQUIRED)
 
58
ENDIF(OCAML_FOUND)
 
59
 
 
60
endif ( OCAML_OCAMLC_EXECUTABLE AND OCAML_OCAMLDEP_EXECUTABLE AND OCAML_OCAMLOPT_EXECUTABLE)
 
61