Skip to content

fix: portable cmake exports and C++17 compat#92

Merged
transfix merged 1 commit into
masterfrom
fix/cmake-config-portable
May 23, 2026
Merged

fix: portable cmake exports and C++17 compat#92
transfix merged 1 commit into
masterfrom
fix/cmake-config-portable

Conversation

@transfix
Copy link
Copy Markdown
Owner

Summary

Fixes three issues that prevent downstream consumers (e.g. TexMol) from using the prebuilt libcvc SDK archives:

1. C++17 compatibility

  • Replace std::format with std::to_string / snprintf in rawiv_io.cpp and vtk_io.cpp
  • Add missing #include <stdexcept> in state_chunked_blob.cpp
  • libcvc now compiles cleanly under both C++17 and C++20

2. Portable cmake exports (no more hard-coded paths)

  • Boost: Link via Boost::thread, Boost::filesystem, etc. instead of raw ${Boost_LIBRARIES}
  • ImageMagick: Prefer ImageMagick::Magick++ / ImageMagick::MagickCore imported targets
  • FFTW: Add IMPORTED_TARGET to pkg_check_modules, prefer PkgConfig::FFTW3 target

3. Graceful optional dependencies in cvcConfig.cmake

  • Switch optional find_dependency() calls to find_package(... QUIET) — consumers don't fail if CGAL, CUDA, ImageMagick, etc. aren't installed
  • Add find_package(libiimod) for IMOD MRC support
  • Create synthetic PkgConfig::FFTW3 imported target when pkg-config isn't available

Testing

  • Full local build passes with both C++17 and C++20
  • Exported cvc::cvc target uses only imported targets (no /usr/lib/... paths)
  • cvcConfig.cmake loads successfully even when optional deps are absent

After merge

Re-tag v3.2.4 with these fixes so TexMol CI can consume the prebuilt SDK.

1. Replace std::format with C++17-compatible alternatives
   - rawiv_io.cpp: std::to_string concatenation
   - vtk_io.cpp: snprintf
   - state_chunked_blob.cpp: add missing <stdexcept> include

2. Make cvcConfig.cmake.in tolerate missing optional deps
   - Switch optional find_dependency() calls to find_package(... QUIET)
     so consumers don't fail if CGAL/CUDA/ImageMagick/etc. aren't
     installed — only the features that use them are affected
   - Add find_package(libiimod) for IMOD MRC support
   - Create synthetic PkgConfig::FFTW3 imported target in fallback path

3. Use imported targets in exported cvc::cvc link interface
   - Boost: link Boost::thread/date_time/regex/filesystem instead of
     raw library paths from ${Boost_LIBRARIES}
   - ImageMagick: prefer ImageMagick::Magick++/MagickCore targets
   - FFTW: add IMPORTED_TARGET to pkg_check_modules, prefer
     PkgConfig::FFTW3 target over raw ${FFTW3_LIBRARIES}

These changes make the prebuilt SDK archives portable across systems:
consumers no longer see hard-coded /usr/lib/... paths or fatal errors
from missing optional dependencies.
@transfix transfix force-pushed the fix/cmake-config-portable branch from 7204147 to 94f57c6 Compare May 23, 2026 19:38
@transfix transfix merged commit b836766 into master May 23, 2026
14 checks passed
@transfix transfix deleted the fix/cmake-config-portable branch May 23, 2026 20:37
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.

1 participant