Skip to content
Permalink
Browse files

Merge pull request #4090 from dakcarto/find-qgis-cmake

FindQGIS.cmake updates
  • Loading branch information
dakcarto committed Feb 20, 2017
2 parents 3dcb0c4 + c4970aa commit 64819bcf6de6fff28ec2f81d0c15cd0407b08c64
Showing with 59 additions and 12 deletions.
  1. +59 −12 cmake/FindQGIS.cmake
@@ -7,11 +7,30 @@
## QGIS_ANALYSIS_LIBRARY = full path to the ANALYSIS library
## QGIS_PLUGIN_DIR = full path to where QGIS plugins are installed
## QGIS_INCLUDE_DIR = where to find headers
## QGIS_UI_INCLUDE_DIR = where to find ui_* generated headers
##
## Definitions or ENV variables affecting search locations
##
## OSGEO4W_ROOT = [A-Z]:/path/to/OSGeo4W/install/root
## (^ use forward slashes!)
## OSGEO4W_QGIS_SUBDIR = qgis[-rel|-ltr][-dev], in OSGEO4W_ROOT/apps/
## QGIS_MAC_PATH = /path/to/any/QGIS.app/Contents
## QGIS_BUILD_PATH = [A-Z:]/path/to/QGIS/build/directory
##
## Tim Sutton
## Larry Shaffer (2017-01-31)

#MESSAGE("Searching for QGIS")
IF(WIN32)
# OSGEO4W_QGIS_SUBDIR relative install: qgis[-rel|-ltr][-dev], etc.
IF (NOT OSGEO4W_QGIS_SUBDIR OR "${OSGEO4W_QGIS_SUBDIR}" STREQUAL "")
IF (NOT "$ENV{OSGEO4W_QGIS_SUBDIR}" STREQUAL "")
SET (OSGEO4W_QGIS_SUBDIR $ENV{OSGEO4W_QGIS_SUBDIR})
ELSE ()
SET (OSGEO4W_QGIS_SUBDIR qgis)
ENDIF ()
ENDIF ()

