Skip to content

Commit

Permalink
Use set_property for boost
Browse files Browse the repository at this point in the history
  • Loading branch information
db4 committed Nov 19, 2021
1 parent b1fa229 commit 6a86733
Showing 1 changed file with 16 additions and 22 deletions.
38 changes: 16 additions & 22 deletions recipes/boost/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
except ImportError:
from io import StringIO

required_conan_version = ">=1.33.0"
required_conan_version = ">=1.36.0"


# When adding (or removing) an option, also add this option to the list in
Expand Down Expand Up @@ -1341,18 +1341,16 @@ def _option_to_conan_requirement(name):
def package_info(self):
self.env_info.BOOST_ROOT = self.package_folder

self.cpp_info.filenames["cmake_find_package"] = "Boost"
self.cpp_info.filenames["cmake_find_package_multi"] = "Boost"
self.cpp_info.names["cmake_find_package"] = "Boost"
self.cpp_info.names["cmake_find_package_multi"] = "Boost"
self.cpp_info.set_property("cmake_file_name", "Boost")
self.cpp_info.set_property("cmake_target_name", "Boost")
self.cpp_info.set_property("pkg_config_name", "Boost")

# - Use 'headers' component for all includes + defines
# - Use '_libboost' component to attach extra system_libs, ...

self.cpp_info.components["headers"].libs = []
self.cpp_info.components["headers"].names["cmake_find_package"] = "headers"
self.cpp_info.components["headers"].names["cmake_find_package_multi"] = "headers"
self.cpp_info.components["headers"].names["pkg_config"] = "boost"
self.cpp_info.components["headers"].set_property("cmake_target_name", "headers")
self.cpp_info.components["headers"].set_property("pkg_config_name", "headers")

if self.options.system_no_deprecated:
self.cpp_info.components["headers"].defines.append("BOOST_SYSTEM_NO_DEPRECATED")
Expand Down Expand Up @@ -1383,24 +1381,22 @@ def package_info(self):

# Boost::boost is an alias of Boost::headers
self.cpp_info.components["_boost_cmake"].requires = ["headers"]
self.cpp_info.components["_boost_cmake"].names["cmake_find_package"] = "boost"
self.cpp_info.components["_boost_cmake"].names["cmake_find_package_multi"] = "boost"
self.cpp_info.components["_boost_cmake"].set_property("cmake_target_name", "boost")
self.cpp_info.components["_boost_cmake"].set_property("pkg_config_name", "boost")

if not self.options.header_only:
self.cpp_info.components["_libboost"].requires = ["headers"]

self.cpp_info.components["diagnostic_definitions"].libs = []
self.cpp_info.components["diagnostic_definitions"].names["cmake_find_package"] = "diagnostic_definitions"
self.cpp_info.components["diagnostic_definitions"].names["cmake_find_package_multi"] = "diagnostic_definitions"
self.cpp_info.components["diagnostic_definitions"].names["pkg_config"] = "boost_diagnostic_definitions" # FIXME: disable on pkg_config
self.cpp_info.components["diagnostic_definitions"].set_property("cmake_target_name", "diagnostic_definitions")
self.cpp_info.components["diagnostic_definitions"].set_property("pkg_config_name", "boost_diagnostic_definitions") # FIXME: disable on pkg_config
self.cpp_info.components["_libboost"].requires.append("diagnostic_definitions")
if self.options.diagnostic_definitions:
self.cpp_info.components["diagnostic_definitions"].defines = ["BOOST_LIB_DIAGNOSTIC"]

self.cpp_info.components["disable_autolinking"].libs = []
self.cpp_info.components["disable_autolinking"].names["cmake_find_package"] = "disable_autolinking"
self.cpp_info.components["disable_autolinking"].names["cmake_find_package_multi"] = "disable_autolinking"
self.cpp_info.components["disable_autolinking"].names["pkg_config"] = "boost_disable_autolinking" # FIXME: disable on pkg_config
self.cpp_info.components["disable_autolinking"].set_property("cmake_target_name", "disable_autolinking")
self.cpp_info.components["disable_autolinking"].set_property("pkg_config_name", "boost_disable_autolinking") # FIXME: disable on pkg_config
self.cpp_info.components["_libboost"].requires.append("disable_autolinking")
if self._is_msvc or self._is_clang_cl:
if self.options.magic_autolink:
Expand All @@ -1415,9 +1411,8 @@ def package_info(self):
self.output.info("Disabled magic autolinking (smart and magic decisions)")

self.cpp_info.components["dynamic_linking"].libs = []
self.cpp_info.components["dynamic_linking"].names["cmake_find_package"] = "dynamic_linking"
self.cpp_info.components["dynamic_linking"].names["cmake_find_package_multi"] = "dynamic_linking"
self.cpp_info.components["dynamic_linking"].names["pkg_config"] = "boost_dynamic_linking" # FIXME: disable on pkg_config
self.cpp_info.components["dynamic_linking"].set_property("cmake_target_name", "dynamic_linking")
self.cpp_info.components["dynamic_linking"].set_property("pkg_config_name", "boost_dynamic_linking") # FIXME: disable on pkg_config
self.cpp_info.components["_libboost"].requires.append("dynamic_linking")
if self._shared:
# A Boost::dynamic_linking cmake target does only make sense for a shared boost package
Expand Down Expand Up @@ -1530,9 +1525,8 @@ def filter_transform_module_libraries(names):
self.cpp_info.components[module].libs = module_libraries

self.cpp_info.components[module].requires = self._dependencies["dependencies"][module] + ["_libboost"]
self.cpp_info.components[module].names["cmake_find_package"] = module
self.cpp_info.components[module].names["cmake_find_package_multi"] = module
self.cpp_info.components[module].names["pkg_config"] = "boost_{}".format(module)
self.cpp_info.components[module].set_property("cmake_target_name", module)
self.cpp_info.components[module].set_property("pkg_config_name", "boost_{}".format(module))

for requirement in self._dependencies.get("requirements", {}).get(module, []):
if self.options.get_safe(requirement, None) == False:
Expand Down

0 comments on commit 6a86733

Please sign in to comment.