* don't include unistd on windows in browser
* avoid warning when grass/version.h is not found at once
This commit is contained in:
Juergen E. Fischer 2014-04-18 16:20:18 +02:00
parent 66be0051f0
commit 018086e928
2 changed files with 40 additions and 39 deletions

View File

@ -10,52 +10,52 @@ MACRO (CHECK_GRASS G_PREFIX)
FIND_PATH (GRASS_INCLUDE_DIR grass/version.h ${G_PREFIX}/include)
FILE(READ ${GRASS_INCLUDE_DIR}/grass/version.h VERSIONFILE)
# We can avoid the following block using version_less version_equal and
# version_greater. Are there compatibility problems?
STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[^ ]+" GRASS_VERSION ${VERSIONFILE})
STRING(REGEX REPLACE "^([0-9]*)\\.[0-9]*\\..*$" "\\1" GRASS_MAJOR_VERSION ${GRASS_VERSION})
STRING(REGEX REPLACE "^[0-9]*\\.([0-9]*)\\..*$" "\\1" GRASS_MINOR_VERSION ${GRASS_VERSION})
STRING(REGEX REPLACE "^[0-9]*\\.[0-9]*\\.(.*)$" "\\1" GRASS_MICRO_VERSION ${GRASS_VERSION})
# Add micro version too?
# How to numerize RC versions?
MATH( EXPR GRASS_NUM_VERSION "${GRASS_MAJOR_VERSION}*10000 + ${GRASS_MINOR_VERSION}*100")
IF(GRASS_INCLUDE_DIR)
FILE(READ ${GRASS_INCLUDE_DIR}/grass/version.h VERSIONFILE)
# We can avoid the following block using version_less version_equal and
# version_greater. Are there compatibility problems?
STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[^ ]+" GRASS_VERSION ${VERSIONFILE})
STRING(REGEX REPLACE "^([0-9]*)\\.[0-9]*\\..*$" "\\1" GRASS_MAJOR_VERSION ${GRASS_VERSION})
STRING(REGEX REPLACE "^[0-9]*\\.([0-9]*)\\..*$" "\\1" GRASS_MINOR_VERSION ${GRASS_VERSION})
STRING(REGEX REPLACE "^[0-9]*\\.[0-9]*\\.(.*)$" "\\1" GRASS_MICRO_VERSION ${GRASS_VERSION})
# Add micro version too?
# How to numerize RC versions?
MATH( EXPR GRASS_NUM_VERSION "${GRASS_MAJOR_VERSION}*10000 + ${GRASS_MINOR_VERSION}*100")
SET (GRASS_LIBRARIES_FOUND TRUE)
SET (GRASS_LIB_NAMES gis dig2 dbmiclient dbmibase shape dgl rtree datetime linkm gproj)
IF (GRASS_MAJOR_VERSION LESS 7 )
LIST(APPEND GRASS_LIB_NAMES vect)
LIST(APPEND GRASS_LIB_NAMES form)
ELSE (GRASS_MAJOR_VERSION LESS 7 )
LIST(APPEND GRASS_LIB_NAMES vector)
LIST(APPEND GRASS_LIB_NAMES raster)
ENDIF (GRASS_MAJOR_VERSION LESS 7 )
SET (GRASS_LIBRARIES_FOUND TRUE)
SET (GRASS_LIB_NAMES gis dig2 dbmiclient dbmibase shape dgl rtree datetime linkm gproj)
IF (GRASS_MAJOR_VERSION LESS 7 )
LIST(APPEND GRASS_LIB_NAMES vect)
LIST(APPEND GRASS_LIB_NAMES form)
ELSE (GRASS_MAJOR_VERSION LESS 7 )
LIST(APPEND GRASS_LIB_NAMES vector)
LIST(APPEND GRASS_LIB_NAMES raster)
ENDIF (GRASS_MAJOR_VERSION LESS 7 )
FOREACH (LIB ${GRASS_LIB_NAMES})
MARK_AS_ADVANCED ( GRASS_LIBRARY_${LIB} )
FOREACH (LIB ${GRASS_LIB_NAMES})
MARK_AS_ADVANCED ( GRASS_LIBRARY_${LIB} )
SET(LIB_PATH NOTFOUND)
FIND_LIBRARY(LIB_PATH NAMES grass_${LIB} PATHS ${G_PREFIX}/lib NO_DEFAULT_PATH)
SET(LIB_PATH NOTFOUND)
FIND_LIBRARY(LIB_PATH NAMES grass_${LIB} PATHS ${G_PREFIX}/lib NO_DEFAULT_PATH)
IF (LIB_PATH)
SET (GRASS_LIBRARY_${LIB} ${LIB_PATH})
ELSE (LIB_PATH)
SET (GRASS_LIBRARY_${LIB} NOTFOUND)
SET (GRASS_LIBRARIES_FOUND FALSE)
ENDIF (LIB_PATH)
IF (LIB_PATH)
SET (GRASS_LIBRARY_${LIB} ${LIB_PATH})
ELSE (LIB_PATH)
SET (GRASS_LIBRARY_${LIB} NOTFOUND)
SET (GRASS_LIBRARIES_FOUND FALSE)
ENDIF (LIB_PATH)
ENDFOREACH (LIB)
ENDFOREACH (LIB)
# LIB_PATH is only temporary variable, so hide it (is it possible to delete a variable?)
UNSET(LIB_PATH CACHE)
# LIB_PATH is only temporary variable, so hide it (is it possible to delete a variable?)
UNSET(LIB_PATH CACHE)
IF (GRASS_LIBRARIES_FOUND)
SET (GRASS_FOUND TRUE)
SET (GRASS_PREFIX ${G_PREFIX})
ENDIF (GRASS_LIBRARIES_FOUND)
ENDIF( GRASS_INCLUDE_DIR )
IF (GRASS_INCLUDE_DIR AND GRASS_LIBRARIES_FOUND)
SET (GRASS_FOUND TRUE)
SET (GRASS_PREFIX ${G_PREFIX})
ENDIF (GRASS_INCLUDE_DIR AND GRASS_LIBRARIES_FOUND)
MARK_AS_ADVANCED ( GRASS_INCLUDE_DIR )
ENDMACRO (CHECK_GRASS)
###################################

View File

@ -14,7 +14,6 @@
***************************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <iostream>
#include <QUrl>
#include <QDesktopServices>
@ -22,6 +21,8 @@
#ifdef Q_OS_WIN
#include <windows.h>
#else
#include <unistd.h>
#endif
// Open a URL by default browser