CMake 3.15 breaks include dependency analysis for Unix Makefiles
As a regression from 3.14.5 to 3.15.0, the Unix Makefile generator fails to recognize includes as build dependencies when they are presented in a specific subdirectory configuration.
Example directory structure:
.
├── CMakeLists.txt
└── liba
├── CMakeLists.txt
└── src
└── a
├── liba.cc
└── liba.h
./CMakeLists.txt:
project(cmaketest)
include_directories("${PROJECT_SOURCE_DIR}/liba/src")
add_subdirectory(liba)
./liba/CMakeLists.txt:
add_library(a src/a/liba.cc src/a/liba.h)
./src/a/liba.h:
int a();
./src/a/liba.cc:
#include "a/liba.h"
int a() {
return 1;
}
CMake 3.14.5 correctly generates depend.make for target a:
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.14
liba/CMakeFiles/a.dir/src/a/liba.o: ../liba/src/a/liba.h
liba/CMakeFiles/a.dir/src/a/liba.o: ../liba/src/a/liba.cc
CMake 3.15.0 misses the include dependency, generating the following depend.make:
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.15
liba/CMakeFiles/a.dir/src/a/liba.o: ../liba/src/a/liba.cc
The test system was Arch Linux on x86_64, with the exact CMake version 3.15.0-1 from the offical repository.
Please find the example attached.
Is there a workaround for this problem in the meantime?