Skip to content

[cmake] Simplify zstd find logic, and support pre-existing zstd target#2390

Open
crueter wants to merge 1 commit intoyhirose:masterfrom
crueter:fix-zstd-already-found
Open

[cmake] Simplify zstd find logic, and support pre-existing zstd target#2390
crueter wants to merge 1 commit intoyhirose:masterfrom
crueter:fix-zstd-already-found

Conversation

@crueter
Copy link
Contributor

@crueter crueter commented Mar 8, 2026

Some deduplication work on the zstd required/if-available logic. Also
adds support for pre-existing zstd::libzstd which is useful for
projects that bundle their own zstd in a way that doesn't get caught by
CONFIG

Signed-off-by: crueter crueter@eden-emu.dev

Some deduplication work on the zstd required/if-available logic. Also
adds support for pre-existing `zstd::libzstd` which is useful for
projects that bundle their own zstd in a way that doesn't get caught by
`CONFIG`

Signed-off-by: crueter <crueter@eden-emu.dev>
@yhirose
Copy link
Owner

yhirose commented Mar 9, 2026

@sum01 @jimmy-park @Tachi107 could you please check the pull request? If it looks good, I'll merge it. Thanks!

Comment on lines +244 to +252
if (HTTPLIB_REQUIRE_ZSTD)
set(HTTPLIB_ZSTD_REQUESTED ON)
set(HTTPLIB_ZSTD_REQUIRED REQUIRED)
elseif (HTTPLIB_USE_ZSTD_IF_AVAILABLE)
set(HTTPLIB_ZSTD_REQUESTED ON)
set(HTTPLIB_ZSTD_REQUIRED QUIET)
endif()

if (HTTPLIB_ZSTD_REQUESTED)
Copy link
Contributor

Choose a reason for hiding this comment

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

You should probably just wrap the whole block in an if(TARGET zstd::libztsd) instead of adding more vars.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you mean? These vars are only used in the case where the target does not already exist.

Copy link
Contributor

Choose a reason for hiding this comment

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

Then wrap it with an if(NOT TARGET zstd::libzstd)

@yhirose
Copy link
Owner

yhirose commented Mar 17, 2026

@crueter any response?

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.

3 participants