<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I don't see any good reason, why should cmake call itself in another
build directory?<br>
<br>
If the library is part of the project, than it is added with
add_subdirectory in the main CMakeLists.txt file.<br>
If the library is not part of the project, it has to be maintained from
outside.<br>
<br>
Am I missing something?<br>
<br>
Andreas<br>
<br>
Am 17.06.2011 11:40, schrieb David Springate:
<blockquote
 cite="mid:BANLkTi=tvh5P8O3CeO1gq6Dd5Eh9qnbcFw@mail.gmail.com"
 type="cite">Hi Andreas,<br>
  <br>
Thanks for another reply!<br>
  <br>
My question therefore is:<br>
How can the cmake for MY_APP start the cmake for MY_LIB?<br>
  <br>
I know how to get my app to link a library, and how to add the include
directories for the lib - so that the app can compile - but how can it
kick-start the build for MY_LIB so that the library is guaranteed to
exist ready to be linked? I don't want to use an external script as I'd
have to have one for each platform - going against the point of cmake,
surely?<br>
  <br>
Thanks again for your help so far,<br>
  <br>
David<br>
  <br>
  <div class="gmail_quote">On 17 June 2011 10:22, Andreas Naumann <span
 dir="ltr">&lt;<a moz-do-not-send="true"
 href="mailto:Andreas-Naumann@gmx.net">Andreas-Naumann@gmx.net</a>&gt;</span>
wrote:<br>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
    <div bgcolor="#ffffff" text="#000000">
Hi,<br>
    <br>
how should cmake find your MY_LIB-directory?<br>
The simplest way, is to add the directory using
"add_subdirectory(MY_LIB_DIR ...)"<br>
    <br>
If the MY_LIB-build directory is somewhere else, in a completely
different directory, you should think about your project structure.<br>
    <br>
Andreas<br>
    <br>
Am 17.06.2011 11:06, schrieb David Springate:
    <blockquote type="cite">Hi,<br>
      <br>
Thanks for the reply - but I think you might have misunderstood my
question.<br>
      <br>
I want to setup CMake so that when I call Cmake like so (for MY_APP):<br>
mkdir build &amp;&amp; cd build<br>
cmake .. -G Xcode<br>
      <br>
that the cmake call will be able to 'know' that it needs MY_LIB, find
where the MY_LIB CMakeLists.txt file is, build it, and then continue
with the cmake call for MY_APP.<br>
      <br>
Any ideas?<br>
      <br>
David<br>
      <br>
      <div class="gmail_quote">On 17 June 2011 08:18, J.S. van
Bethlehem <span dir="ltr">&lt;<a moz-do-not-send="true"
 href="mailto:j.s.van.bethlehem@astro.rug.nl" target="_blank">j.s.van.bethlehem@astro.rug.nl</a>&gt;</span>
wrote:<br>
      <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hej
David,<br>
        <br>
&gt;From your description I think all your build script needs to do is:<br>
        <br>
mkdir build &amp;&amp; cd build<br>
cmake ..<br>
make MY_APP<br>
        <br>
Further, assuming your library also gets build with CMake, you probably
have an add_directory(../MY_LIB ../MY_LIB) in your main lists-file
(otherwise you should) and then the link_directories() command is not
needed. I created sort of a 'standard' machinery for building a list of
'sub-packages' using CMake. It's not well documented and probably still
has many issues, but I could mail it to you if you think it may help
you get started and if you're interested.<br>
        <br>
Greetsz,<br>
Jakob<br>
        <br>
On 06/16/2011 11:54 PM, David Springate wrote:<br>
        <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br>
          <br>
I am new to CMake - and whilst I am immediately impressed with it's
relative ease of use - I have a 'noob' question, I'm sure!<br>
          <br>
I have the following:<br>
A library called MY_LIB that builds with a cmake command (I have
created a nice CMakeLists.txt file)<br>
An application called MY_APP that builds a nice application - and even
links in MY_LIB using:<br>
link_directories("../MY_LIB")<br>
target_link_libraries(MY_APP MY_LIB)<br>
          <br>
Now, first of all I know that I'm not supposed to use relative paths..
but we'll call a side issue.. (though I'd be happy to hear the correct
way of doing things!) - the real problem that I have is this:<br>
          <br>
Give than MY_LIB is built using CMake and MY_APP is built using CMake..
how can I setup my build scripts so that I can call CMake once for
MY_APP, it'll realise that it needs MY_LIB, which hasn't yet been
built, invoke CMake for MY_LIB and then link itself with MY_APP?<br>
          <br>
I ask because I use libraries heavily to organise my code (and reuse)
and would love to switch to CMake for all my building (XCode 4 has
forced my hand!) but I can't seem to figure this out.<br>
          <br>
Please help a newcomer out - any help is greatly appreciated!<br>
          <br>
Thanks,<br>
          <br>
David<br>
        </blockquote>
_______________________________________________<br>
Powered by <a moz-do-not-send="true" href="http://www.kitware.com"
 target="_blank">www.kitware.com</a><br>
        <br>
Visit other Kitware open-source projects at <a moz-do-not-send="true"
 href="http://www.kitware.com/opensource/opensource.html"
 target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
        <br>
Please keep messages on-topic and check the CMake FAQ at: <a
 moz-do-not-send="true" href="http://www.cmake.org/Wiki/CMake_FAQ"
 target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
        <br>
Follow this link to subscribe/unsubscribe:<br>
        <a moz-do-not-send="true"
 href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
      </blockquote>
      </div>
      <br>
      <br clear="all">
      <br>
-- <br>
David Springate<br>
      <a moz-do-not-send="true" href="mailto:david.springate@gmail.com"
 target="_blank">david.springate@gmail.com</a><br>
      <pre><fieldset></fieldset>
_______________________________________________
Powered by <a moz-do-not-send="true" href="http://www.kitware.com"
 target="_blank">www.kitware.com</a>

Visit other Kitware open-source projects at <a moz-do-not-send="true"
 href="http://www.kitware.com/opensource/opensource.html"
 target="_blank">http://www.kitware.com/opensource/opensource.html</a>

Please keep messages on-topic and check the CMake FAQ at: <a
 moz-do-not-send="true" href="http://www.cmake.org/Wiki/CMake_FAQ"
 target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a>

Follow this link to subscribe/unsubscribe:
<a moz-do-not-send="true"
 href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a></pre>
    </blockquote>
    <br>
    </div>
    <br>
_______________________________________________<br>
Powered by <a moz-do-not-send="true" href="http://www.kitware.com"
 target="_blank">www.kitware.com</a><br>
    <br>
Visit other Kitware open-source projects at <a moz-do-not-send="true"
 href="http://www.kitware.com/opensource/opensource.html"
 target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
    <br>
Please keep messages on-topic and check the CMake FAQ at: <a
 moz-do-not-send="true" href="http://www.cmake.org/Wiki/CMake_FAQ"
 target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
    <br>
Follow this link to subscribe/unsubscribe:<br>
    <a moz-do-not-send="true"
 href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
  </blockquote>
  </div>
  <br>
  <br clear="all">
  <br>
-- <br>
David Springate<br>
  <a moz-do-not-send="true" href="mailto:david.springate@gmail.com">david.springate@gmail.com</a><br>
</blockquote>
<br>
</body>
</html>