Xcode does not recompile application when dependent headers from imported libraries are modified
Please see below minimal example
project(sample LANGUAGES CXX)
add_library(Foo INTERFACE IMPORTED)
set_target_properties(Foo PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
${CMAKE_SOURCE_DIR}/include)
add_executable(main main.cpp)
target_link_libraries(main PUBLIC Foo)
There's a foo.h
inside ${CMAKE_SOURCE_DIR}/include
and main.cpp
includes foo.h
. After cmake -G Xcode .. && cmake --build .
, if I modify foo.h
to anything and run cmake --build .
again, for some reason Xcode thinks main
is up to date and did not attempt to recompile main
which I believe is clearly a bug. The same exact minimal example behaves correctly if it's make
or ninja
, meaning after cmake .. && cmake --build .
, if I modify foo.h
to anything and run cmake --build .
again, it will recompile main
as expected.