Merge topic 'patch-FindLibLZMA-version'

08fc190c03 FindLibLZMA: Add LibLZMA_VERSION

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11001
This commit is contained in:
Brad King
2025-08-04 14:34:51 +00:00
committed by Kitware Robot
5 changed files with 62 additions and 26 deletions
@@ -121,7 +121,7 @@ foreach(
GIF GTK2
HDF5
Jasper JPEG
LibArchive LIBLZMA LibXml2 LibXslt LTTngUST
LibArchive LibLZMA LIBLZMA LibXml2 LibXslt LTTngUST
OPENSCENEGRAPH
PNG PostgreSQL Protobuf
Ruby RUBY
+2
View File
@@ -4,6 +4,8 @@ include(CTest)
find_package(LibLZMA REQUIRED)
add_definitions(-DCMAKE_EXPECTED_LIBLZMA_VERSION="${LibLZMA_VERSION}")
add_executable(test_tgt main.c)
target_link_libraries(test_tgt LibLZMA::LibLZMA)
add_test(NAME test_tgt COMMAND test_tgt)
+5 -1
View File
@@ -1,5 +1,6 @@
#include <assert.h>
#include <lzma.h>
#include <stdio.h>
#include <string.h>
static uint8_t const test_string[9] = "123456789";
@@ -11,5 +12,8 @@ int main(void)
uint32_t crc = lzma_crc32(test_string, sizeof(test_string), 0);
assert(crc == test_vector);
return 0;
printf("Found LibLZMA version %s, expected version %s\n",
lzma_version_string(), CMAKE_EXPECTED_LIBLZMA_VERSION);
return strcmp(lzma_version_string(), CMAKE_EXPECTED_LIBLZMA_VERSION);
}