If the library you are trying to build is one that is totally under your control then really it should be a subdirectory of your MY_APP source tree so that you can call add_subdirectory() on it. If MY_LIB is shared across multiple projects then you can always arrange for it to appear as a subdirectory of MY_APP when you check the code out from your revision control system. We do this with cvs modules but I'm sure that git and mercurial have similar capabilities.<br>
<br>If you still can't get MY_LIB to be a subdirectory of MY_APP then you might be able to build it using add_directory with the second argument:<br><br>add_subdirectory(${LIB_SRC} mylib)<br><br>I haven't used add_subdirectory like that myself but it appears from the docs that it might do what you want.<br>
<br>--<br>Glenn<br><br><div class="gmail_quote">On 17 June 2011 11:03, David Springate <span dir="ltr"><<a href="mailto:david.springate@gmail.com">david.springate@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Thanks for that helpful summary Jacob - and indeed you are correct I was getting very confused (overtime is getting to me!) and forgetting of course cmake doesn't actually *build* the product - but I do want it to generate the makefiles that the project is dependant on, as you outlined.<br>
<br>Now, my setup is basically as you outlined in your example - except that the library is not located in a subdirectory of the main_tree.<br>I have an environment variable (let's call it LIB_SRC) that contains the path to the root of my library source.<br>
<br>How can I inform the app's CMakeLists.txt file that the lib source is located at LIB_SRC so that the 'target_link_libraries(MY_APP MY_LIB)' call doesn't fail?<br>I'm guessing that add_subdirectory isn't ideal in this case..<br>
</blockquote></div>