lagrange icon indicating copy to clipboard operation
lagrange copied to clipboard

CMake configuration error using (lagrange) assimp with user provided ZLIB

Open FabienPean-Virtonomy opened this issue 7 months ago • 0 comments

If zlib is found prior external/assimp.cmake is included, the line

https://github.com/adobe/lagrange/blob/b3f4080cf039c043d7024a78b0a3e42ea1379dec/cmake/recipes/external/assimp.cmake#L59

will trigger an cmake configuration error (version 3.31.6) because assimp will not create zlib and the commonly named target for zlib is ZLIB::ZLIB.

Minimal reproducing example:

cmake_minimum_required(VERSION 3.31)

if(DEFINED ENV{VCPKG_ROOT})
    set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "")
endif()

project(test_lagrange VERSION 0.1.0 LANGUAGES C CXX)

find_package(ZLIB REQUIRED)

set(LAGRANGE_WITH_ASSIMP ON)
include(FetchContent)
FetchContent_Declare(lagrange GIT_REPOSITORY https://github.com/adobe/lagrange.git GIT_TAG v6.34.0 GIT_SHALLOW TRUE)
FetchContent_MakeAvailable(lagrange)

lagrange_include_modules(io)

Existing workarounds are:

  • Explicitly providing assimp prior including lagrange
  • Fixing the aforementioned line above

Making the fix depends whether the project intends to enable mix and match between system provided and lagrange dependencies, or whether everything should given by the package provider.

FabienPean-Virtonomy avatar Jun 25 '25 09:06 FabienPean-Virtonomy