<div dir="ltr"><div class="gmail_default" style="font-family:courier new,monospace">The target_link_libraries() directive is adequate for this job when the header files for the library are simply referred to with no directory prefix, i.e. #include "some file.h" instead of #include "my lib/somefile.h".  Referencing the library with target_link_libraries() appears to automatically add the necessary source directories of the mentioned libraries to the include paths.</div><div class="gmail_default" style="font-family:courier new,monospace"><br></div><div class="gmail_default" style="font-family:courier new,monospace"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 2, 2014 at 4:00 PM, Chris Johnson <span dir="ltr"><<a href="mailto:cxjohnson@gmail.com" target="_blank">cxjohnson@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:courier new,monospace">Yes, by adding another directory between my top-level ./src/ directory and ./mylib, I can cause the example to fail.  I understand now that the include_directory() directive really has no hidden intelligence to it at all, as I had mistakenly believed.  It's just a path.</div><div class="gmail_default" style="font-family:courier new,monospace"><br></div><div class="gmail_default" style="font-family:courier new,monospace">However, I don't really want to have to go around to all my executables and add a bunch of relative paths based on which libraries they use, and where they are located in the tree.</div><div class="gmail_default" style="font-family:courier new,monospace"><br></div><div class="gmail_default" style="font-family:courier new,monospace">Is there some way that I can instead do something like force the install of the libraries to happen before the build of the programs which depend upon them?</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 2, 2014 at 3:53 PM, Chris Johnson <span dir="ltr"><<a href="mailto:cxjohnson@gmail.com" target="_blank">cxjohnson@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:courier new,monospace">Well, this fixed my example.  But my real project still fails the same way.  It is, of course, much more complex and the library directories are often several layers down in subdirectory trees.  :-(</div></div><div class="gmail_extra"><br><div class="gmail_quote"><span>On Tue, Dec 2, 2014 at 2:05 PM, Chris Johnson <span dir="ltr"><<a href="mailto:cxjohnson@gmail.com" target="_blank">cxjohnson@gmail.com</a>></span> wrote:<br></span><div><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:'courier new',monospace">I'm using Make as my build tool.  Here's the failing compile line with the -I paths.  Indeed, they're not quite correct.  This is with the suggested include_directories() directive. </div><div class="gmail_default" style="font-family:'courier new',monospace"><br></div><div class="gmail_default" style="font-family:'courier new',monospace"><span><div class="gmail_default">[100%] Building CXX object prog/CMakeFiles/prog.dir/prog.cpp.o</div></span><div class="gmail_default">cd /sandbox/src/.build/prog && /usr/bin/c++    -I/sandbox/include -I/sandbox/src/src -I/sandbox/src/mylib    -o CMakeFiles/prog.dir/prog.cpp.o -c /sandbox/src/prog/prog.cpp</div><div class="gmail_default"><br></div><div class="gmail_default">Since the ../src/src path is wrong, I tried changing to include_directories(${CMAKE_SOURCE_DIR}) and that seems to work.  That seems to imply the top-level source is not part of the default include path, correct?</div><div class="gmail_default"><br></div><div class="gmail_default">Thanks,</div><div class="gmail_default">..chris</div><div class="gmail_default"><br></div></div><span><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 2, 2014 at 1:10 PM, Bill Hoffman <span dir="ltr"><<a href="mailto:bill.hoffman@kitware.com" target="_blank">bill.hoffman@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On 12/2/2014 1:04 PM, Chris Johnson wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Adding this directive does not seem to change the results at all,<br>
actually.  Am I missing something?​<br>
<br>
</blockquote>
<br></span>
What build tool are you using?  Can you show a verbose compile line? Then check the -I paths.  make VERBOSE=1 will do it for make.<span><font color="#888888"><br>
<br>
-Bill</font></span><div><div><br></div></div></blockquote></div></div></span></div>
</blockquote></div></div></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>