Include directories that come from targets linked to the target in question). In the case that the question is referring to some IDEs' sense of the word "project", which CMake calls "targets", header files are external to a project would be those that aren't intended to be accessed through any of the include directories of a target (Ex. If you had to given such a phrase a meaning, here's what would make sense to me: Visual Studio, and possibly Code::Blocks). What CMake refers to as a target sometimes translates to what IDEs call projects (Ix. Each project can contain multiple targets (libraries, executables, etc.). Each buildsystem generated by CMake consists of one top-level project, possibly including other external or subdirectory projects. Also note that the word "project" is a quite overloaded term. I have not seen that phrase used in documentation. It therefore seems to me that CMake consider those headers to be external to the project, and does not track them in the dependsĪs far as I know, there is no official or useful definition of "external header" when it comes to CMake. I realized recently that the issue seemed to be that CMake considered those header files to be external to the project. What is an "external" header in CMake? (no such thing) How CMake configures the Code::Blocks IDE is a completely separate story. TL DR CMake and Makefiles have their own way of tracking header dependencies given include directories and source files. This question is vexing, as it is motivated by a specific behaviour of a specific IDE- Code::Blocks) and CMake, but then poses a question unrelated to that IDE and instead about Makefiles and CMake, assuming that they have done something wrong with CMake which led to a problem with Makefiles, which led to a problem with their IDE. In all the answers to this question, there is a whole lot of "how" (to get what you want), and precious little "why" (digging into the problem that motivated the question and what the asker may have misunderstood about the ways in which different types of tools like IDEs and build tools do / do not interact and share information with each other, and what information CMake passes / needs to pass to those tools). Where with "seems" I mean that, CMake could detect such header-files automatically if it wanted, because it parses project's C/C++ files anyway. First add the directory to be included: target_include_directories(test PRIVATE $)
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |