forked from planetfederal/QGIS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFindProj.cmake
66 lines (55 loc) · 2.08 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Find Proj
# ~~~~~~~~~
# Copyright (c) 2007, Martin Dobias <wonder.sk at gmail.com>
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
# CMake module to search for Proj library
#
# If it's found it sets PROJ_FOUND to TRUE
# and following variables are set:
# PROJ_INCLUDE_DIR
# PROJ_LIBRARY
# FIND_PATH and FIND_LIBRARY normally search standard locations
# before the specified paths. To search non-standard paths first,
# FIND_* is invoked first with specified paths and NO_DEFAULT_PATH
# and then again with no specified paths to search the default
# locations. When an earlier FIND_* succeeds, subsequent FIND_*s
# searching for the same item do nothing.
# try to use framework on mac
# want clean framework path, not unix compatibility path
IF (APPLE)
IF (CMAKE_FIND_FRAMEWORK MATCHES "FIRST"
OR CMAKE_FRAMEWORK_PATH MATCHES "ONLY"
OR NOT CMAKE_FIND_FRAMEWORK)
SET (CMAKE_FIND_FRAMEWORK_save ${CMAKE_FIND_FRAMEWORK} CACHE STRING "" FORCE)
SET (CMAKE_FIND_FRAMEWORK "ONLY" CACHE STRING "" FORCE)
#FIND_PATH(PROJ_INCLUDE_DIR PROJ/proj_api.h)
FIND_LIBRARY(PROJ_LIBRARY PROJ)
IF (PROJ_LIBRARY)
# FIND_PATH doesn't add "Headers" for a framework
SET (PROJ_INCLUDE_DIR ${PROJ_LIBRARY}/Headers CACHE PATH "Path to a file.")
ENDIF (PROJ_LIBRARY)
SET (CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_save} CACHE STRING "" FORCE)
ENDIF ()
ENDIF (APPLE)
FIND_PATH(PROJ_INCLUDE_DIR proj_api.h
"$ENV{INCLUDE}"
"$ENV{LIB_DIR}/include"
)
FIND_LIBRARY(PROJ_LIBRARY NAMES proj proj_i PATHS
"$ENV{LIB}"
"$ENV{LIB_DIR}/lib"
)
IF (PROJ_INCLUDE_DIR AND PROJ_LIBRARY)
SET(PROJ_FOUND TRUE)
ENDIF (PROJ_INCLUDE_DIR AND PROJ_LIBRARY)
IF (PROJ_FOUND)
IF (NOT PROJ_FIND_QUIETLY)
MESSAGE(STATUS "Found Proj: ${PROJ_LIBRARY}")
ENDIF (NOT PROJ_FIND_QUIETLY)
ELSE (PROJ_FOUND)
IF (PROJ_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find Proj")
ENDIF (PROJ_FIND_REQUIRED)
ENDIF (PROJ_FOUND)