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

Update the instructions created by the markdown generator #9758

Merged
merged 22 commits into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e956bcb
Update the instructions created by the markdown generator
tapia Oct 7, 2021
026a2a3
Add build_modules listing and fix tests
tapia Oct 7, 2021
01ff2d5
forgot removing a comment
tapia Oct 7, 2021
c6f888f
Fix generated links to work locally
tapia Oct 8, 2021
5d26e20
Merge branch 'develop' into feature/new_md_readme
tapia Oct 15, 2021
31ca9cf
Fix how we get the package name and filename
tapia Oct 15, 2021
c18554d
Rewrite of the markdown generator to use the new_cpp_info instead of …
tapia Oct 19, 2021
cd3c155
Merge branch 'develop' into feature/new_md_readme
tapia Oct 19, 2021
c8c5fb4
Rename `new_cpp_info`to `cpp_info` in markdown generator
tapia Oct 19, 2021
9b73d1f
remove dead code
tapia Oct 19, 2021
a025c23
Some text improvements following Laso's suggestions
tapia Oct 20, 2021
f9a5914
Add a couple of tests
tapia Oct 21, 2021
2f7458d
Merge branch 'develop' into feature/new_md_readme
tapia Jan 24, 2022
217f49c
Update conans/client/generators/markdown.py
tapia Jan 24, 2022
3b00e1f
Update conans/client/generators/markdown.py
tapia Jan 24, 2022
7c2293b
Merge branch 'feature/new_md_readme' of https://github.com/tapia/cona…
tapia Jan 24, 2022
47d48cd
Update the markdown generator to fit the new cmake properties model
tapia Jan 27, 2022
e7fe10e
Merge branch 'develop' into feature/new_md_readme
tapia Jan 27, 2022
40549d5
Replacing backslash
franramirez688 Jan 31, 2022
4b5254b
Fix component count
tapia Jan 31, 2022
84d83f1
Merge branch 'feature/new_md_readme' of https://github.com/tapia/cona…
tapia Jan 31, 2022
1f30471
Fix property used to check the number of components
tapia Jan 31, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
63 changes: 36 additions & 27 deletions conan/tools/cmake/cmakedeps/templates/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,34 +83,43 @@ def get_file_name(self):
return get_file_name(self.conanfile, find_module_mode=self.find_module_mode)

def get_target_namespace(self, req):
if self.find_module_mode:
ret = req.cpp_info.get_property("cmake_module_target_namespace", "CMakeDeps")
if ret:
return ret

ret = req.cpp_info.get_property("cmake_target_namespace", "CMakeDeps")
return ret or self.get_global_target_name(req)
return get_target_namespace(req, self.find_module_mode)

def get_global_target_name(self, req):
if self.find_module_mode:
ret = req.cpp_info.get_property("cmake_module_target_name", "CMakeDeps")
if ret:
return ret

ret = req.cpp_info.get_property("cmake_target_name", "CMakeDeps")
return ret or req.ref.name
return get_global_target_name(req, self.find_module_mode)

def get_component_alias(self, req, comp_name):
if comp_name not in req.cpp_info.components:
# foo::foo might be referencing the root cppinfo
if req.ref.name == comp_name:
return self.get_target_namespace(req)
raise ConanException("Component '{name}::{cname}' not found in '{name}' "
"package requirement".format(name=req.ref.name, cname=comp_name))
if self.find_module_mode:
ret = req.cpp_info.components[comp_name].get_property("cmake_module_target_name",
"CMakeDeps")
if ret:
return ret
ret = req.cpp_info.components[comp_name].get_property("cmake_target_name", "CMakeDeps")
return ret or comp_name
return get_component_alias(req, comp_name, self.find_module_mode)

def get_target_namespace(req, find_module_mode=False):
if find_module_mode:
ret = req.cpp_info.get_property("cmake_module_target_namespace", "CMakeDeps")
if ret:
return ret

ret = req.cpp_info.get_property("cmake_target_namespace", "CMakeDeps")
return ret or get_global_target_name(req, find_module_mode)

def get_global_target_name(req, find_module_mode=False):
if find_module_mode:
ret = req.cpp_info.get_property("cmake_module_target_name", "CMakeDeps")
if ret:
return ret

ret = req.cpp_info.get_property("cmake_target_name", "CMakeDeps")
return ret or req.ref.name

def get_component_alias(req, comp_name, find_module_mode=False):
if comp_name not in req.cpp_info.components:
# foo::foo might be referencing the root cppinfo
if req.ref.name == comp_name:
return get_target_namespace(req, find_module_mode)
raise ConanException("Component '{name}::{cname}' not found in '{name}' "
"package requirement".format(name=req.ref.name, cname=comp_name))
if find_module_mode:
ret = req.cpp_info.components[comp_name].get_property("cmake_module_target_name",
"CMakeDeps")
if ret:
return ret
ret = req.cpp_info.components[comp_name].get_property("cmake_target_name", "CMakeDeps")
return ret or comp_name