diff --git a/cmake/modules/FindLibfacile.cmake b/cmake/modules/FindLibfacile.cmake index bef726e..043c65f 100644 --- a/cmake/modules/FindLibfacile.cmake +++ b/cmake/modules/FindLibfacile.cmake @@ -4,7 +4,6 @@ # LIBFACILE_FOUND - system has Libfacile # LIBFACILE_INCLUDE_DIR - the Libfacile include directory # LIBFACILE_LIBRARIES - Link these to use Libfacile -# LIBFACILE_DEFINITIONS - Compiler switches required for using Libfacile # # Copyright (c) 2006, Carsten Niehaus, # Copyright (c) 2006, Montel Laurent, @@ -14,35 +13,20 @@ find_package(OCaml) -set(LIBFACILE_FOUND FALSE) - if( OCAML_FOUND ) - find_file(LIBFACILE_LIBRARIES NAMES facile.a - PATHS - ${OCAMLC_DIR}/facile/ + find_library(LIBFACILE_LIBRARIES NAMES facile.a + HINTS ${OCAMLC_DIR} + PATH_SUFFIXES facile ocaml/facile ) - #message(STATUS "LIBFACILE_LIBRARIES :<${LIBFACILE_LIBRARIES}>") - find_path(LIBFACILE_INCLUDE_DIR NAMES facile.a - PATHS - ${OCAMLC_DIR}/ - PATH_SUFFIXES facile + find_path(LIBFACILE_INCLUDE_DIR NAMES facile.cmi + HINTS ${OCAMLC_DIR} + PATH_SUFFIXES facile lib/ocaml/facile ) - #message(STATUS "LIBFACILE_INCLUDE_DIR <${LIBFACILE_INCLUDE_DIR}>") - if(LIBFACILE_INCLUDE_DIR AND LIBFACILE_LIBRARIES) - set(LIBFACILE_FOUND TRUE) - endif(LIBFACILE_INCLUDE_DIR AND LIBFACILE_LIBRARIES) endif(OCAML_FOUND) - -if(LIBFACILE_FOUND) - if(NOT Libfacile_FIND_QUIETLY) - message(STATUS "Found Libfacile: ${LIBFACILE_LIBRARIES}") - endif(NOT Libfacile_FIND_QUIETLY) -else(LIBFACILE_FOUND) - if(Libfacile_FIND_REQUIRED) - message(FATAL_ERROR "Could not find Libfacile") - endif(Libfacile_FIND_REQUIRED) -endif(LIBFACILE_FOUND) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Libfacile DEFAULT_MSG LIBFACILE_INCLUDE_DIR + LIBFACILE_LIBRARIES OCAML_FOUND) # show the LIBFACILE_INCLUDE_DIR and LIBFACILE_LIBRARIES variables only in the advanced view mark_as_advanced(LIBFACILE_INCLUDE_DIR LIBFACILE_LIBRARIES ) diff --git a/src/CMakeOCamlInstructions.cmake b/src/CMakeOCamlInstructions.cmake index 40b6755..de89253 100644 --- a/src/CMakeOCamlInstructions.cmake +++ b/src/CMakeOCamlInstructions.cmake @@ -2,7 +2,7 @@ link_directories (${OCAMLC_DIR}) macro(OCAML_MLI_TO_CMI _cmi _mli) add_custom_command(OUTPUT ${_cmi} - COMMAND ${OCAML_OCAMLC_EXECUTABLE} ARGS -o ${_cmi} -I +facile -c ${_mli} + COMMAND ${OCAML_OCAMLC_EXECUTABLE} ARGS -o ${_cmi} -I ${LIBFACILE_INCLUDE_DIR} -c ${_mli} DEPENDS ${_mli} ${ARGN} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${_cmi}) @@ -10,7 +10,7 @@ endmacro(OCAML_MLI_TO_CMI) macro(OCAML_ML_TO_CMX _cmx _ml) add_custom_command(OUTPUT ${_cmx} - COMMAND ${OCAML_OCAMLOPT_EXECUTABLE} ARGS -o ${_cmx} -I +facile -c ${_ml} + COMMAND ${OCAML_OCAMLOPT_EXECUTABLE} ARGS -o ${_cmx} -I ${LIBFACILE_INCLUDE_DIR} -c ${_ml} DEPENDS ${_ml} ${ARGN} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${_cmx}) @@ -58,7 +58,7 @@ ocaml_ml_to_cmx(${CMAKE_CURRENT_BINARY_DIR}/lexer.cmx ${CMAKE_CURRENT_SOURCE_DIR # object files add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/modwrap.o - COMMAND ${OCAML_OCAMLOPT_EXECUTABLE} -I +facile -c ${CMAKE_CURRENT_SOURCE_DIR}/solver/modwrap.c -o ${CMAKE_CURRENT_BINARY_DIR}/modwrap.o + COMMAND ${OCAML_OCAMLOPT_EXECUTABLE} -I ${LIBFACILE_INCLUDE_DIR} -c ${CMAKE_CURRENT_SOURCE_DIR}/solver/modwrap.c -o ${CMAKE_CURRENT_BINARY_DIR}/modwrap.o DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/solver/modwrap.c ${CMAKE_CURRENT_BINARY_DIR}/solver.o WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_CURRENT_BINARY_DIR}/modwrap.o)