Skip to content

Commit

Permalink
(conan-io#8446) boost: Configure the proper namespace for CMake targets
Browse files Browse the repository at this point in the history
  • Loading branch information
jwillikers authored and Sahnvour committed Jan 29, 2022
1 parent db8941a commit 62efa83
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion 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.43.0"


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

self.cpp_info.set_property("cmake_file_name", "Boost")
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"
Expand All @@ -1376,6 +1377,7 @@ def package_info(self):
# - Use '_libboost' component to attach extra system_libs, ...

self.cpp_info.components["headers"].libs = []
self.cpp_info.components["headers"].set_property("cmake_target_name", "Boost::headers")
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"
Expand Down Expand Up @@ -1409,13 +1411,15 @@ 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"].set_property("cmake_target_name", "Boost::boost")
self.cpp_info.components["_boost_cmake"].names["cmake_find_package"] = "boost"
self.cpp_info.components["_boost_cmake"].names["cmake_find_package_multi"] = "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"].set_property("cmake_target_name", "Boost::diagnostic_definitions")
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
Expand All @@ -1424,6 +1428,7 @@ def package_info(self):
self.cpp_info.components["diagnostic_definitions"].defines = ["BOOST_LIB_DIAGNOSTIC"]

self.cpp_info.components["disable_autolinking"].libs = []
self.cpp_info.components["disable_autolinking"].set_property("cmake_target_name", "Boost::disable_autolinking")
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
Expand All @@ -1441,6 +1446,7 @@ 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"].set_property("cmake_target_name", "Boost::dynamic_linking")
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
Expand Down Expand Up @@ -1556,6 +1562,7 @@ 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].set_property("cmake_target_name", "Boost::" + module)
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)
Expand Down

0 comments on commit 62efa83

Please sign in to comment.