Skip to content

[beman-tidy] Implement cmake.config check - #341

Draft
neatudarius wants to merge 5 commits into
bemanproject:mainfrom
neatudarius:implement/issue-292-cmake-config
Draft

neatudarius wants to merge 5 commits into
bemanproject:mainfrom
neatudarius:implement/issue-292-cmake-config

Conversation

@neatudarius

@neatudarius neatudarius commented Jul 15, 2026 •

Copy link
Copy Markdown
Member

Implements the check() (dry-run) part of #292. fix() stays log-only, like the other cmake.* checks.

@neatudarius
neatudarius force-pushed the implement/issue-292-cmake-config branch 2 times, most recently from d0c75b5 to 46511c7 Compare July 15, 2026 23:58
@neatudarius
neatudarius requested a review from Copilot July 16, 2026 00:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds the new cmake.config Beman Standard check to validate that a project’s CMakeLists.txt contains a beman_install_library() call referencing the library name, and introduces tests/fixtures to exercise the new behavior.

Changes:

  • Implement CMakeConfigCheck and register it as cmake.config.
  • Add pytest coverage for valid/invalid cmake.config scenarios.
  • Add an invalid CMakeLists fixture missing the beman_install_library() call.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
beman_tidy/lib/checks/beman_standard/cmake.py Adds the cmake.config check implementation and a stub fix() method.
tests/lib/checks/beman_standard/cmake/test_cmake.py Adds new tests for cmake.config (valid/invalid) and a skipped fix-inplace test.
tests/lib/checks/beman_standard/cmake/data/invalid/invalid-config-v1.txt Adds an invalid CMake fixture missing beman_install_library().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +316 to +320
def fix(self):
self.log(
"Please update the CMakeLists.txt file so that it calls beman_install_library() with the library name. "
"See https://github.com/bemanproject/beman/blob/main/docs/beman_standard.md#cmakeconfig for more information."
)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not changed: fix() stays log-only, like the other cmake.* checks. Generating install logic in a project's CMakeLists.txt automatically is too invasive. Updated the description to say this PR covers the dry-run check of #292.

@neatudarius
neatudarius force-pushed the implement/issue-292-cmake-config branch 6 times, most recently from f5d2eff to 2587255 Compare July 16, 2026 06:37
@neatudarius
neatudarius force-pushed the implement/issue-292-cmake-config branch from 2587255 to 5ae30d0 Compare July 16, 2026 06:42
…make-config

# Conflicts:
#	tests/lib/checks/beman_standard/cmake/test_cmake.py
…ig package

Resolve ${PROJECT_NAME} and simple set() variables in beman_install_library(), match the name exactly, and accept install(EXPORT ... NAMESPACE beman::) plus an installed <library_name>-config.cmake.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment on lines +383 to +385
commands = [
item for item in self.get_cmake_parse_raw() if isinstance(item, Command)
]
commands = [
item for item in self.get_cmake_parse_raw() if isinstance(item, Command)
]
variables = self._collect_variables(commands)
variables[command.args[0].value] = command.args[1].value
return variables

def _resolve(self, value, variables):
Comment on lines +461 to +462
if keyword.upper() == "NAMESPACE" and value == "beman::":
exports_beman_namespace = True
beman_install_library() must list the library target and keep the beman:: namespace; a hand-written package must also set EXPORT_NAME and use beman:: on the library's export set. Resolve list and CACHE/PARENT_SCOPE set() values.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants