summaryrefslogtreecommitdiffstats
path: root/kalzium/ConfigureChecks.cmake
blob: bb1da003602b18ab658d785b7240ffb3d6409c4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
###########################################
#                                         #
#  Improvements and feedback are welcome  #
#                                         #
#  This file is released under GPL >= 3   #
#                                         #
###########################################


##### check for ocaml/facile

if( WITH_OCAML_SOLVER )

  if( NOT DEFINED HAVE_OCAML )
    message( STATUS "Search for ocaml" )

    foreach( _exec ocamlc ocamldep ocamlopt )
      string( TOUPPER "${_exec}_EXECUTABLE" _exec_var )
      if( NOT DEFINED ${_exec_var} )
        find_program( ${_exec_var} NAMES ${_exec} )
        if( NOT ${_exec_var} )
          tde_message_fatal( "${_exec} is requested, but was not found on your system" )
        endif( )
      endif( )
    endforeach( )

    if( NOT DEFINED OCAML_BASEDIR )
      execute_process(
        COMMAND ${OCAMLOPT_EXECUTABLE} -where
        OUTPUT_VARIABLE OCAML_BASEDIR
        ERROR_VARIABLE OCAML_BASEDIR
        OUTPUT_STRIP_TRAILING_WHITESPACE
        ERROR_STRIP_TRAILING_WHITESPACE
      )
      if( EXISTS ${OCAML_BASEDIR} AND IS_DIRECTORY ${OCAML_BASEDIR} )
        set( OCAML_BASEDIR ${OCAML_BASEDIR} CACHE PATH "Ocaml base directory" )
        set( OCAML_LIBRARY_DIR ${OCAML_BASEDIR} CACHE PATH "Ocaml libraries directory" )
      else( )
        tde_message_fatal( "Ocaml is requested, but was not found on your system" )
      endif( )
    endif( )

    set( HAVE_OCAML 1 CACHE INTERNAL "" )
    message( STATUS "Search for ocaml - found" )
  endif( )


  if( NOT DEFINED HAVE_FACILE )
    message( STATUS "Search for facile" )

    if( NOT DEFINED FACILE_LIBRARIES )
      find_library( FACILE_LIBRARIES
        NAMES facile.a
        HINTS ${OCAML_BASEDIR}
        PATH_SUFFIXES facile ocaml/facile
      )
    endif( )

    if( NOT DEFINED FACILE_INCLUDE_DIR )
      find_path( FACILE_INCLUDE_DIR
          NAMES facile.cmi
          HINTS ${OCAML_BASEDIR}
          PATH_SUFFIXES facile lib/ocaml/facile
      )
    endif( )

    if( (NOT FACILE_LIBRARIES) OR (NOT FACILE_INCLUDE_DIR) )
      tde_message_fatal( "Facile is requested, but was not found on your system" )
    endif( )

    set( HAVE_FACILE 1 CACHE INTERNAL "Enable build with ocaml/facile" )
    message( STATUS "Search for facile - found" )
  endif( )

endif( WITH_OCAML_SOLVER )