Skip to content

building zstd with cmake #4477

@stumbles

Description

@stumbles

I decided to switch to a cmake build because the meson method didn't/doesn't install the various *cmake configuration files.

These are the switches I used to compile it;

`cd build/cmake

export CFLAGS+=' -ffat-lto-objects'
export CXXFLAGS+=' -ffat-lto-objects'

OPTS+=" -DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=/usr
-DCMAKE_INSTALL_LIBDIR=lib
-DZSTD_ZLIB_SUPPORT=ON
-DZSTD_LZ4_SUPPORT=ON
-DZSTD_BUILD_CONTRIB=ON
-DZSTD_BUILD_STATIC=OFF
-DZSTD_BUILD_TESTS=ON
-DBUILD_SHARED_LIBS=ON
-DZSTD_PROGRAMS_LINK_SHARED=ON
-DZSTD_BUILD_DEPRECATED=ON
-Wno-dev"

cmake -B zstd-1.5.7 S . -G Ninja $OPTS &&
cmake --build zstd-1.5.7 &&

cmake --install zstd-1.5.7`

It compiles and installs fine. The issue are the cmake files installed in /usr/lib/cmake/zstd/.

I didn't encounter a problem until compiling qttools-everywhere-src-6.9.2 which fails with zstd detection of shared libs;

`CMake Error at /usr/lib64/cmake/zstd/zstdTargets.cmake:42 (message):
Some (but not all) targets in this export set were already defined.

Targets Defined: zstd::libzstd_shared

Targets not yet defined: zstd::libzstd

Call Stack (most recent call first):
/usr/lib64/cmake/zstd/zstdConfig.cmake:42 (include)
/usr/lib/qt6/cmake/Qt6/FindWrapZSTD.cmake:24 (find_package)
/usr/lib/qt6/cmake/Qt6/QtFindPackageHelpers.cmake:141 (find_package)
src/designer/src/lib/CMakeLists.txt:425 (qt_find_package)
`

I get the same issue trying with qttools-everywhere-src-6.9.1. Prior to this and using the meson build or make makefile there were no problems. In those cases qttools just ignores the absence of any cmake config/helper files and moves on.

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