AcademySoftwareFoundation / openvdb

OpenVDB - Sparse volume data structure and tools
http://www.openvdb.org/
Apache License 2.0
2.71k stars 660 forks source link

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

Open kvankooten opened 1 year ago

kvankooten commented 1 year ago

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:

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:

Additional context

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

mwestphal commented 10 months ago

Here are the two patches I'm using to work around this issue:

https://github.com/mwestphal/f3d-superbuild/blob/adding_openvdb/projects/patches/openvdb-fix-visible-dependencies-link.patch

https://github.com/mwestphal/f3d-superbuild/blob/adding_openvdb/projects/patches/openvdb-remove-lib-prefix-static.patch

archive to dl: openvdb.zip