Skip to content

Commit

Permalink
- added version handling support for cmake integration (facebookarchi…
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke1410 committed Sep 8, 2019
1 parent c257df3 commit d47ef13
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions slikenet-config-version.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright (c) 2019, SLikeSoft UG (haftungsbeschränkt)
#
# This file is licensed under the MIT-style license found in the license.txt
# file in the root directory of this source tree.

set(PACKAGE_VERSION @SLikeNet_VERSION@)

if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL "@SLikeNet_VERSION_MAJOR@")
if("${PACKAGE_FIND_VERSION_MINOR}" EQUAL "@SLikeNet_VERSION_MINOR@")
if("${PACKAGE_FIND_VERSION_PATCH}" EQUAL "@SLikeNet_VERSION_PATCH@")
# exactly the required version
set(PACKAGE_VERSION_EXACT TRUE)
else()
# requested x.y.z with x.y.z1 being installed where z1 is != z
# since it's just a patch level change, the version is fully compatible
set(PACKAGE_VERSION_COMPATIBLE TRUE)
endif()
elseif("${PACKAGE_FIND_VERSION_MINOR}" LESS "@SLikeNet_VERSION_MINOR@")
# requested x.y.z with x.y1.z1 being installed where y1 is != y
# the version is compatible, if y1 is > y
if("${PACKAGE_FIND_VERSION_MINOR}" LESS "@SLikeNet_VERSION_MINOR@")
set(PACKAGE_VERSION_COMPATIBLE TRUE)
else()
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()
else()
# requested was x.y.z while we have installed x.y1.z with y1 < y -> not compatbile
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()
elseif("$(PACKAGE_FIND_VERSION_MAJOR)" EQUAL 1 AND "@SLikeNet_VERSION_MAJOR@" EQUAL 0)
# version 0.x.y was requested while we have 1.x.y installed - 1.x.y is backwards compatible with 0.x.y
set(PACKAGE_VERSION_COMPATIBLE TRUE)
else()
# requested was x.y.z while we have installed x1.y.z with x1 != x -> not compatible
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()

0 comments on commit d47ef13

Please sign in to comment.