Skip to content

Commit

Permalink
test custom CMake variables in conan generator
Browse files Browse the repository at this point in the history
variables from https://cmake.org/cmake/help/latest/module/FindLibLZMA.html must be defined

LIBLZMA_HAS_AUTO_DECODER, LIBLZMA_HAS_EASY_ENCODER & LIBLZMA_HAS_LZMA_PRESET are not modeled for the moment
  • Loading branch information
SpaceIm committed Sep 21, 2022
1 parent 83cf0d6 commit 4a2afde
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
19 changes: 19 additions & 0 deletions recipes/xz_utils/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,22 @@ find_package(LibLZMA REQUIRED)

add_executable(${PROJECT_NAME} test_package.c)
target_link_libraries(${PROJECT_NAME} PRIVATE LibLZMA::LibLZMA)

# Test whether variables from https://cmake.org/cmake/help/latest/module/FindLibLZMA.html
# are properly defined in conan generators
set(_custom_vars
LIBLZMA_FOUND
LibLZMA_INCLUDE_DIRS
LIBLZMA_LIBRARIES
LIBLZMA_VERSION_MAJOR
LIBLZMA_VERSION_MINOR
LIBLZMA_VERSION_PATCH
LIBLZMA_VERSION_STRING
)
foreach(_custom_var ${_custom_vars})
if(DEFINED _custom_var)
message(STATUS "${_custom_var}: ${${_custom_var}}")
else()
message(FATAL_ERROR "${_custom_var} not defined")
endif()
endforeach()
19 changes: 19 additions & 0 deletions recipes/xz_utils/all/test_v1_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,22 @@ find_package(LibLZMA REQUIRED)

add_executable(${PROJECT_NAME} ../test_package/test_package.c)
target_link_libraries(${PROJECT_NAME} PRIVATE LibLZMA::LibLZMA)

# Test whether variables from https://cmake.org/cmake/help/latest/module/FindLibLZMA.html
# are properly defined in conan generators
set(_custom_vars
LIBLZMA_FOUND
LibLZMA_INCLUDE_DIRS
LIBLZMA_LIBRARIES
LIBLZMA_VERSION_MAJOR
LIBLZMA_VERSION_MINOR
LIBLZMA_VERSION_PATCH
LIBLZMA_VERSION_STRING
)
foreach(_custom_var ${_custom_vars})
if(DEFINED _custom_var)
message(STATUS "${_custom_var}: ${${_custom_var}}")
else()
message(FATAL_ERROR "${_custom_var} not defined")
endif()
endforeach()

0 comments on commit 4a2afde

Please sign in to comment.