Skip to content

Commit

Permalink
fix PROJ_HAS_VERSION and also display version in cmake output (#6878)
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Apr 27, 2018
1 parent 3984e90 commit a34c443
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion cmake/FindProj.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,14 @@ IF (PROJ_FOUND)
check_library_exists("${PROJ_LIBRARY}" proj_info "" PROJ_HAS_INFO)

IF (NOT PROJ_FIND_QUIETLY)
MESSAGE(STATUS "Found Proj: ${PROJ_LIBRARY}")
IF (PROJ_HAS_INFO)
FILE(READ ${PROJ_INCLUDE_DIR}/proj.h proj_version)
STRING(REGEX REPLACE "^.*PROJ_VERSION_MAJOR +([0-9]+).*$" "\\1" PROJ_VERSION_MAJOR "${proj_version}")
STRING(REGEX REPLACE "^.*PROJ_VERSION_MINOR +([0-9]+).*$" "\\1" PROJ_VERSION_MINOR "${proj_version}")
STRING(REGEX REPLACE "^.*PROJ_VERSION_PATCH +([0-9]+).*$" "\\1" PROJ_VERSION_PATCH "${proj_version}")
STRING(CONCAT PROJ_VERSION_STR "(" ${PROJ_VERSION_MAJOR} "." ${PROJ_VERSION_MINOR} "." ${PROJ_VERSION_PATCH} ")")
ENDIF (PROJ_HAS_INFO)
MESSAGE(STATUS "Found Proj: ${PROJ_LIBRARY} ${PROJ_VERSION_STR}")
ENDIF (NOT PROJ_FIND_QUIETLY)

ELSE (PROJ_FOUND)
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4222,7 +4222,7 @@ void QgisApp::about()

versionString += QLatin1String( "</tr><tr>" );

#if PJ_VERSION >= 500
#if PROJ_HAS_INFO
PJ_INFO info = proj_info();
versionString += "<td>" + tr( "Compiled against PROJ" ) + "</td><td>" + QString::number( PJ_VERSION ) + "</td>";
versionString += "<td>" + tr( "Running against PROJ" ) + "</td><td>" + info.version + "</td>";
Expand Down

0 comments on commit a34c443

Please sign in to comment.