Michael Uleysky
9 years ago
5 changed files with 127 additions and 3 deletions
@ -0,0 +1,114 @@ |
|||||||
|
# Locate GMT |
||||||
|
# |
||||||
|
# This module accepts the following environment variables: |
||||||
|
# |
||||||
|
# GMT_DIR or GMT_ROOT - Specify the location of GMT |
||||||
|
# |
||||||
|
# This module defines the following CMake variables: |
||||||
|
# |
||||||
|
# GMT_FOUND - True if libgmt is found |
||||||
|
# GMT_LIBRARY - A variable pointing to the GMT library |
||||||
|
# GMT_INCLUDE_DIR - Where to find the headers |
||||||
|
|
||||||
|
# Created by Michael Uleysky. Based on FindGDAL.cmake created by Eric Wing. |
||||||
|
# This makes the presumption that you are include gmt.h like |
||||||
|
# |
||||||
|
#include "gmt.h" |
||||||
|
|
||||||
|
if (DEFINED GMT_ROOT AND NOT GMT_ROOT) |
||||||
|
set (GMT_LIBRARY "" CACHE INTERNAL "") |
||||||
|
set (GMT_INCLUDE_DIR "" CACHE INTERNAL "") |
||||||
|
return() |
||||||
|
endif (DEFINED GMT_ROOT AND NOT GMT_ROOT) |
||||||
|
|
||||||
|
if (UNIX AND NOT GMT_FOUND) |
||||||
|
# Use gmt-config to obtain the library version (this should hopefully |
||||||
|
# allow us to -lGMT5.x.y where x.y are correct version) |
||||||
|
find_program (GMT_CONFIG gmt-config |
||||||
|
HINTS |
||||||
|
${GMT_DIR} |
||||||
|
${GMT_ROOT} |
||||||
|
$ENV{GMT_DIR} |
||||||
|
$ENV{GMT_ROOT} |
||||||
|
PATH_SUFFIXES bin |
||||||
|
PATHS |
||||||
|
/sw # Fink |
||||||
|
/opt/local # DarwinPorts |
||||||
|
/opt/csw # Blastwave |
||||||
|
/opt/gmt |
||||||
|
/opt/GMT |
||||||
|
/opt |
||||||
|
/usr/local |
||||||
|
) |
||||||
|
|
||||||
|
if (GMT_CONFIG) |
||||||
|
execute_process (COMMAND ${GMT_CONFIG} --cflags |
||||||
|
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE |
||||||
|
OUTPUT_VARIABLE GMT_CONFIG_CFLAGS) |
||||||
|
if (GMT_CONFIG_CFLAGS) |
||||||
|
string (REGEX MATCHALL "-I[^ ]+" _GMT_dashI ${GMT_CONFIG_CFLAGS}) |
||||||
|
string (REGEX REPLACE "-I" "" _GMT_includepath "${_GMT_dashI}") |
||||||
|
string (REGEX REPLACE "-I[^ ]+" "" _GMT_cflags_other ${GMT_CONFIG_CFLAGS}) |
||||||
|
endif (GMT_CONFIG_CFLAGS) |
||||||
|
execute_process (COMMAND ${GMT_CONFIG} --libs |
||||||
|
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE |
||||||
|
OUTPUT_VARIABLE GMT_CONFIG_LIBS) |
||||||
|
if (GMT_CONFIG_LIBS) |
||||||
|
string (REGEX MATCHALL "-l[^ ]+" _GMT_dashl ${GMT_CONFIG_LIBS}) |
||||||
|
string (REGEX REPLACE "-l" "" _GMT_lib "${_GMT_dashl}") |
||||||
|
string (REGEX MATCHALL "-L[^ ]+" _GMT_dashL ${GMT_CONFIG_LIBS}) |
||||||
|
string (REGEX REPLACE "-L" "" _GMT_libpath "${_GMT_dashL}") |
||||||
|
endif (GMT_CONFIG_LIBS) |
||||||
|
endif (GMT_CONFIG) |
||||||
|
endif (UNIX AND NOT GMT_FOUND) |
||||||
|
|
||||||
|
find_path (GMT_INCLUDE_DIR gmt.h |
||||||
|
HINTS |
||||||
|
${_GMT_includepath} |
||||||
|
${GMT_DIR} |
||||||
|
${GMT_ROOT} |
||||||
|
$ENV{GMT_DIR} |
||||||
|
$ENV{GMT_ROOT} |
||||||
|
PATH_SUFFIXES |
||||||
|
include/GMT |
||||||
|
include/GMT |
||||||
|
include |
||||||
|
PATHS |
||||||
|
~/Library/Frameworks/GMT.framework/Headers |
||||||
|
/Library/Frameworks/GMT.framework/Headers |
||||||
|
/sw # Fink |
||||||
|
/opt/local # DarwinPorts |
||||||
|
/opt/csw # Blastwave |
||||||
|
/opt/gmt |
||||||
|
/opt/GMT |
||||||
|
/opt |
||||||
|
/usr/local |
||||||
|
) |
||||||
|
|
||||||
|
find_library (GMT_LIBRARY |
||||||
|
NAMES ${_GMT_lib} gmt gmt5.1 gmt5.1.2 gmt5.1.3 |
||||||
|
HINTS |
||||||
|
${GMT_DIR} |
||||||
|
${GMT_ROOT} |
||||||
|
$ENV{GMT_DIR} |
||||||
|
$ENV{GMT_ROOT} |
||||||
|
${_GMT_libpath} |
||||||
|
PATH_SUFFIXES lib |
||||||
|
PATHS |
||||||
|
~/Library/Frameworks/GMT.framework |
||||||
|
/Library/Frameworks/GMT.framework |
||||||
|
/sw # Fink |
||||||
|
/opt/local # DarwinPorts |
||||||
|
/opt/csw # Blastwave |
||||||
|
/opt/gmt |
||||||
|
/opt/GMT |
||||||
|
/opt |
||||||
|
/usr/local |
||||||
|
) |
||||||
|
|
||||||
|
include (FindPackageHandleStandardArgs) |
||||||
|
find_package_handle_standard_args (GMT DEFAULT_MSG GMT_LIBRARY GMT_INCLUDE_DIR) |
||||||
|
|
||||||
|
set (GMT_LIBRARIES ${GMT_LIBRARY}) |
||||||
|
set (GMT_INCLUDE_DIRS ${GMT_INCLUDE_DIR}) |
||||||
|
|
@ -0,0 +1,3 @@ |
|||||||
|
cmake_minimum_required(VERSION 2.8.5) |
||||||
|
|
||||||
|
include(BuildModule) |
@ -0,0 +1,9 @@ |
|||||||
|
find_package(FLEX REQUIRED) |
||||||
|
FLEX_TARGET(GMT_hfScanner ${moddir}/gmt_filter_headfoot.l ${CMAKE_CURRENT_BINARY_DIR}/gmt_filter_headfoot.cpp COMPILE_FLAGS "--header-file=${CMAKE_CURRENT_BINARY_DIR}/gmt_filter_headfoot.h") |
||||||
|
set_property(DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES gmt_filter_headfoot.h) |
||||||
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}) |
||||||
|
|
||||||
|
find_package(GMT REQUIRED) |
||||||
|
set(MODULE_ADDITIONAL_SOURCES ${FLEX_GMT_hfScanner_OUTPUTS}) |
||||||
|
set(MODULE_ADDITIONAL_INCLUDES ${GMT_INCLUDE_DIR}) |
||||||
|
set(MODULE_ADDITIONAL_LIBRARIES ${GMT_LIBRARIES}) |
Loading…
Reference in new issue