glTF-SDK icon indicating copy to clipboard operation
glTF-SDK copied to clipboard

Missing cmake documentation

Open elpie89 opened this issue 3 years ago • 2 comments

I'm trying to build a project that use some library like glm, QT, Vulkan etc. Of course, I'm trying to use glTF-SDK too. I'm struggling a lot because there is no documentation on how to use CMake with glTF-SDK To be more specific CMake through the use of the FetchContent command can act as a package manager. So I'm trying to use it in that way avoiding to use NuGet or vckpg Can someone add an example on how to use this library from CMake in a proper way?

elpie89 avatar Jan 10 '21 10:01 elpie89

I'm not familiar with FetchContent usage and I don't know anyone who has tried it with this repo, but this seems like a cmake question and not something specific to this repo. If you bring the repo as a cmake dependency (e.g. via add_subdirectory), you should be able to include the GLTFSDK target. Would that work for you?

bghgary avatar Jan 11 '21 23:01 bghgary

This worked for me:

# Declare the repo
include(FetchContent)
FetchContent_Declare(
  glTF-SDK
  GIT_REPOSITORY https://github.com/microsoft/glTF-SDK.git
  GIT_TAG        382dea2c80737f9f3ae2b93e97263a593c2ea832 # r1.9.6.0
)

# Populate the library
FetchContent_MakeAvailable(glTF-SDK)

# Link to your target
target_link_libraries(MyTarget GLTFSDK)

santipaprika avatar Feb 27 '23 21:02 santipaprika