#MESSAGE("Searching for QGIS in $ENV{PROGRAMFILES}/QGIS")
IF (MINGW)
FIND_PATH(QGIS_PLUGIN_DIR
@@ -40,7 +59,7 @@ IF(WIN32)
FIND_PATH(QGIS_PLUGIN_DIR
NAMES spatialqueryplugin.dll
PATHS
"$ENV{OSGEO4W_ROOT}/apps/qgis/plugins"
"$ENV{OSGEO4W_ROOT}/apps/${OSGEO4W_QGIS_SUBDIR}/plugins"
"$ENV{PROGRAMFILES}/QGIS/plugins"
)
FIND_PATH(QGIS_INCLUDE_DIR
@@ -49,6 +68,7 @@ IF(WIN32)
"$ENV{INCLUDE}"
"$ENV{LIB_DIR}/include/qgis"
"$ENV{OSGEO4W_ROOT}/include"
"$ENV{OSGEO4W_ROOT}/apps/${OSGEO4W_QGIS_SUBDIR}/include"
"$ENV{PROGRAMFILES}/QGIS/include"
)
FIND_LIBRARY(QGIS_CORE_LIBRARY
@@ -57,6 +77,7 @@ IF(WIN32)
"$ENV{LIB_DIR}/lib/"
"$ENV{LIB}"
"$ENV{OSGEO4W_ROOT}/lib"
"$ENV{OSGEO4W_ROOT}/apps/${OSGEO4W_QGIS_SUBDIR}/lib"
"$ENV{PROGRAMFILES}/QGIS/lib"
)
FIND_LIBRARY(QGIS_GUI_LIBRARY
@@ -65,6 +86,7 @@ IF(WIN32)
"$ENV{LIB_DIR}"
"$ENV{LIB}"
"$ENV{OSGEO4W_ROOT}/lib"
"$ENV{OSGEO4W_ROOT}/apps/${OSGEO4W_QGIS_SUBDIR}/lib"
"$ENV{PROGRAMFILES}/QGIS/lib"
)
FIND_LIBRARY(QGIS_ANALYSIS_LIBRARY
@@ -73,86 +95,111 @@ IF(WIN32)
"$ENV{LIB_DIR}"
"$ENV{LIB}"
"$ENV{OSGEO4W_ROOT}/lib"
"$ENV{OSGEO4W_ROOT}/apps/${OSGEO4W_QGIS_SUBDIR}/lib"
"$ENV{PROGRAMFILES}/QGIS/lib"
)
ENDIF (MSVC)
ELSE(WIN32)
IF(UNIX)
# try to use bundle on mac
SET (QGIS_MAC_PATH /Applications/QGIS.app/Contents)
#MESSAGE("Searching for QGIS in /usr/bin; /usr/local/bin")
FIND_PATH(QGIS_PLUGIN_DIR
NAMES libspatialqueryplugin.so
PATHS
${QGIS_BUILD_PATH}/PlugIns/qgis
${QGIS_MAC_PATH}/PlugIns/qgis
${QGIS_PREFIX_PATH}/lib/qgis/plugins/
/usr/lib64/qgis/plugins
/usr/lib/qgis
/usr/lib/qgis/plugins
/usr/local/lib/qgis/plugins
${QGIS_MAC_PATH}/PlugIns/qgis
"$ENV{LIB_DIR}/lib/qgis/plugins"
"$ENV{LIB_DIR}/lib/qgis"
)
FIND_PATH(QGIS_INCLUDE_DIR
NAMES qgis.h
PATHS
${QGIS_BUILD_PATH}/output/lib/qgis_core.framework/Headers
${QGIS_MAC_PATH}/Frameworks/qgis_core.framework/Headers
{QGIS_PREFIX_PATH}/include/qgis
/usr/include/qgis
/usr/local/include/qgis
/Library/Frameworks/qgis_core.framework/Headers
${QGIS_MAC_PATH}/Frameworks/qgis_core.framework/Headers
"$ENV{LIB_DIR}/include/qgis"
)
FIND_PATH(QGIS_UI_INCLUDE_DIR
NAMES ui_qgscredentialdialog.h
PATHS
${QGIS_BUILD_PATH}/src/ui
${QGIS_MAC_PATH}/Frameworks/qgis_gui.framework/Headers
{QGIS_PREFIX_PATH}/include/qgis
/usr/include/qgis
/usr/local/include/qgis
/Library/Frameworks/qgis_gui.framework/Headers
"$ENV{LIB_DIR}/include/qgis"
)
# also get other frameworks' headers folders on OS X
IF (APPLE)
FIND_PATH(QGIS_GUI_INCLUDE_DIR
NAMES qgisgui.h
PATHS
/Library/Frameworks/qgis_core.framework/Headers
${QGIS_MAC_PATH}/Frameworks/qgis_gui.framework/Headers
${QGIS_BUILD_PATH}/output/lib
${QGIS_MAC_PATH}/Frameworks
/Library/Frameworks
PATH_SUFFIXES qgis_gui.framework/Headers
)
FIND_PATH(QGIS_ANALYSIS_INCLUDE_DIR
NAMES qgsinterpolator.h
PATHS
/Library/Frameworks/qgis_analysis.framework/Headers
${QGIS_MAC_PATH}/Frameworks/qgis_analysis.framework/Headers
${QGIS_BUILD_PATH}/output/lib
${QGIS_MAC_PATH}/Frameworks
/Library/Frameworks
PATH_SUFFIXES qgis_analysis.framework/Headers
)
SET(QGIS_INCLUDE_DIR
${QGIS_INCLUDE_DIR}
${QGIS_GUI_INCLUDE_DIR}
${QGIS_ANALYSIS_INCLUDE_DIR}
${QGIS_UI_INCLUDE_DIR}
)
ENDIF (APPLE)

FIND_LIBRARY(QGIS_CORE_LIBRARY
NAMES qgis_core
PATHS
${QGIS_BUILD_PATH}/output/lib
${QGIS_MAC_PATH}/Frameworks
${QGIS_MAC_PATH}/lib
${QGIS_PREFIX_PATH}/lib/
/usr/lib64
/usr/lib
/usr/local/lib
/Library/Frameworks
${QGIS_MAC_PATH}/Frameworks
"$ENV{LIB_DIR}/lib/"
)
FIND_LIBRARY(QGIS_GUI_LIBRARY
NAMES qgis_gui
PATHS
${QGIS_BUILD_PATH}/output/lib
${QGIS_MAC_PATH}/Frameworks
${QGIS_MAC_PATH}/lib
${QGIS_PREFIX_PATH}/lib/
/usr/lib64
/usr/lib
/usr/local/lib
/Library/Frameworks
${QGIS_MAC_PATH}/Frameworks
"$ENV{LIB_DIR}/lib/"
)
FIND_LIBRARY(QGIS_ANALYSIS_LIBRARY
NAMES qgis_analysis
PATHS
${QGIS_BUILD_PATH}/output/lib
${QGIS_MAC_PATH}/Frameworks
${QGIS_MAC_PATH}/lib
${QGIS_PREFIX_PATH}/lib/
/usr/lib64
/usr/lib
/usr/local/lib
/Library/Frameworks
${QGIS_MAC_PATH}/Frameworks
"$ENV{LIB_DIR}/lib/"
)
ENDIF(UNIX)

0 comments on commit 64819bc

Please sign in to comment.
You can’t perform that action at this time.