Xcode just ignore generated files?

I have external project build by script and also this script generates header file.

And this generated file is problem, when it changed (script produced modified file),
then Xcode just ignore this change.

If I change generator to Ninja all works just fine.

The minimum reproducible example looks like this:

cmake_minimum_required(VERSION 3.17 FATAL_ERROR)
project(foo)

add_custom_target(ext_lib_target  
  COMMAND /bin/sh ${CMAKE_SOURCE_DIR}/build_static_lib.sh "${PROJECT_BINARY_DIR}/cpp"
  BYPRODUCTS "${CMAKE_SOURCE_DIR}/rawlib/libmyrawlib.a" "${PROJECT_BINARY_DIR}/cpp/generated_header.hpp"
  DEPENDS ${CMAKE_SOURCE_DIR}/build_static_lib.sh
  WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
)
  
add_library(ext_lib STATIC IMPORTED GLOBAL)
add_dependencies(ext_lib ext_lib_target)
set(HEADERS_OUT_DIR "${PROJECT_BINARY_DIR}")
set_target_properties(ext_lib
  PROPERTIES
  IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/rawlib/libmyrawlib.a"
  IMPORTED_NO_SONAME True
)
set_target_properties(ext_lib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${HEADERS_OUT_DIR}")

add_library(core STATIC core/boo.hpp core/boo.cpp "${PROJECT_BINARY_DIR}/cpp/generated_header.hpp")
target_include_directories(core PUBLIC core)
target_link_libraries(core PUBLIC ext_lib)

add_executable(foo main.cpp)
target_link_libraries(foo PRIVATE core)

where toy build_static_lib.sh looks like this:

#!/bin/sh

set -euo pipefail
cd rawlib && clang -c lib.c -o lib.o && ar crv libmyrawlib.a lib.o
echo "#pragma once\n#include <string>\nstruct Boo {\nstd::string data;\n};\n" > $1/generated_header.hpp

core/boo.hpp includes "${PROJECT_BINARY_DIR}/cpp/generated_header.hpp":

#include "cpp/generated_header.hpp"

and core/boo.cpp includes boo.hpp:

#include "boo.hpp"

but any changes in cpp/generated_header.hpp do not cause rebuild of boo.cpp,
xcodebuild called via cmake --build . -t foo --config Release just ignores this changes.

But change of boo.hpp for example, cause proper rebuild.

May be Xcode doesn’t support generated header files,
or may it doesn’t like header file in ${PROJECT_BINARY_DIR} ?

Full source code:

main.cpp

#include <cstdio>

#include "boo.hpp"

int main() {
  auto v = find_something();  
  printf("f = %zu\n", v.data.size());
}

boo.cpp

#include "boo.hpp"

Boo find_something() {
  Boo ret;
  ret.data = "1234";
  return ret;
}  
#pragma once

#include "cpp/generated_header.hpp"

Boo find_something();

I created issue in cmake’s gitlab https://gitlab.kitware.com/cmake/cmake/-/issues/26173