The package liblzma is compatible with built-in CMake targets: find_package(LibLZMA REQUIRED) target_include_directories(main PRIVATE ${LIBLZMA_INCLUDE_DIRS}) target_link_libraries(main PRIVATE ${LIBLZMA_LIBRARIES})