Skip to content

Commit 56b671c

Browse files
committed
cmake: updated exact version check semantics for find_package(Orocos-RTT)
Every version that has the same major version number and at least the requested minor version number is considered as compatible. Nothing changed here. If an exact version of RTT is requested, the script also accepts it if the patch version or the minor version was not specified. If they are, they have to match. Signed-off-by: Johannes Meyer <[email protected]>
1 parent 095e9fa commit 56b671c

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

orocos-rtt-config-version.cmake.in

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
########################################################################################################################
22
#
3-
# CMake version file for the OrocosRTT package.
3+
# CMake version file for the Orocos-RTT package.
44
# This script checks whether the requested version matches exactly or is compatible with the installed package version.
55
#
66
# This script sets the following variables:
@@ -14,13 +14,19 @@
1414
set(PACKAGE_VERSION @RTT_VERSION@)
1515

1616
# Exact match test
17-
if(@RTT_VERSION@ VERSION_EQUAL PACKAGE_FIND_VERSION)
18-
set(PACKAGE_VERSION_EXACT TRUE)
17+
if(PACKAGE_FIND_VERSION_MAJOR EQUAL "@RTT_VERSION_MAJOR@")
18+
if(PACKAGE_FIND_VERSION_MINOR EQUAL "@RTT_VERSION_MINOR@" OR
19+
PACKAGE_FIND_VERSION_COUNT LESS "2")
20+
if(PACKAGE_FIND_VERSION_PATCH EQUAL "@RTT_VERSION_PATCH@" OR
21+
PACKAGE_FIND_VERSION_COUNT LESS "3")
22+
set(PACKAGE_VERSION_EXACT 1)
23+
endif()
24+
endif()
1925
endif()
2026

2127
# Compatible version test
22-
if(NOT @RTT_VERSION@ VERSION_LESS PACKAGE_FIND_VERSION AND # Installed version can't be lower than requested one
23-
@RTT_VERSION_MAJOR@ EQUAL PACKAGE_FIND_VERSION_MAJOR) # ...and major versions must coincide
28+
if(NOT "@RTT_VERSION@" VERSION_LESS PACKAGE_FIND_VERSION AND # Installed version can't be lower than requested one
29+
"@RTT_VERSION_MAJOR@" EQUAL PACKAGE_FIND_VERSION_MAJOR) # ...and major versions must coincide
2430
set(PACKAGE_VERSION_COMPATIBLE TRUE)
2531
endif()
2632

0 commit comments

Comments
 (0)