This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Provide Findzstd module
AbandonedPublic

Authored by mgorny on Oct 4 2022, 6:06 AM.

Details

Summary

This module is used to find the system zstd library. The imported
targets intentionally use the same name as the generated zstd config
CMake file so these can be used interchangeably.

Based on earlier work of Petr Hosek. The support for pkg-config is
inspired by FindLibEdit.cmake.

Diff Detail

Event Timeline

mgorny created this revision.Oct 4 2022, 6:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 4 2022, 6:06 AM
Herald added a subscriber: StephenFan. · View Herald Transcript
mgorny requested review of this revision.Oct 4 2022, 6:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 4 2022, 6:06 AM

Changes from D134990:

  • fixed variable names to be lowercase, to match what LLVM expects
  • added support for pkg-config, to provide directory hints
  • added support for finding the static library as well when find_library() returns the shared library

If zstdConfig.cmake from zstd itself is available, does this still work?

If zstdConfig.cmake from zstd itself is available, does this still work?

No clue. Any chance you could test this, please?

MaskRay accepted this revision.Oct 4 2022, 11:22 AM

It works. Checked with -DLLVM_TARGETS_TO_BUILD='X86' -DLLVM_ENABLE_ZSTD=FORCE_ON -DCMAKE_PREFIX_PATH=/tmp/opt/zstd

This revision is now accepted and ready to land.Oct 4 2022, 11:22 AM

This isn't going to work on Windows which uses a different naming scheme, see also D134990#3834272.

This isn't going to work on Windows which uses a different naming scheme, see also D134990#3834272.

Is this actually a regression, i.e. does the existing CMake support stop working on Windows?

mgorny abandoned this revision.Oct 6 2022, 8:06 AM