1 # Distributed under the OSI-approved BSD 3-Clause License. See accompanying 2 # file Copyright.txt or https://cmake.org/licensing for details. 4 #[=======================================================================[.rst: 13 This module defines :prop_tgt:`IMPORTED`
target ``GDAL::GDAL``
14 if GDAL has been found.
19 This module will
set the following variables in your project:
22 True
if GDAL is found.
24 Include directories
for GDAL headers.
26 Libraries to link to GDAL.
33 The following cache variables may also be
set:
36 The libgdal library file.
38 The directory containing ``gdal.h``.
43 Set ``GDAL_DIR`` or ``GDAL_ROOT`` in the environment to specify the
44 GDAL installation prefix.
45 #]=======================================================================]
47 # $GDALDIR is an environment variable that would 48 # correspond to the ./configure --prefix=$GDAL_DIR 49 # used in building gdal. 51 # Created by Eric Wing. I'm not a gdal user, but OpenSceneGraph uses it 52 # for osgTerrain so I whipped this module together for completeness. 53 # I actually don't know the conventions or where files are typically 55 # Any real gdal users are encouraged to correct this (but please don't 56 # break the OS X framework stuff when doing so which is what usually seems 59 # This makes the presumption that you are include gdal.h like 63 find_path(GDAL_INCLUDE_DIR gdal.h
72 DOC
"Path to the GDAL include directory" 74 mark_as_advanced(GDAL_INCLUDE_DIR)
76 # GDAL name its library when built with CMake as `gdal${major}${minor}`. 78 3.0 2.4 2.3 2.2 2.1 2.0 1.11 1.10 1.9 1.8 1.7 1.6 1.5 1.4 1.3 1.2)
81 foreach (_gdal_version IN LISTS _gdal_versions)
82 string(REPLACE
"." "" _gdal_version
"${_gdal_version}")
83 list(APPEND _gdal_libnames
"gdal${_gdal_version}" "GDAL${_gdal_version}")
86 find_library(GDAL_LIBRARY
87 NAMES ${_gdal_libnames} gdal gdal_i gdal1.5.0 gdal1.4.0 gdal1.3.2 GDAL
92 DOC
"Path to the GDAL library" 94 mark_as_advanced(GDAL_LIBRARY)
96 if (EXISTS
"${GDAL_INCLUDE_DIR}/gdal_version.h")
97 file(STRINGS
"${GDAL_INCLUDE_DIR}/gdal_version.h" _gdal_version
98 REGEX
"GDAL_RELEASE_NAME")
99 string(REGEX REPLACE
".*\"\(.*\)\"" "\\1" GDAL_VERSION
"${_gdal_version}")
102 set(GDAL_VERSION GDAL_VERSION-NOTFOUND)
105 include(FindPackageHandleStandardArgs)
106 find_package_handle_standard_args(GDAL
107 VERSION_VAR GDAL_VERSION
108 REQUIRED_VARS GDAL_LIBRARY GDAL_INCLUDE_DIR)
111 set(GDAL_LIBRARIES ${GDAL_LIBRARY})
112 set(GDAL_INCLUDE_DIRS ${GDAL_INCLUDE_DIR})
114 if (NOT TARGET GDAL::GDAL)
115 add_library(GDAL::GDAL UNKNOWN IMPORTED)
116 set_target_properties(GDAL::GDAL PROPERTIES
117 IMPORTED_LOCATION
"${GDAL_LIBRARY}" 118 INTERFACE_INCLUDE_DIRECTORIES
"${GDAL_INCLUDE_DIR}")
boost::graph_traits< vtkGraph *>::vertex_descriptor target(boost::graph_traits< vtkGraph *>::edge_descriptor e, vtkGraph *)