Cmake not handling header files build dependencies if build dir is a subdirectory of PROJECT_SOURCE_DIR?

一曲冷凌霜 提交于 2020-02-06 07:58:41

问题


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 that cmake does not handle this structure. Instead, such a structure would be required in order to handle the header file build dependencies correctly:

top
|
|--source
   |--CMakeLists.txt
|--build

Is this the expected behavior of cmake? Or is it a bug which should be reported?

来源:https://stackoverflow.com/questions/59949212/cmake-not-handling-header-files-build-dependencies-if-build-dir-is-a-subdirector

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!