Skip to content

Conversation

Andrej730
Copy link

@Andrej730 Andrej730 commented Sep 19, 2025

Original problem I've met - on Windows configuring project that has find_package(RocksDB REQUIRED CONFIG) with

cmake .. -DCMAKE_PREFIX_PATH=L:\Software\usr\rocksdb-9.11.2;L:\Software\usr\zstd-1.5.7

resulted in

CMake Error at L:/Software/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.31/Modules/FindPackageHandleStandardArgs.cmake:233 (message):
  Could NOT find zstd (missing: ZSTD_LIBRARIES)
Call Stack (most recent call first):
  L:/Software/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.31/Modules/FindPackageHandleStandardArgs.cmake:603 (_FPHSA_FAILURE_MESSAGE)
  L:/Software/usr/rocksdb-9.11.2/lib/cmake/rocksdb/modules/Findzstd.cmake:17 (find_package_handle_standard_args)
  L:/Software/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.31/Modules/CMakeFindDependencyMacro.cmake:78 (find_package)
  L:/Software/usr/rocksdb-9.11.2/lib/cmake/rocksdb/RocksDBConfig.cmake:66 (find_dependency)
  CMakeLists.txt:6 (find_package)

Investigating I've found two issues and fixed in this PR:

  • static library on zstd is using different name - zstd_static, which wasn't considered in Findzstd.cmake.
    https://github.com/facebook/zstd/blob/d190b3886305f0fb894cd648da6a6d9ecda56f64/build/cmake/lib/CMakeLists.txt#L197-L202
  • zstd config packages (meaning zstd that has zstdconfig.cmake to locate headers and libraries automatically) were not supported. Since it's more modern way to include packages in cmake, it makes sense to check for them first and then fallback to good old modules.
    I've used find_package(zstd CONFIG QUIET), unlike i.e find_dependency(Snappy CONFIG) used for other dependencies, otherwise if RocksDB is REQUIRED then REQUIRED status is propagated by find_dependency and it would fail on trying to locate CONFIG and would never get to module.

@xingbowang can you please take a look?

Copy link

meta-cla bot commented Sep 19, 2025

Hi @Andrej730!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@Andrej730
Copy link
Author

Signed CLA, seems to be pending.

@Andrej730 Andrej730 changed the title CMake - improve support find zstd packages CMake - improve locating zstd packages Sep 19, 2025
Copy link

meta-cla bot commented Sep 19, 2025

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla bot added the CLA Signed label Sep 19, 2025
Andrej730 added a commit to IfcOpenShell/IfcOpenShell that referenced this pull request Sep 19, 2025
@Andrej730 Andrej730 changed the title CMake - improve locating zstd packages rocksdbconfig.cmake - improve locating zstd packages Sep 20, 2025
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.

1 participant