Skip to content
Permalink
Browse files

- CMake: improved search for GRASS

- removed Makefiles commited by mistake some time ago


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6419 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder
wonder committed Jan 9, 2007
1 parent 7b63c56 commit 6e4604107051b043353e8205bf19c76a4cf68509
Showing with 58 additions and 853 deletions.
  1. +58 −25 cmake/FindGRASS.cmake
  2. +0 −414 resources/context_help/Makefile
  3. +0 −414 resources/context_help/Makefile.in
@@ -1,37 +1,66 @@

# macro that checks for grass installation in specified directory

SET(GRASS_PREFIX "/usr" CACHE PATH "Path to GRASS base directory")

MACRO (CHECK_GRASS G_PREFIX)

FIND_PATH(GRASS_INCLUDE_DIR grass/gis.h ${GRASS_PREFIX}/include)
FIND_PATH (GRASS_INCLUDE_DIR grass/gis.h ${G_PREFIX}/include)

SET (GRASS_LIB_NAMES gis vect dig2 dbmiclient dbmibase shape dgl rtree datetime linkm form gproj)
SET (GRASS_LIB_NAMES gis vect dig2 dbmiclient dbmibase shape dgl rtree datetime linkm form gproj)

SET (GRASS_LIBRARIES "")
SET (GRASS_LIBRARIES "")

FOREACH (LIB ${GRASS_LIB_NAMES})
SET(LIB_PATH NOTFOUND)
FIND_LIBRARY(LIB_PATH grass_${LIB} PATHS ${GRASS_PREFIX}/lib)
FOREACH (LIB ${GRASS_LIB_NAMES})
SET(LIB_PATH NOTFOUND)
FIND_LIBRARY(LIB_PATH grass_${LIB} PATHS ${G_PREFIX}/lib)

IF (LIB_PATH)
IF (NOT GRASS_LIBRARIES STREQUAL NOTFOUND)
SET (GRASS_LIBRARIES ${GRASS_LIBRARIES} ${LIB_PATH})
ENDIF (NOT GRASS_LIBRARIES STREQUAL NOTFOUND)
ELSE (LIB_PATH)
SET (GRASS_LIBRARIES NOTFOUND)
ENDIF (LIB_PATH)
IF (LIB_PATH)
IF (NOT GRASS_LIBRARIES STREQUAL NOTFOUND)
SET (GRASS_LIBRARIES ${GRASS_LIBRARIES} ${LIB_PATH})
ENDIF (NOT GRASS_LIBRARIES STREQUAL NOTFOUND)
ELSE (LIB_PATH)
SET (GRASS_LIBRARIES NOTFOUND)
ENDIF (LIB_PATH)

ENDFOREACH (LIB)
ENDFOREACH (LIB)

IF (GRASS_INCLUDE_DIR AND GRASS_LIBRARIES)
SET(GRASS_FOUND TRUE)
ENDIF (GRASS_INCLUDE_DIR AND GRASS_LIBRARIES)
IF (GRASS_INCLUDE_DIR AND GRASS_LIBRARIES)
SET (GRASS_FOUND TRUE)
SET (GRASS_PREFIX ${G_PREFIX})
ENDIF (GRASS_INCLUDE_DIR AND GRASS_LIBRARIES)

ENDMACRO (CHECK_GRASS)

###################################
# search for grass installations

# try to build with GRASS by default
SET (WITH_GRASS "ON" CACHE BOOL "Determines whether GRASS plugin should be built")

SET (GRASS_PREFIX "" CACHE PATH "Path to GRASS base directory")

# list of paths which to search - user's choice as first
SET (GRASS_PATHS ${GRASS_PREFIX} /usr/lib/grass)

IF (WITH_GRASS)

FOREACH (G_PREFIX ${GRASS_PATHS})
IF (NOT GRASS_FOUND)
CHECK_GRASS(${G_PREFIX})
ENDIF (NOT GRASS_FOUND)
ENDFOREACH (G_PREFIX)

ENDIF (WITH_GRASS)

###################################

IF (GRASS_FOUND)

# read grass version number and remove trailing newline
FILE (READ ${GRASS_PREFIX}/etc/VERSIONNUMBER GRASS_VERSION)
STRING(REPLACE "\n" "" GRASS_VERSION ${GRASS_VERSION})

IF (NOT GRASS_FIND_QUIETLY)
MESSAGE(STATUS "Found GRASS: ${GRASS_PREFIX}")
MESSAGE(STATUS "Found GRASS: ${GRASS_PREFIX} (${GRASS_VERSION})")
ENDIF (NOT GRASS_FIND_QUIETLY)

# openpty is currently needed for GRASS shell
@@ -48,10 +77,14 @@ IF (GRASS_FOUND)

ELSE (GRASS_FOUND)

IF (GRASS_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find GRASS")
ELSE (GRASS_FIND_REQUIRED)
MESSAGE(STATUS "Could not find GRASS")
ENDIF (GRASS_FIND_REQUIRED)
IF (WITH_GRASS)

IF (GRASS_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find GRASS")
ELSE (GRASS_FIND_REQUIRED)
MESSAGE(STATUS "Could not find GRASS")
ENDIF (GRASS_FIND_REQUIRED)

ENDIF (WITH_GRASS)

ENDIF (GRASS_FOUND)

0 comments on commit 6e46041

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