From bccfa517a311d8acabea188c5c26e685d46a3c80 Mon Sep 17 00:00:00 2001 From: takaya-murakami-RF Date: Fri, 29 May 2026 19:10:37 +0900 Subject: [PATCH] fix(windows): skip add_library override when using vcpkg toolchain catkin's add_library override (which adds __declspec(dllexport)) conflicts with vcpkg's own add_library override for imported targets, causing infinite recursion in CMake when find_package() creates IMPORTED library targets. Guard with AND NOT VCPKG_TOOLCHAIN so the override only applies to non-vcpkg Windows builds. Co-Authored-By: Claude Sonnet 4.6 --- cmake/platform/windows.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/platform/windows.cmake b/cmake/platform/windows.cmake index ca8d77cd6..2bf5664a9 100644 --- a/cmake/platform/windows.cmake +++ b/cmake/platform/windows.cmake @@ -38,7 +38,7 @@ endif() # pdb's under CATKIN_DEVEL_PREFIX and copies them over at the end # of the cmake build. if(BUILD_SHARED_LIBS) - if(WIN32) + if(WIN32 AND NOT VCPKG_TOOLCHAIN) function(add_library library) # Check if its an external, imported library (e.g. boost libs via cmake module definition) list(FIND ARGN "IMPORTED" FIND_IMPORTED)