You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
115 lines
2.8 KiB
115 lines
2.8 KiB
9 years ago
|
# 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})
|
||
|
|