# Build lib3mf

# The GitHub release (tag) we want to use
SET(LIB3MF_TAG v2.1.1)

SET(LIB3MF_PREFIX lib3mf)

SET(LIB3MF_URL https://github.com/3MFConsortium/lib3mf)

# Configure lib3mf
SET(LIB3MF_TESTS OFF CACHE INTERNAL "")
SET(BUILD_SHARED_LIBS ON CACHE INTERNAL "")

# Add lib3mf
FETCHCONTENT_DECLARE(
  ${LIB3MF_PREFIX}
  PREFIX ${LIB3MF_PREFIX}
  GIT_REPOSITORY ${LIB3MF_URL}
  GIT_TAG ${LIB3MF_TAG}
)

FETCHCONTENT_GETPROPERTIES(${LIB3MF_PREFIX})

IF(NOT ${LIB3MF_PREFIX}_POPULATED)
  FETCHCONTENT_POPULATE(${LIB3MF_PREFIX})
  ADD_SUBDIRECTORY(${${LIB3MF_PREFIX}_SOURCE_DIR} ${${LIB3MF_PREFIX}_BINARY_DIR})
ENDIF()
