Repository: conan-io/conan-center-index
Issue: [package] boost/1.72.0: Build error when enabling lzma option

Building boost with  `--options lzma=True` generates an error. All other data compression library options work ok.

### Package and Environment Details (include every applicable attribute)
  * Package Name/Version: **boost/1.72.0**
  * Operating System+version: **macOS Mojave 10.14.6 (18G4032)**
  * Compiler+version: **11.0.0 (clang-1100.0.33.17)**
  * Conan version: **conan 1.24.0**
  * Python version: **Python 3.7.7**


### Conan profile 
```
Configuration for profile default:

[settings]
os=Macos
os_build=Macos
arch=x86_64
arch_build=x86_64
compiler=apple-clang
compiler.version=11.0
compiler.libcxx=libc++
build_type=Release
[options]
[build_requires]
[env]

```


### Steps to reproduce (Include if Applicable)

1. Run the following command in the terminal:
    `conan install boost/1.72.0@ --update --build outdated --settings cppstd=17 --options lzma=True`

2. Observe the following error in the output:
   ```
   ERROR: boost/1.72.0: Error in build() method, line 404
      self._create_user_config_jam(self._boost_build_dir)
   while calling '_create_user_config_jam', line 714
      contents += create_library_config("lzma")
   while calling 'create_library_config', line 695
      includedir = self.deps_cpp_info[name].include_paths[0].replace('\\\\', '/')
      KeyError: 'lzma'
   ```

### Logs (Include/Attach if Applicable)
<details><summary>Click to expand log</summary>

