find/FindGeos.cmake

76 lines
1.8 KiB
CMake
Raw Normal View History

2023-05-24 10:57:52 +00:00
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
)
2023-05-24 14:44:26 +00:00
find_library(GEOS_LIBRARIES NAMES geos_c
2023-05-24 10:57:52 +00:00
PATHS
${GEOS_PREFIX}/lib
2023-05-24 14:44:26 +00:00
/opt/local/lib
2023-05-24 10:57:52 +00:00
/usr/lib
2023-05-24 14:44:26 +00:00
/usr/local/lib
)
find_path(GEOSPP_INCLUDE_DIR NAMES geos/constants.h
PATHS
${GEOS_PREFIX}/include
/opt/local/include
/usr/include
2023-05-24 10:57:52 +00:00
/usr/local/include
)
2023-05-24 14:44:26 +00:00
find_library(GEOSPP_LIBRARIES NAMES geos
PATHS
${GEOS_PREFIX}/lib
/opt/local/lib
/usr/lib
/usr/local/lib
)
2023-05-24 10:57:52 +00:00
if(GEOS_INCLUDE_DIR AND GEOS_LIBRARIES AND NOT TARGET GEOS)
get_filename_component(GEOS_LIBRARY_DIR ${GEOS_LIBRARIES} PATH)
set(GEOS_FOUND TRUE)
2023-08-10 08:03:15 +00:00
add_library(Geos::Geos INTERFACE IMPORTED)
set_target_properties(Geos::Geos PROPERTIES
2023-05-24 10:57:52 +00:00
INTERFACE_INCLUDE_DIRECTORIES "${GEOS_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${GEOS_LIBRARIES}"
)
endif()
2023-05-24 14:44:26 +00:00
if(GEOSPP_INCLUDE_DIR AND GEOSPP_LIBRARIES AND NOT TARGET GEOSPP)
get_filename_component(GEOSPP_LIBRARY_DIR ${GEOSPP_LIBRARIES} PATH)
set(GEOSPP_FOUND TRUE)
2023-08-10 08:03:15 +00:00
add_library(Geos::GeosPP INTERFACE IMPORTED)
set_target_properties(Geos::GeosPP PROPERTIES
2023-05-24 14:44:26 +00:00
INTERFACE_INCLUDE_DIRECTORIES "${GEOSPP_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${GEOSPP_LIBRARIES}"
)
endif()
2023-05-24 10:57:52 +00:00
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()
2023-05-24 14:44:26 +00:00
if(GEOSPP_FOUND)
if(NOT GEOSP_FIND_QUIETLY)
MESSAGE(STATUS "Found Geos++: ${GEOSPP_LIBRARIES}")
endif()
set(HAVE_GEOSPP 1)
elseif(GEOSPP_FOUND)
if(GEOSPP_FIND_REQUIRED)
message(FATAL_ERROR "Could not find Geos++")
endif()
endif()