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

Respect Skipping CMake Formatting Based on Setting in Top Level Project #35

Open
DeveloperPaul123 opened this issue Jul 5, 2023 · 3 comments

Comments

@DeveloperPaul123
Copy link
Contributor

DeveloperPaul123 commented Jul 5, 2023

I'm not sure how this would work, or if it's technically feasible, but I'm going to describe my issue through a hypothetical project.

Let's assume we have projects A and B. Project A depends on project B and pulls it in with CPM.

Both projects use Format.cmake; project A does not allow Cmake formatting, but project B does have that enabled.

Right now, when running "check-format" from project A, it will always fail because Format.cmake thinks that the CMakeLists files need to be formated even though FORMAT_SKIP_CMAKE is set to YES in project A.

Is there any way to work around this?

@DeveloperPaul123
Copy link
Contributor Author

Just realized that one option is to just use check-clang-format in project A instead of check-format 🤦‍♂️

@TheLartians
Copy link
Owner

Currently I don't think per-project formatting rules are supported.

The recommended usage is to add Format.cmake not as a direct dependency of B but as a dependency of a subproject, e.g. the test suite. That way the dependency will not be included by default, but only when explicitly building the test cases. You can see an example of this in the ModernCppStarter.

@DeveloperPaul123
Copy link
Contributor Author

Ok no problem, we can work around this for now.

And yes, I've seen that strategy already in your ModernCppStarter, but the issue would still remain if we want to disable CMake formatting in a downstream project if it's enabled upstream.

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

No branches or pull requests

2 participants