File: FindGEOS.cmake

package info (click to toggle)
gdal 3.11.3%2Bdfsg-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 89,016 kB
  • sloc: cpp: 1,165,048; ansic: 208,864; python: 26,958; java: 5,972; xml: 4,611; sh: 3,776; cs: 2,508; yacc: 1,306; makefile: 213
file content (49 lines) | stat: -rw-r--r-- 1,681 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

#.rst:
# FindGEOS
# -----------
#
# CMake module to search for GEOS library
#
# Copyright (C) 2017-2018, Hiroshi Miura
# Copyright (c) 2008, Mateusz Loskot <mateusz@loskot.net>
# (based on FindGDAL.cmake by Magnus Homann)
#
# If it's found it sets GEOS_FOUND to TRUE
# and following variables are set:
#    GEOS_INCLUDE_DIR
#    GEOS_LIBRARY
#

find_program(GEOS_CONFIG geos-config)
if(GEOS_CONFIG)
    execute_process(COMMAND "${GEOS_CONFIG}" --version OUTPUT_VARIABLE GEOS_VERSION)
    execute_process(COMMAND "${GEOS_CONFIG}" --prefix OUTPUT_VARIABLE GEOS_PREFIX)
endif()

find_path(GEOS_INCLUDE_DIR NAMES geos_c.h
          HINTS ${GEOS_PREFIX}/include)
find_library(GEOS_LIBRARY NAMES geos_c
             HINTS ${GEOS_PREFIX}/lib)
mark_as_advanced(GEOS_INCLUDE_DIR GEOS_LIBRARY)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GEOS FOUND_VAR GEOS_FOUND
                                  REQUIRED_VARS GEOS_LIBRARY GEOS_INCLUDE_DIR
                                  VERSION_VAR GEOS_VERSION)

if(GEOS_FOUND)
    set(GEOS_LIBRARIES ${GEOS_LIBRARY})
    set(GEOS_INCLUDE_DIRS ${GEOS_INCLUDE_DIR})
    set(GEOS_TARGET GEOS::GEOS)

    if(NOT TARGET ${GEOS_TARGET})
        add_library(${GEOS_TARGET} UNKNOWN IMPORTED)
        set_target_properties(${GEOS_TARGET} PROPERTIES
                              INTERFACE_INCLUDE_DIRECTORIES "${GEOS_INCLUDE_DIR}"
                              IMPORTED_LINK_INTERFACE_LANGUAGES "C"
                              IMPORTED_LOCATION "${GEOS_LIBRARY}")
    endif()
endif()