I do not think it is just the OVERRIDE_FIND_PACKAGE
If commoncompilerWarnings comes via cmake, its exactly the same
say I have a library sl3, that consumes commonCompilerWarnings like this
target_link_libraries(sl3
PRIVATE
a4z::commonCompilerWarnings
)
that’s what can be found in libsl3Targets.cmake
set_target_properties(a4z::sl3 PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:a4z::commonCompilerWarnings>;/Applications/Xcode-16.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk/usr/lib/libsqlite3.tbd"
)
that at least can work when the dependency is either available via cmake, or sl3 install calls the install of commonCompilerWarnings and commonCompilerWarnings cmake files are also there.
$<BUILD_INTERFACE or $<BUILD_LOCAL_INTERFACE … can not be used at all if the library comes via fetch_content of vcpkg (like it would be in the system), since this adds something to the linker line -la4z::commonCompilerWarnings
That’s all very surprising, unexpected, and not optimal.
PS: and I tried with OVERRIDE_FIND_PACKAGE, FetchContent_MakeAvailable and other variations, did not change anything dramatic