2

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?

Étienne
  • 4,773
  • 2
  • 33
  • 58

0 Answers0