```
conan install boost/1.72.0@ --update --build outdated --settings cppstd=17 --options zlib=True --options bzip2=True --options lzma=True --options zstd=True
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=apple-clang
compiler.libcxx=libc++
compiler.version=11.0
cppstd=17
os=Macos
os_build=Macos
[options]
bzip2=True
lzma=True
zlib=True
zstd=True
[build_requires]
[env]

boost/1.72.0: Not found in local cache, looking in remotes...
boost/1.72.0: Trying with 'conan-center'...
Downloading conanmanifest.txt completed [1.16k]                                          
Downloading conanfile.py completed [36.58k]                                              
Downloading conan_export.tgz completed [0.41k]                                           
Decompressing conan_export.tgz completed [0.00k]                                         
boost/1.72.0: Downloaded recipe revision 0
xz_utils/5.2.4: Not found in local cache, looking in remotes...
xz_utils/5.2.4: Trying with 'conan-center'...
Downloading conanmanifest.txt completed [0.10k]                                          
Downloading conanfile.py completed [6.80k]                                               
Downloading conan_export.tgz completed [0.23k]                                           
Decompressing conan_export.tgz completed [0.00k]                                         
xz_utils/5.2.4: Downloaded recipe revision 0
zstd/1.4.3: Not found in local cache, looking in remotes...
zstd/1.4.3: Trying with 'conan-center'...
Downloading conanmanifest.txt completed [0.17k]                                          
Downloading conanfile.py completed [1.88k]                                               
Downloading conan_export.tgz completed [0.24k]                                           
Decompressing conan_export.tgz completed [0.00k]                                         
zstd/1.4.3: Downloaded recipe revision 0
bzip2/1.0.8: Package is up to date
xz_utils/5.2.4: Package is up to date
zlib/1.2.11: Package is up to date
zstd/1.4.3: Package is up to date
b2/4.2.0: Not found in local cache, looking in remotes...
b2/4.2.0: Trying with 'conan-center'...
Downloading conanmanifest.txt completed [0.10k]                                          
Downloading conanfile.py completed [1.90k]                                               
Downloading conan_export.tgz completed [0.24k]                                           
Decompressing conan_export.tgz completed [0.00k]                                         
b2/4.2.0: Downloaded recipe revision 0
b2/4.2.0: Package is up to date
Installing package: boost/1.72.0
Requirements
    boost/1.72.0 from 'conan-center' - Downloaded
    bzip2/1.0.8 from 'conan-center' - Cache
    xz_utils/5.2.4 from 'conan-center' - Downloaded
    zlib/1.2.11 from 'conan-center' - Cache
    zstd/1.4.3 from 'conan-center' - Downloaded
Packages
    boost/1.72.0:5f018021f01f063a83376dc1f75a6def95e6805f - Build
    bzip2/1.0.8:32bef4803d4b079e983ecb27f105881e778bc5a7 - Cache
    xz_utils/5.2.4:f74366f76f700cc6e991285892ad7a23c30e6d47 - Download
    zlib/1.2.11:f74366f76f700cc6e991285892ad7a23c30e6d47 - Cache
    zstd/1.4.3:f74366f76f700cc6e991285892ad7a23c30e6d47 - Download
Build requirements
    b2/4.2.0 from 'conan-center' - Downloaded
Build requirements packages
    b2/4.2.0:743cf0321be3152777da4d05247a66d1552e70a2 - Download

Installing (downloading, building) binaries...
b2/4.2.0: Retrieving package 743cf0321be3152777da4d05247a66d1552e70a2 from remote 'conan-center' 
Downloading conanmanifest.txt completed [15.70k]                                         
Downloading conaninfo.txt completed [0.22k]                                              
Downloading conan_package.tgz completed [480.04k]                                        
Decompressing conan_package.tgz completed [0.00k]                                        
b2/4.2.0: Package installed 743cf0321be3152777da4d05247a66d1552e70a2
b2/4.2.0: Downloaded package revision 0
xz_utils/5.2.4: Retrieving package f74366f76f700cc6e991285892ad7a23c30e6d47 from remote 'conan-center' 
Downloading conanmanifest.txt completed [1.98k]                                          
Downloading conaninfo.txt completed [0.40k]                                              
Downloading conan_package.tgz completed [321.66k]                                        
Decompressing conan_package.tgz completed [0.00k]                                        
xz_utils/5.2.4: Package installed f74366f76f700cc6e991285892ad7a23c30e6d47
xz_utils/5.2.4: Downloaded package revision 0
zstd/1.4.3: Retrieving package f74366f76f700cc6e991285892ad7a23c30e6d47 from remote 'conan-center' 
Downloading conanmanifest.txt completed [0.40k]                                          
Downloading conaninfo.txt completed [0.40k]                                              
Downloading conan_package.tgz completed [404.42k]                                        
Decompressing conan_package.tgz completed [0.00k]                                        
zstd/1.4.3: Package installed f74366f76f700cc6e991285892ad7a23c30e6d47
zstd/1.4.3: Downloaded package revision 0
bzip2/1.0.8: Already installed!
zlib/1.2.11: Already installed!
boost/1.72.0: Applying build-requirement: b2/4.2.0
Downloading conan_sources.tgz completed [11.26k]                                         
Decompressing conan_sources.tgz completed [0.00k]                                        
boost/1.72.0: Configuring sources in /Users/dom/.conan/data/boost/1.72.0/_/_/source
Downloading boost_1_72_0.tar.bz2 completed [104401.72k]                                  

WARN: patches/bcp_namespace_issues_1_72.patch: file 1/1:	 b'Jamroot'
WARN: patches/bcp_namespace_issues_1_72.patch:  hunk no.1 doesn't match source file at line 143
WARN: patches/bcp_namespace_issues_1_72.patch:   expected: b'import tools/boost_install/boost-install ;'
WARN: patches/bcp_namespace_issues_1_72.patch:   actual  : b'# Backslash because of `bcp --namespace`'
WARN: patches/bcp_namespace_issues_1_72.patch: file 1/1:	 b'Jamroot'
WARN: patches/bcp_namespace_issues_1_72.patch:  hunk no.2 doesn't match source file at line 311
WARN: patches/bcp_namespace_issues_1_72.patch:   expected: b'# stage and install targets via boost-install, above.'
WARN: patches/bcp_namespace_issues_1_72.patch:   actual  : b'# Creates a library target, adding autolink support and also creates'
WARN: patches/bcp_namespace_issues_1_72.patch: already patched  b'Jamroot'
WARN: patches/boost_core_qnx_cxx_provide___cxa_get_globals.patch: file 1/1:	 b'boost/core/uncaught_exceptions.hpp'
WARN: patches/boost_core_qnx_cxx_provide___cxa_get_globals.patch:  hunk no.1 doesn't match source file at line 59
WARN: patches/boost_core_qnx_cxx_provide___cxa_get_globals.patch:   expected: b'#if !defined(__FreeBSD__) && \\\\'
WARN: patches/boost_core_qnx_cxx_provide___cxa_get_globals.patch:   actual  : b'// On QNX SDP 7.0 (QCC 5.4.0), there are multiple cxxabi.h, one from glibcxx from gcc and another from libc++abi from LLVM. Which one is included will be determined by the qcc'
WARN: patches/boost_core_qnx_cxx_provide___cxa_get_globals.patch: already patched  b'boost/core/uncaught_exceptions.hpp'
boost/1.72.0: Building your package in /Users/dom/.conan/data/boost/1.72.0/_/_/build/5f018021f01f063a83376dc1f75a6def95e6805f
boost/1.72.0: Generator txt created conanbuildinfo.txt
boost/1.72.0: Calling build()
boost/1.72.0: WARN: Patching user-config.jam
boost/1.72.0: 
boost/1.72.0: ERROR: Package '5f018021f01f063a83376dc1f75a6def95e6805f' build failed
boost/1.72.0: WARN: Build folder /Users/dom/.conan/data/boost/1.72.0/_/_/build/5f018021f01f063a83376dc1f75a6def95e6805f
ERROR: boost/1.72.0: Error in build() method, line 404
	self._create_user_config_jam(self._boost_build_dir)
while calling '_create_user_config_jam', line 714
	contents += create_library_config("lzma")
while calling 'create_library_config', line 695
	includedir = self.deps_cpp_info[name].include_paths[0].replace('\\\\', '/')
	KeyError: 'lzma'
```

