cmake: made FindGSSAPI.cmake able to detect kerberos versions such as: "Kerberos 5 release 1.18-prerelease".

This commit is contained in:
Pascal J. Bourguignon 2018-12-21 11:59:04 +01:00
parent da819bf770
commit 7d07bce64f

View File

@ -115,7 +115,7 @@ if(NOT GSS_FOUND) # not found by pkg-config. Let's take more traditional approac
string(STRIP "${_GSS_VENDOR}" _GSS_VENDOR)
if((GSS_FLAVOUR STREQUAL "Heimdal" AND NOT _GSS_VENDOR STREQUAL "Heimdal")
OR (GSS_FLAVOUR STREQUAL "MIT" AND NOT _GSS_VENDOR STREQUAL "Massachusetts Institute of Technology"))
message(SEND_ERROR "GSS vendor and GSS flavour are not matching : _GSS_VENDOR=${_GSS_VENDOR} ; GSS_FLAVOUR=${GSS_FLAVOUR}")
message(SEND_ERROR "GSS vendor and GSS flavour are not matching : _GSS_VENDOR=${_GSS_VENDOR} ; GSS_FLAVOUR=${GSS_FLAVOUR}")
message(STATUS "Try to set the path to GSS root folder in the system variable GSS_ROOT_DIR")
endif()
else()
@ -428,13 +428,17 @@ if(GSS_FLAVOUR STREQUAL "MIT")
string(REGEX REPLACE "\\." "" GSS_VERSION_MAJOR "${GSS_VERSION_MAJOR}")
string(REGEX MATCH "\\.([0-9]+)$" GSS_VERSION_MINOR ${GSS_RELEASE_NUMBER})
if(NOT GSS_VERSION_MINOR)
string(REGEX MATCH "\\.([0-9]+)\\." GSS_VERSION_MINOR ${GSS_RELEASE_NUMBER})
string(REGEX REPLACE "\\." "" GSS_VERSION_MINOR "${GSS_VERSION_MINOR}")
string(REGEX REPLACE "\\." "" GSS_VERSION_MINOR "${GSS_VERSION_MINOR}")
string(REGEX MATCH "([0-9]+)$" GSS_VERSION_PATCH ${GSS_RELEASE_NUMBER})
string(REGEX REPLACE "\\." "" GSS_VERSION_PATCH "${GSS_VERSION_PATCH}")
string(REGEX MATCH "\\.([0-9]+)[-\\.]" GSS_VERSION_MINOR ${GSS_RELEASE_NUMBER})
string(REGEX REPLACE "\\." "" GSS_VERSION_MINOR "${GSS_VERSION_MINOR}")
string(REGEX REPLACE "\\." "" GSS_VERSION_MINOR "${GSS_VERSION_MINOR}")
string(REGEX REPLACE "-" "" GSS_VERSION_MINOR "${GSS_VERSION_MINOR}")
string(REGEX MATCH "\\.([0-9]+)$" GSS_VERSION_PATCH "${GSS_RELEASE_NUMBER}")
string(REGEX REPLACE "\\." "" GSS_VERSION_PATCH "${GSS_VERSION_PATCH}")
if(NOT GSS_VERSION_PATCH)
set(GSS_VERSION_PATCH "0")
endif()
else()
string(REGEX REPLACE "\\." "" GSS_VERSION_MINOR "${GSS_VERSION_MINOR}")
string(REGEX REPLACE "\\." "" GSS_VERSION_MINOR "${GSS_VERSION_MINOR}")
set(GSS_VERSION_PATCH "0")
endif()
if(GSS_VERSION_MAJOR AND GSS_VERSION_MINOR)
@ -443,6 +447,7 @@ if(GSS_FLAVOUR STREQUAL "MIT")
else()
message(SEND_ERROR "Failed to retrieved Kerberos version number")
endif()
message(STATUS "Located Kerberos ${GSS_VERSION_MAJOR}.${GSS_VERSION_MINOR}.${GSS_VERSION_PATCH}")
endif()
mark_as_advanced(GSS_INCLUDE_DIR GSS_LIBRARIES)