This commit is contained in:
Andrei Astafev 2023-05-24 13:57:52 +03:00
parent 2eefa49c6e
commit e4adfb90d9

38
FindGEOS.cmake Normal file
View File

@ -0,0 +1,38 @@
set(GEOS_PREFIX "" CACHE PATH "The path to the prefix of an Geos installation")
find_path(GEOS_INCLUDE_DIR NAMES geos_c.h
PATHS
${GEOS_PREFIX}/include
/opt/local/include
/usr/include
/usr/local/include
)
find_library(GEOS_LIBRARIES NAMES geos geos_c
PATHS
${GEOS_PREFIX}/lib
/opt/local/include
/usr/lib
/usr/local/include
)
if(GEOS_INCLUDE_DIR AND GEOS_LIBRARIES AND NOT TARGET GEOS)
get_filename_component(GEOS_LIBRARY_DIR ${GEOS_LIBRARIES} PATH)
set(GEOS_FOUND TRUE)
add_library(GEOS::Geos INTERFACE IMPORTED)
set_target_properties(GEOS::Geos PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${GEOS_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${GEOS_LIBRARIES}"
)
endif()
if(GEOS_FOUND)
if(NOT GEOS_FIND_QUIETLY)
MESSAGE(STATUS "Found Geos: ${GEOS_LIBRARIES}")
endif()
set(HAVE_GEOS 1)
elseif(GEOS_FOUND)
if(GEOS_FIND_REQUIRED)
message(FATAL_ERROR "Could not find Geos")
endif()
endif()