Build is compiling against system include directory when it should be compiling against sub-project include directory

This is a reported issue on MacOS 13.3 Here is the issue on github for more context

My project grok uses another library, highway, using these commands:

set(HWY_ENABLE_EXAMPLES OFF CACHE BOOL "Enable HWY examples")
set(HWY_ENABLE_CONTRIB OFF CACHE BOOL "Enable HWY contrib")
set(HWY_ENABLE_INSTALL OFF CACHE BOOL "Enable HWY install")
set(HWY_FORCE_STATIC_LIBS ON CACHE BOOL "Enable HWY force static libs")
set(INSTALL_GTEST OFF CACHE BOOL "Install GTest")
set(HWY_ENABLE_TESTS OFF CACHE BOOL "Disable tests")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/highway EXCLUDE_FROM_ALL)

and then

target_include_directories(${GROK_CORE_NAME} PRIVATE $<TARGET_PROPERTY:hwy,INTERFACE_INCLUDE_DIRECTORIES>)

However, if an older version of highway is installed via brew install highway,
then compile fails due to usage of installed include directory rather than source include directory for highway. Uninstalling brew highway allows the compile to succeed.

This is not a problem on Linux.

I’ve tried a number of changes, but currently at a loss as to how to fix .

`

target_include_directories(${GROK_CORE_NAME} PRIVATE $<TARGET_PROPERTY:hwy,INTERFACE_INCLUDE_DIRECTORIES>)

Why are you adding the include directory like this?

Just linking the library should be enough.

target_link_libraries(${GROK_CORE_NAME} PRIVATE hwy)

hwy properly makes it’s include directories with the PUBLIC. So linking against the provided target should be sufficient.

Yes, I just added that line to make “extra sure” I was compiling against the source include directory, but it made no difference in fact. Still mystified.

Looks like this was a red herring - issue went away after user deleted and re-configured their build folder.