From 6227ddf5dfd295d9f078715549ff35efbadd75a6 Mon Sep 17 00:00:00 2001 From: portersky <24420859+portersky@users.noreply.github.com> Date: Sun, 10 May 2026 01:38:49 +0200 Subject: [PATCH] fix: clear Unity INTERFACE_SYSTEM_INCLUDE_DIRECTORIES Unity sets INTERFACE_SYSTEM_INCLUDE_DIRECTORIES to a path inside the build tree, which CMake rejects on newer versions. Clear it after FetchContent; the path remains in INTERFACE_INCLUDE_DIRECTORIES. --- deps/FindUnity.cmake | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/deps/FindUnity.cmake b/deps/FindUnity.cmake index b14ba5e..6d3edb5 100644 --- a/deps/FindUnity.cmake +++ b/deps/FindUnity.cmake @@ -36,6 +36,13 @@ FetchContent_Declare( FetchContent_MakeAvailable(unity) +# Unity sets INTERFACE_SYSTEM_INCLUDE_DIRECTORIES to a path inside the build +# tree, which CMake rejects on newer versions. The path stays in +# INTERFACE_INCLUDE_DIRECTORIES so headers are still found. +if (TARGET unity) + set_target_properties(unity PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "") +endif() + if (NOT TARGET Unity::Unity) if (TARGET unity) add_library(Unity::Unity ALIAS unity) @@ -49,11 +56,6 @@ set(Unity_LIBRARIES Unity::Unity) set(Unity_VERSION "${UNITY_VERSION}") set(Unity_INCLUDE_DIR "${unity_SOURCE_DIR}/src") -if (Unity_INCLUDE_DIR AND TARGET unity) - set_target_properties(unity PROPERTIES - INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${Unity_INCLUDE_DIR}" - ) -endif() if (TARGET unity) target_compile_definitions(unity PUBLIC