-
Notifications
You must be signed in to change notification settings - Fork 83
/
FindPROJ.cmake
48 lines (41 loc) · 1.6 KB
/
FindPROJ.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#
# Find module for PROJ
#
# The following variables will guide the find:
# PROJ_ROOT - Set to the install prefix of the PROJ library.
# PROJ_DIR - Find the package based on this path to the package's
# CMake configuration file. This supersedes the use of
# PROJ_ROOT.
#
# The following variables will be set:
# PROJ_FOUND - Set to TRUE if PROJ could be found.
# PROJ_INCLUDE_DIR - Path to the PROJ header files directory
# PROJ_LIBRARY - The full path to the PROJ library.
#
if(PROJ_DIR)
find_package(PROJ NO_MODULE)
elseif(NOT PROJ_FOUND)
include(CommonFindMacros)
setup_find_root_context(PROJ)
find_path(PROJ_INCLUDE_DIR "proj.h"
${PROJ_FIND_OPTS}
DOC "Path to the root directory containing the PROJ header file."
)
# If the header file was found, use that path as a introspective hint for finding the library
if(PROJ_INCLUDE_DIR AND (IS_DIRECTORY "${PROJ_INCLUDE_DIR}"))
#message("Introspecting library dir from include dir: '${PROJ_INCLUDE_DIR}'")
get_filename_component(proj_lib_dir "${PROJ_INCLUDE_DIR}/../lib" ABSOLUTE)
#message("Introspected library dir: '${proj_lib_dir}'")
set(_PROJ_LIB_PATH_HINT HINTS "${proj_lib_dir}" "${proj_lib_dir}64" NO_CMAKE_SYSTEM_PATH)
endif()
find_library(PROJ_LIBRARY NAMES proj proj_6_3 proj_6_3_d
${_PROJ_LIB_PATH_HINT}
${PROJ_FIND_OPTS}
DOC "Path to the PROJ library."
)
restore_find_root_context(PROJ)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PROJ DEFAULT_MSG
PROJ_INCLUDE_DIR PROJ_LIBRARY
)
endif()