diff --git a/CMakeLists.txt b/CMakeLists.txt
index 18407e86..1af91242 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -136,7 +136,9 @@ if(NOT PYTHON_ONLY)
     find_package(FLEX)
     find_package(LibElf REQUIRED)
     find_package(LibDebuginfod)
-    find_package(LibLzma)
+    if(WITH_LZMA)
+        find_package(LibLzma)
+    endif()
     if(CLANG_DIR)
       set(CMAKE_FIND_ROOT_PATH "${CLANG_DIR}")
       include_directories("${CLANG_DIR}/include")
