Open
Conversation
Remove FetchContent for cnats and use find_package(cnats CONFIG) instead. Add proper install() rules and CMake package config so qtnats can be consumed as a vcpkg overlay port. Update includes for cnats v3.10.1 (<nats/nats.h>) and replace private opts.h constants with hardcoded values. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Allow qtnats to build both with vcpkg (where cnats is pre-installed and found via find_package) and without vcpkg (where cnats is automatically fetched via FetchContent). The target name difference between the two paths (cnats::nats_static vs nats_static) is handled via a CNATS_TARGET variable. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1b75f55 to
05f9ec0
Compare
Collaborator
|
Can we test this with Mordor? I assume it works, but we should check |
Collaborator
|
Doesn't seem terribly happy: |
cnats's CMakeLists.txt exports nats_static into multiple export sets, causing a CMake error when qtnats's install(EXPORT) references it as a dependency. Fix by using EXCLUDE_FROM_ALL to suppress cnats's install rules and skipping qtnats install/export when cnats is fetched, since FetchContent consumers use add_subdirectory and don't need install targets. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
|
Still grumpy: |
Collaborator
Author
|
I think the latter may be a caching issue. I had to go to great pains to
get this building on PreForm after making this modification. I'll spin up
my mordor devcontainer and update you when I finish sorting it out.
…On Thu, Feb 26, 2026 at 1:35 PM Jonathan Edelman ***@***.***> wrote:
*edelmanjm* left a comment (Formlabs/qtnats#5)
<#5 (comment)>
Still grumpy:
In file included from /tmp/tmp.NwE9fOfpzK/task_apps/cmake-build-debug-ursula-native/_deps/qtnats-src/src/qtnats/jetstream.cpp:7:
/tmp/tmp.NwE9fOfpzK/task_apps/cmake-build-debug-ursula-native/_deps/qtnats-src/src/qtnats/qtnats.h:21:10: fatal error: nats/nats.h: No such file or directory
21 | #include <nats/nats.h>
| ^~~~~~~~~~~~~
compilation terminated.
—
Reply to this email directly, view it on GitHub
<#5 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AITB7BJ4W22KWTTLVVXGZUD4N44G7AVCNFSM6AAAAACV7X7YTKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTSNRYGQ3DMMJQHA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Downgrade FetchContent fallback from cnats v3.10.1 to v3.3.0 with updated SHA256 hash. Add a wrapper header shim so that #include <nats/nats.h> resolves correctly under both vcpkg (where headers install to include/nats/) and FetchContent (where the build interface exposes headers directly in src/). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
find_package(cnats CONFIG QUIET)first — works when cnats is pre-installed (e.g. via vcpkg)FetchContentwith SHA256-verified tarball download of cnats v3.10.1 when not foundcnats::nats_staticfrom vcpkg vsnats_staticfrom FetchContent) via aCNATS_TARGETvariablevcpkg-cmake-install-targetsbranchContext
Some Formlabs consumers of qtnats use vcpkg (where cnats is a port), while others don't have vcpkg and need cnats fetched automatically. This change makes qtnats work in both environments with a single CMakeLists.txt.
Test plan
find_packagepath)