From 09b2684d4b0680e583217f466ac2a92b00c8162a Mon Sep 17 00:00:00 2001 From: Michael Uleysky Date: Wed, 10 Feb 2016 20:12:31 +1000 Subject: [PATCH] Gmt module: Search and use libgs. --- modules/gmt/ModuleSetup.cmake | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/modules/gmt/ModuleSetup.cmake b/modules/gmt/ModuleSetup.cmake index 915f0b5..1d8541b 100644 --- a/modules/gmt/ModuleSetup.cmake +++ b/modules/gmt/ModuleSetup.cmake @@ -4,6 +4,21 @@ set_property(DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES modgmt_filter_headfo 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}) -set(MODULE_ADDITIONAL_LIBRARIES ${GMT_LIBRARIES}) +set(MODULE_ADDITIONAL_INCLUDES ${GMT_INCLUDE_DIR} ${GHOSTSCRIPT_INCLUDES}) +set(MODULE_ADDITIONAL_LIBRARIES ${GMT_LIBRARIES} ${GHOSTSCRIPT_LIBRARY})