From f5767b3c727ef92aed91ff7567193181e89d76a7 Mon Sep 17 00:00:00 2001 From: he-yulong <1183851628@qq.com> Date: Sun, 29 Dec 2024 15:16:28 +1100 Subject: [PATCH] Fix CMake build error on Windows 10 by exporting zlibstatic alongside Ptex_static. * Adds a post-configuration step that explicitly installs `zlibstatic` into the `Ptex` export set. * Prevents "target not in any export set" errors during the installation stage. * Leaves the existing Ptex submodule files unmodified, preserving upstream compatibility. * Verified on Windows 10 with Visual Studio 2022. --- CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c6a50166..4922ee93d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1032,6 +1032,17 @@ add_sanitizers (nanovdb2pbrt) set_property (TARGET nanovdb2pbrt PROPERTY FOLDER "cmd") +# Only do this if both targets actually exist +if (TARGET Ptex_static AND TARGET zlibstatic) + install( + TARGETS zlibstatic + EXPORT Ptex # Same export set name as used by Ptex + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + ) +endif() + ###################### # cyhair2pbrt