Skip to content

feat(cmake): find_package(mrdocs) - #1262

Merged
alandefreitas merged 1 commit into
cppalliance:developfrom
alandefreitas:test/cmake-package
Aug 20, 2026
Merged

feat(cmake): find_package(mrdocs)#1262
alandefreitas merged 1 commit into
cppalliance:developfrom
alandefreitas:test/cmake-package

Conversation

@alandefreitas

Copy link
Copy Markdown
Collaborator

find_package(mrdocs) was incorrect and untested. The exported configuration was an old placeholder we never updated, so a consumer find_package(mrdocs) failed. This PR, which took much longer than I predicted, implements this feature so projects can consume mrdocs as an external library to build applications, extensions, and plugins.

Changes

To make the package useful, we had to bundle the private dependencies (LLVM, Clang, JerryScript, Lua) into the mrdocs library. This is so a consumer can link mrdocs without installing the exact toolchain it was built with. Otherwise, extension users would be required to build and install mrdocs and all its dependencies from source.

The change required a reorganization in the src/CMakeLists.txt scripts, as many options were hard-coded and non-idiomatic in ways that don't generalize for an installed package. We remove the old data/cmake/MrDocs.cmake / add_mrdocs() helper, as it was contradictory and hasn't been necessary for the project or maintained for years. It provided no benefit over a regular CMake custom target and had to be kept in sync with the CLI. find_package now sets MRDOCS_EXECUTABLE, making it trivial to create custom targets. We also had to add an option to customize the clang-resource-dir so the installation can remain consistent with the canonical installation directory layout.

We also had to fix small pedantic warnings that emerged when we fixed errors in how we import LLVM.

Testing

We added tests/cmake, a standalone find_package(mrdocs) project that links mrdocs::mrdocs-core into a small program and runs the installed binary over its own source. It is exercised in the regular CI build and the release build.

Documentation

The examples for mrdocs as a library use the actual snippets from the tests that use find_package. The contributing guide is also updated to reflect the changes to the layout.

find_package(mrdocs) was incorrect and untested. The exported configuration was
an old placeholder we never updated, so a consumer find_package(mrdocs) failed. This commit implements this feature so projects can consume mrdocs as an external library to build applications, extensions, and plugins.

To make the package useful, we had to bundle the private dependencies (LLVM, Clang, JerryScript, Lua) into the mrdocs library. This is so a consumer can link mrdocs without installing the exact toolchain it was built with. Otherwise, extension users would be required to build and install mrdocs and all its dependencies from source.

The change required a reorganization in the src/CMakeLists.txt scripts, as many options were hard-coded and non-idiomatic in ways that don't generalize for an installed package. We remove the old data/cmake/MrDocs.cmake / add_mrdocs() helper, as it was contradictory and hasn't been necessary for the project or maintained for years. It provided no benefit over a regular CMake custom target and had to be kept in sync with the CLI. find_package now sets MRDOCS_EXECUTABLE, making it trivial to create custom targets. We also had to add an option to customize the clang-resource-dir so the installation can remain consistent with the canonical installation directory layout.

We added tests/cmake, a standalone find_package(mrdocs) project that links
mrdocs::mrdocs-core into a small program and runs the installed binary over its
own source. It is exercised in the regular CI build and the release build.
@github-actions

Copy link
Copy Markdown

⚠️ Warnings

Warning

Source changed but no tests or fixtures were updated.

🧾 Changes by Scope

Scope Lines Δ% Lines Δ Lines + Lines - Files Δ Files + Files ~ Files ↔ Files -
🛠️ Source 49% 1015 540 475 23 2 20 - 1
🧰 Tooling 20% 419 289 130 7 2 5 - -
📦 Other 9% 195 175 20 8 6 2 - -
🏗️ Build 7% 137 85 52 2 - 2 - -
📄 Docs 6% 129 106 23 6 1 5 - -
📚 Examples 5% 111 75 36 10 - 10 - -
⚙️ CI 4% 82 80 2 3 - 3 - -
Total 100% 2088 1350 738 59 11 47 - 1

Legend: Files + (added), Files ~ (modified), Files ↔ (renamed), Files - (removed)

🔝 Top Files

  • src/CMakeLists.txt (Source): 372 lines Δ (+150 / -222)
  • data/cmake/MrDocs.cmake (Source): 172 lines Δ (+0 / -172)
  • src/mrdocs/Config/ReferenceDirectories.cpp (Source): 133 lines Δ (+133 / -0)

Generated by 🚫 dangerJS against c360c67

@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.12%. Comparing base (faea11b) to head (c360c67).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1262   +/-   ##
========================================
  Coverage    83.12%   83.12%           
========================================
  Files           35       35           
  Lines         3662     3662           
  Branches       844      844           
========================================
  Hits          3044     3044           
  Misses         410      410           
  Partials       208      208           
Flag Coverage Δ
bootstrap 83.12% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://1262.mrdocs.prtest2.cppalliance.org/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-08-20 00:08:44 UTC

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c360c678a4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/mrdocs/Config/ReferenceDirectories.cpp
@alandefreitas
alandefreitas added this pull request to the merge queue Aug 20, 2026
Merged via the queue into cppalliance:develop with commit b68b23c Aug 20, 2026
32 checks passed
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