Do not require to specify version for cmake find_package

This commit is contained in:
Igor Kostenko 2020-09-14 11:13:03 +01:00
parent d8f8159dda
commit f5e3cca74e
1 changed files with 9 additions and 7 deletions

View File

@ -3,7 +3,8 @@ set(mi_version_minor 6)
set(mi_version ${mi_version_major}.${mi_version_minor})
set(PACKAGE_VERSION ${mi_version})
if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL "${mi_version_major}")
if(PACKAGE_FIND_VERSION_MAJOR)
if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL "${mi_version_major}")
if ("${PACKAGE_FIND_VERSION_MINOR}" EQUAL "${mi_version_minor}")
set(PACKAGE_VERSION_EXACT TRUE)
elseif("${PACKAGE_FIND_VERSION_MINOR}" LESS "${mi_version_minor}")
@ -11,6 +12,7 @@ if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL "${mi_version_major}")
else()
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()
else()
else()
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()
endif()