Cmake not handling header files build dependencies if build dir is a subdirectory of PROJECT_SOURCE_DIR?
问题 The accepted answer of this question correctly states that cmake does not handle C++ header-files build dependencies in case cmake's build directory is under cmake's PROJECT_SOURCE_DIR . PROJECT_SOURCE_DIR is assigned its value when the cmake project() macro is used, therefore it would be the "top" directory for such a project structure using project(source) : top | |--CmakeLists.txt |--source |--build As far as I know, this is the typical structure of a cmake project, so I find it surprising