<div dir="ltr">Hi,<div><br></div><div>t<font face="arial, helvetica, sans-serif">his is my second attempt on the topic. As I could not make myself any clearer I re-post a question by <span style="color:rgb(0,0,0)">William Deurwaarder</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,0,0)">on </span><span style="color:rgb(106,106,106)">Apr 11, 2014.</span></font></div>
<div><br></div><div>Thanks,</div><div>Dirk Steenpass</div><div><br></div><div>-----------------------------------------------------</div><div><span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">Summary: What is the reason that custom-targets that are needed by a project and its dependencies are not added to the default-build in Visual Studio in case that target is defined out-side the sub-directory tree of this project? </span><br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">
<br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">I have the following directory-structure: </span><br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">
<br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">root/A -> in this CMakeLists.txt a custom-target is defined </span><br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">
<span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">root/B -> in this CMakeLists.txt a static-library is defined which depends on A (A will generate files for this library) </span><br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">
<span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">root/C -> in this CMakeLists.txt the executable is defined which depends on B (there is no dependency added for A; of course that could be done in this case but my real case is much more complex and I do not want to explicit lists all custom-target dependencies here) </span><br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">
<span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">root -> in this CMakeLists.txt all three sub-directories are added. </span><br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">
<br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">The real case is much more complex and I cannot add A under C, or put C in the root, etc. </span><br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">
<br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">With Linux and make this works fine. For Windows and Visual Studio the solution-file of C (in directory of C) does not add A to the default-build (although it is added as a dependency for B). This means that A is not executed which results in compiler-errors as B misses files that should have been generated by A.</span><br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">
<br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">Looking into the code I see that the line to add A to the default-build (IsPartOfDefaultBuild) is conditional for UTILITY-targets (it is only added if there is a direct dependency that means or is part of the sub-directory of C or has a direct dependency which is added by add_dependencies). My question is what is the reason to exclude A from the default-build in case it has a transitive dependency (via B)? Would it be possible to change that so in case A is needed via a transitive dependency A is also included to the default-build. </span><br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">
<br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">Thanks for your insight and answers, </span><br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">
<br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px"><span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">William Deurwaarder</span><br>
<br>
</div></div>