</details>


Changed files:
recipes/boost/all/conanfile.py

diff --git a/recipes/boost/all/conanfile.py b/recipes/boost/all/conanfile.py
index 918c27d0c..e69f6abf9 100644
--- a/recipes/boost/all/conanfile.py
+++ b/recipes/boost/all/conanfile.py
@@ -546,7 +546,7 @@ class BoostConan(ConanFile):
         if self._zip_bzip2_requires_needed:
             add_defines(self.options.zlib, "zlib")
             add_defines(self.options.bzip2, "bzip2")
-            add_defines(self.options.lzma, "lzma")
+            add_defines(self.options.lzma, "xz_utils")
             add_defines(self.options.zstd, "zstd")
 
         if self._is_msvc and self.settings.compiler.runtime:
@@ -691,11 +691,11 @@ class BoostConan(ConanFile):
 
         contents = ""
         if self._zip_bzip2_requires_needed:
-            def create_library_config(name):
-                includedir = self.deps_cpp_info[name].include_paths[0].replace('\\\\', '/')
-                libdir = self.deps_cpp_info[name].lib_paths[0].replace('\\\\', '/')
-                lib = self.deps_cpp_info[name].libs[0]
-                version = self.deps_cpp_info[name].version
+            def create_library_config(deps_name, name):
+                includedir = self.deps_cpp_info[deps_name].include_paths[0].replace('\\\\', '/')
+                libdir = self.deps_cpp_info[deps_name].lib_paths[0].replace('\\\\', '/')
+                lib = self.deps_cpp_info[deps_name].libs[0]
+                version = self.deps_cpp_info[deps_name].version
                 return "\\nusing {name} : {version} : " \\
                        "<include>{includedir} " \\
                        "<search>{libdir} " \\
@@ -707,13 +707,13 @@ class BoostConan(ConanFile):
 
             contents = ""
             if self.options.zlib:
-                contents += create_library_config("zlib")
+                contents += create_library_config("zlib", "zlib")
             if self.options.bzip2:
-                contents += create_library_config("bzip2")
+                contents += create_library_config("bzip2", "bzip2")
             if self.options.lzma:
-                contents += create_library_config("lzma")
+                contents += create_library_config("xz_utils", "lzma")
             if self.options.zstd:
-                contents += create_library_config("zstd")
+                contents += create_library_config("zstd", "zstd")
 
         if not self.options.without_python:
             # https://www.boost.org/doc/libs/1_70_0/libs/python/doc/html/building/configuring_boost_build.html