AcademySoftwareFoundation / AcademySoftwareFoundation/openvdb

[BUG] FindOpenVDB.cmake broken for static OpenVDB library and deps

Open
#1,630 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
3.4k
Forks
774
Avg merge
3d 9h
Merged PRs (30d)
34

Description

### Environment
**Operating System:** Windows/Linux
**Version / Commit SHA:** Current master

### Describe the bug
Cmake doesn't allow OpenVDB and deps to be included as static target.

This concerns:
- failure to detect libopenvdb.lib on Windows
- lack of inclusion of other statically-built dependencies in the visible dependencies list

### To Reproduce
In Cmake:
```
set(OPENVDB_USE_STATIC_LIBS ON)
set(BLOSC_USE_STATIC_LIBS ON)
set(ZLIB_USE_STATIC_LIBS ON)
set(Boost_USE_STATIC_LIBS ON)

find_package(OpenVDB REQUIRED)

target_link_libraries(${PROJECT_NAME}
PRIVATE
OpenVDB::openvdb
)
```

### Expected behavior
For a static OpenVDB build:
- On Windows, libopenvdb.lib should be linked to instead of (currently) openvdb.lib
- When including static dependencies, Blosc::blosc, Boost::iostreams and ZLIB::ZLIB should be part of the inherited targets of OpenVDB::openvdb, so the parent project automatically links to their static libraries as well

### Additional context
Solution: https://github.com/kvankooten/openvdb/commit/272085f72d6922b6d14aa54a3d15c3b5f5b5293b

Contributor guide

Open the contributing guide

Research direction

Start with FindOpenVDB.cmake and reproduce the issue using the CMake configuration in the report, including the static-library options. Done means Windows selects libopenvdb.lib and OpenVDB::openvdb exposes Blosc::blosc, Boost::iostreams, and ZLIB::ZLIB as inherited dependencies for static builds.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.