set(PROJ_PREFIX "" CACHE PATH "The path to the prefix of an Proj installation") find_path(PROJ_INCLUDE_DIR NAMES proj.h proj_api.h PATHS ${PROJ_PREFIX}/include /opt/local/include /usr/include /usr/local/include ) find_library(PROJ_LIBRARIES NAMES proj PATHS ${PROJ_PREFIX}/lib /opt/local/lib /usr/lib /usr/local/lib ) if(PROJ_INCLUDE_DIR AND PROJ_LIBRARIES AND NOT TARGET PROJ) get_filename_component(PROJ_LIBRARY_DIR ${PROJ_LIBRARIES} PATH) set(PROJ_FOUND TRUE) add_library(Proj::Proj INTERFACE IMPORTED) set_target_properties(Proj::Proj PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PROJ_INCLUDE_DIR}" INTERFACE_LINK_LIBRARIES "${PROJ_LIBRARIES}" ) endif() if(PROJ_FOUND) if(NOT PROJ_FIND_QUIETLY) MESSAGE(STATUS "Found Proj: ${PROJ_LIBRARIES}") endif() set(HAVE_PROJ 1) elseif(PROJ_FOUND) if(PROJ_FIND_REQUIRED) message(FATAL_ERROR "Could not find Proj") endif() endif()