Переменная PROJ_VERSION_MAJOR

This commit is contained in:
Andrei Astafev 2023-08-10 11:28:12 +03:00
parent 34dcc179c0
commit 5579d343bc

View File

@ -31,6 +31,14 @@ if(PROJ_FOUND)
MESSAGE(STATUS "Found Proj: ${PROJ_LIBRARIES}")
endif()
set(HAVE_PROJ 1)
if(EXISTS ${PROJ_INCLUDE_DIR}/proj.h)
file(READ ${PROJ_INCLUDE_DIR}/proj.h proj_version)
string(REGEX REPLACE "^.*PROJ_VERSION_MAJOR +([0-9]+).*$" "\\1" PROJ_VERSION_MAJOR "${proj_version}")
elseif(EXISTS ${PROJ_INCLUDE_DIR}/proj_api.h)
string(REGEX REPLACE "^.*PJ_VERSION ([0-9]+).*$" "\\1" PJ_VERSION "${proj_version}")
string(REGEX REPLACE "([0-9])([0-9])([0-9])" "\\1" PROJ_VERSION_MAJOR "${PJ_VERSION}")
endif()
set(PROJ_VERSION_MAJOR "${PROJ_VERSION_MAJOR}" CACHE INTERNAL "")
elseif(PROJ_FOUND)
if(PROJ_FIND_REQUIRED)
message(FATAL_ERROR "Could not find Proj")