76 lines
1.8 KiB
CMake
76 lines
1.8 KiB
CMake
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_c
|
|
PATHS
|
|
${GEOS_PREFIX}/lib
|
|
/opt/local/lib
|
|
/usr/lib
|
|
/usr/local/lib
|
|
)
|
|
|
|
find_path(GEOSPP_INCLUDE_DIR NAMES geos/constants.h
|
|
PATHS
|
|
${GEOS_PREFIX}/include
|
|
/opt/local/include
|
|
/usr/include
|
|
/usr/local/include
|
|
)
|
|
|
|
find_library(GEOSPP_LIBRARIES NAMES geos
|
|
PATHS
|
|
${GEOS_PREFIX}/lib
|
|
/opt/local/lib
|
|
/usr/lib
|
|
/usr/local/lib
|
|
)
|
|
|
|
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(GEOSPP_INCLUDE_DIR AND GEOSPP_LIBRARIES AND NOT TARGET GEOSPP)
|
|
get_filename_component(GEOSPP_LIBRARY_DIR ${GEOSPP_LIBRARIES} PATH)
|
|
set(GEOSPP_FOUND TRUE)
|
|
add_library(Geos::GeosPP INTERFACE IMPORTED)
|
|
set_target_properties(Geos::GeosPP PROPERTIES
|
|
INTERFACE_INCLUDE_DIRECTORIES "${GEOSPP_INCLUDE_DIR}"
|
|
INTERFACE_LINK_LIBRARIES "${GEOSPP_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()
|
|
|
|
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()
|