find_package(FLEX REQUIRED) FLEX_TARGET(GMT_hfScanner ${moddir}/modgmt_filter_headfoot.l ${CMAKE_CURRENT_BINARY_DIR}/modgmt_filter_headfoot.cpp COMPILE_FLAGS "--header-file=${CMAKE_CURRENT_BINARY_DIR}/modgmt_filter_headfoot.h") set_property(DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES modgmt_filter_headfoot.h) include_directories(${CMAKE_CURRENT_BINARY_DIR}) find_package(GMT REQUIRED) # Search ghostscript if(NOT GHOSTSCRIPT_ROOT_DIR) set(GHOSTSCRIPT_ROOT_DIR ${CMAKE_INSTALL_PREFIX} CACHE PATH "Ghostscript root path") endif() mark_as_advanced(CLEAR GHOSTSCRIPT_ROOT_DIR) find_path(GHOSTSCRIPT_INCLUDES NAMES ghostscript/gdevdsp.h ghostscript/iapi.h HINTS ${GHOSTSCRIPT_ROOT_DIR} ${CMAKE_INSTALL_PREFIX}) find_library(GHOSTSCRIPT_LIBRARY gs HINTS ${GHOSTSCRIPT_ROOT_DIR} ${CMAKE_INSTALL_PREFIX}) if(NOT GHOSTSCRIPT_INCLUDES) message(FATAL_ERROR "Ghostscript includes not found!") endif() if(NOT GHOSTSCRIPT_LIBRARY) message(FATAL_ERROR "Ghostscript library not found!") endif() set(MODULE_ADDITIONAL_SOURCES ${FLEX_GMT_hfScanner_OUTPUTS}) set(MODULE_ADDITIONAL_INCLUDES ${GMT_INCLUDE_DIR} ${GHOSTSCRIPT_INCLUDES}) set(MODULE_ADDITIONAL_LIBRARIES ${GMT_LIBRARIES} ${GHOSTSCRIPT_LIBRARY})