Skip to content

Conversation

ABBAPOH
Copy link
Contributor

@ABBAPOH ABBAPOH commented Sep 3, 2025

As was requested by user migrating from Conan 1.x here https://bugreports.qt.io/projects/QBS/issues/QBS-1849.

Changelog: (Feature): Describe here your pull request
Docs: omitted

  • Refer to the issue that supports this Pull Request.
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.
  • I've opened another PR in the Conan docs repo to the develop branch, documenting this one.

@memsharded memsharded self-assigned this Sep 3, 2025
Copy link
Member

@memsharded memsharded left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution @ABBAPOH

I am a bit confused about reusing the cmake_file_name property, as it is intended for CMake. If the qbs files need to differ from the package name, maybe it would be better to define a qbs_file_name new property? Because there are many cmake_file_name defined out there, that would change the qbs file name, who guarantees that the qbs file name is always aligned with the CMake one? I think it might not be the case, am I missing something?

Comment on lines +175 to +180
def use_cmake_file_name(self):
return self._use_cmake_file_name

@use_cmake_file_name.setter
def use_cmake_file_name(self, value):
self._use_cmake_file_name = value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, probably no need of new setter/getter, and the QBSDeps.set_property() is the way to go

""" Handles a single package, can create multiple modules in case of several components
"""
def __init__(self, conanfile, dep, build_bindirs):
def __init__(self, conanfile, dep, build_bindirs, use_cmake_file_name):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably no need of the new argument, if we are going to use properties, maybe the approach should be similar to CMakeDeps and allow a local QBSDeps.set_property() that can override the upstream property, and also allows defining the property locally. This would be general for any property that the generator might use in the future too.

@ABBAPOH
Copy link
Contributor Author

ABBAPOH commented Sep 3, 2025

I think it might not be the case, am I missing something?

A user specifically asked for usage of cmake_file_name rather than the normal flow (pkg_config_name or dep.ref.name). My understanding is that they relied on cmake_file_name from Conan 1.x JSON generator and ask this feature to ease transition to Conan 2.x. It is indeed quite a daunting task to replace all entries Depends { name: "crashpad" } with Depends { name: "sentry-crashpad" } all over the project.
I am personally not fond of this feature, but I can see the reason - setting a single flag in the generator to use CMake names is much easier than replacing multiple dependencies across the project.

@memsharded
Copy link
Member

I am not sure if I understand.

Conan 1 never used the cmake_file_name in any of the qbs generators, not the legacy qbs one, not in QbsProfile.
The JSON generator didn't serialize properties like cmake_file_name either: https://docs.conan.io/1/reference/generators/json.html. Then, this doesn't make sense from the migration point of view.

And even if that was the case, it is simply too incorrect to depend on a cmake_xxxx property for a qbs generator, unless the Qbs build system explicitly documented some kind of convention over CMake based open source libraries, which doesn't seem the case either.

So this would only make sense as a qbs_file_name property or something like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants