From 318daf492183d3dcb5cacc4c6fc50d2997fc2399 Mon Sep 17 00:00:00 2001 From: Ruixiang Du Date: Tue, 7 Jul 2026 13:44:42 +0800 Subject: [PATCH] cmake: guard the vendored stb target like googletest Superbuilds that already provide an stb target (xmNavigation vendors the same fork) collide with an unconditional add_subdirectory; reuse the existing target when present, matching the googletest guard. --- third_party/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 57c1e46..8730617 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -5,7 +5,11 @@ endif () add_subdirectory(glad) add_subdirectory(imcore) -add_subdirectory(stb) +if (TARGET stb) + message(STATUS "stb already found, project will use the existing target") +else () + add_subdirectory(stb) +endif () if (BUILD_TESTING) if (TARGET gtest) message(STATUS "GoogleTest already found, project will use the existing target")