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

Add property to change the CMake variable names generated with CMakeDeps #16231

Conversation

juansblanco
Copy link
Contributor

@juansblanco juansblanco commented May 9, 2024

Changelog: Feature: Add cmake_additional_variables_prefixes variable to CMakeDeps generator to allow adding extra names for declared CMake variables.
Docs: conan-io/docs#3721

Created new property for CMakeDeps generator: cmake_legacy_variable_prefix that can be set in package_info() of the conanfile.
It allows changing the prefix used when creating CMake variables instead of the package name that was currently being used.

Closes: #14788

  • 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.

@juansblanco juansblanco requested a review from czoido May 9, 2024 12:29
@juansblanco juansblanco removed the request for review from czoido May 9, 2024 12:29
@juansblanco juansblanco added this to the 2.4.0 milestone May 9, 2024
@juansblanco juansblanco marked this pull request as ready for review May 9, 2024 17:15
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.

I think what we want is the possibility of having multiple variants of the variables, besides the canonical file_name one, the current one. It should be a list that allows different casing/writing of the variable, not just one.

Copy link
Contributor

@czoido czoido left a comment

Choose a reason for hiding this comment

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

Good job

@valgur
Copy link
Contributor

valgur commented May 13, 2024

Just wanted to say thanks for adding this feature. The simple difference in capitalization of variable prefixes has been by far the most common reason for having to apply patches to public CMake projects on CCI. Also the most common reason for having to include custom CMake modules in the recipe. Two birds with one stone. Thanks!

@memsharded memsharded merged commit 485adbf into conan-io:develop2 May 14, 2024
2 checks passed
memsharded pushed a commit to memsharded/conan that referenced this pull request May 14, 2024
…eps (conan-io#16231)

* add legacy variable prefix for cmakedeps

* fix implementation

* improve template variables

* simplify code

* improve test

* add support for multiple cmake variable names and simplify test

* improve code
memsharded added a commit that referenced this pull request May 16, 2024
* options patterns warning

* Add property to change the CMake variable names generated with CMakeDeps (#16231)

* add legacy variable prefix for cmakedeps

* fix implementation

* improve template variables

* simplify code

* improve test

* add support for multiple cmake variable names and simplify test

* improve code

* Add GCC 13.3 (#16245)

* review

* fix test

* wip

---------

Co-authored-by: Juan <35701596+juansblanco@users.noreply.github.com>
Co-authored-by: Rubén Rincón Blanco <rubenrb@jfrog.com>
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.

[feature] CMakeDeps generates incorrect CMake variables
5 participants