Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boost: Configure the proper namespace for CMake targets #8446

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -1359,6 +1359,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 @@ -1368,6 +1369,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 @@ -1401,13 +1403,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 @@ -1416,6 +1420,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 @@ -1433,6 +1438,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 @@ -1548,6 +1554,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