Skip to content

CMake install does not reliably install shared library and C++ headers in standard include path #450

@piotrekoo

Description

@piotrekoo

While packaging lib3mf for Homebrew we noticed install layout issues with this configuration:

cmake -S . -B build \
  -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
  -DUSE_INCLUDED_ZLIB=OFF \
  -DUSE_INCLUDED_LIBZIP=OFF \
  -DUSE_INCLUDED_SSL=OFF \
  -DLIB3MF_TESTS=OFF
cmake --build build
cmake --install build --prefix <prefix>

Observed:

  1. In some builds, Homebrew cannot rely on the shared library being installed by upstream install rules and needs a fallback copy from build artifacts.
  2. C++ public headers are not available in the standard top-level include path expected by downstream consumers, so Homebrew needs to copy *.hpp manually.

Current Homebrew workaround:

dylibs = Dir["build/**/lib3mf*.{dylib,so}*"]
lib.install dylibs if dylibs.any?
include.install Dir["#{include}/Bindings/Cpp/*.hpp"]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions