tFindPROJ.cmake - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch)
 (HTM) git clone git://src.adamsgaard.dk/pism
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
       tFindPROJ.cmake (1473B)
       ---
            1 # - Find PROJ
            2 # Find the native PROJ includes and library
            3 #
            4 #  PROJ_INCLUDES    - where to find proj.h
            5 #  PROJ_LIBRARIES   - List of libraries when using PROJ.
            6 #  PROJ_FOUND       - True if PROJ found.
            7 
            8 if (PROJ_INCLUDES)
            9   # Already in cache, be silent
           10   set (PROJ_FIND_QUIETLY TRUE)
           11 endif (PROJ_INCLUDES)
           12 
           13 find_path (PROJ_INCLUDES proj.h
           14   HINTS
           15   "${PROJ_ROOT}/include"
           16   "$ENV{PROJ_ROOT}/include"
           17   "/opt/local/lib/proj5/include"
           18   "/opt/local/lib/proj6/include")
           19 
           20 if (PROJ_INCLUDES)
           21   string(REGEX REPLACE "/include/?$" "/lib"
           22     PROJ_LIB_HINT ${PROJ_INCLUDES})
           23 endif()
           24 
           25 find_library (PROJ_LIBRARIES
           26   NAMES proj
           27   HINTS ${PROJ_LIB_HINT})
           28 
           29 if ((NOT PROJ_LIBRARIES) OR (NOT PROJ_INCLUDES))
           30   message(STATUS "Trying to find PROJ using LD_LIBRARY_PATH (we're desperate)...")
           31 
           32   file(TO_CMAKE_PATH "$ENV{LD_LIBRARY_PATH}" LD_LIBRARY_PATH)
           33 
           34   find_library(PROJ_LIBRARIES
           35     NAMES proj
           36     HINTS ${LD_LIBRARY_PATH})
           37 
           38   if (PROJ_LIBRARIES)
           39     get_filename_component(PROJ_LIB_DIR ${PROJ_LIBRARIES} PATH)
           40     string(REGEX REPLACE "/lib/?$" "/include"
           41       PROJ_H_HINT ${PROJ_LIB_DIR})
           42 
           43     find_path (PROJ_INCLUDES proj.h
           44       HINTS ${PROJ_H_HINT}
           45       DOC "Path to proj.h")
           46   endif()
           47 endif()
           48 
           49 # handle the QUIETLY and REQUIRED arguments and set PROJ_FOUND to TRUE if
           50 # all listed variables are TRUE
           51 include (FindPackageHandleStandardArgs)
           52 find_package_handle_standard_args (PROJ DEFAULT_MSG PROJ_LIBRARIES PROJ_INCLUDES)
           53 
           54 mark_as_advanced (PROJ_LIBRARIES PROJ_INCLUDES)