Skip to content
This repository was archived by the owner on Mar 22, 2023. It is now read-only.

Commit cf64ba0

Browse files
cmake: fix finding proper version of pmreorder
version comparison should be used, instead of string comparison. Simplify the function, by the way.
1 parent c548fdb commit cf64ba0

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

tests/ctest_helpers.cmake

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,21 @@ function(find_pmreorder)
7070
return()
7171
endif()
7272

73-
if((NOT(PMEMCHECK_VERSION LESS 1.0)) AND PMEMCHECK_VERSION LESS 2.0)
73+
if((NOT(PMEMCHECK_VERSION VERSION_LESS 1.0)) AND PMEMCHECK_VERSION VERSION_LESS 2.0)
7474
find_program(PMREORDER names pmreorder HINTS ${LIBPMEMOBJ_PREFIX}/bin)
75-
get_program_version_major_minor(${PMREORDER} PMREORDER_VERSION)
76-
message(STATUS "pmreorder found: ${PMREORDER}, in version: ${PMREORDER_VERSION}")
7775

78-
if(PMREORDER_VERSION EQUAL PMREORDER_REQUIRED_VERSION OR PMREORDER_VERSION GREATER PMREORDER_REQUIRED_VERSION)
79-
set(PROPER_PMREORDER_VERSION 1)
80-
endif()
76+
if(PMREORDER)
77+
get_program_version_major_minor(${PMREORDER} PMREORDER_VERSION)
78+
message(STATUS "pmreorder found: ${PMREORDER}, in version: ${PMREORDER_VERSION}")
8179

82-
if(PMREORDER AND PROPER_PMREORDER_VERSION)
83-
set(ENV{PATH} ${LIBPMEMOBJ_PREFIX}/bin:$ENV{PATH})
84-
set(PMREORDER_SUPPORTED true CACHE INTERNAL "pmreorder support")
85-
elseif(NOT PMREORDER)
80+
if(PMREORDER_VERSION VERSION_EQUAL PMREORDER_REQUIRED_VERSION OR PMREORDER_VERSION VERSION_GREATER PMREORDER_REQUIRED_VERSION)
81+
set(ENV{PATH} ${LIBPMEMOBJ_PREFIX}/bin:$ENV{PATH})
82+
set(PMREORDER_SUPPORTED true CACHE INTERNAL "pmreorder support")
83+
else()
84+
message(WARNING "Pmreorder should be in version >= ${PMREORDER_REQUIRED_VERSION} - pmreorder tests will not be performed.")
85+
endif()
86+
else()
8687
message(WARNING "Pmreorder not found - pmreorder tests will not be performed.")
87-
elseif(NOT PROPER_PMREORDER_VERSION)
88-
message(WARNING "Pmreorder should be in version >= ${PMREORDER_REQUIRED_VERSION} - pmreorder tests will not be performed.")
8988
endif()
9089
else()
9190
message(WARNING "Pmemcheck must be installed in version 1.X for pmreorder to work - pmreorder tests will not be performed.")

0 commit comments

Comments
 (0)