From ed5dee857efb0ebad6ac108c0cb48f6cf97860f7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 10 May 2023 16:19:53 +1000 Subject: [PATCH] Fix blender failing to link WITH_USD when building for the first time Blender would fail to link to USD before MaterialX files were copied to the install targets lib/ directory. Resolve by including ${LIBDIR}/materialx/lib in link_directories. --- source/creator/CMakeLists.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 05df743c453..9c3df3438b4 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -75,6 +75,18 @@ if(WITH_TBB) endif() endif() +if(WITH_USD) + # USD links libMaterialX, when using pre-compiled libraries + # ensures `usd_ms` can find `MaterialXRender` and friends. + # + # NOTE: This is _only_ needed when linking blender before the install target runs. + # Once MATERIALX libraries have been copied into `TARGETDIR_LIB` then Blender will link. + # Don't rely on this though as failing on a fresh build is no good and the library + # files could get outdated too. + if(DEFINED LIBDIR) + link_directories(${LIBDIR}/materialx/lib) + endif() +endif() if(WITH_PYTHON) list(APPEND INC ../blender/python)