<div class="gmail_quote">On Fri, Jul 3, 2009 at 5:02 PM, Miguel A. Figueroa-Villanueva <span dir="ltr">&lt;<a href="mailto:miguelf@ieee.org">miguelf@ieee.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
On Fri, Jul 3, 2009 at 4:33 PM, Robert Dailey wrote:<br>
&gt; On Fri, Jul 3, 2009 at 3:31 PM, Robert Dailey wrote:<br>
&gt;&gt; On Fri, Jul 3, 2009 at 2:54 PM, James Bigler wrote:<br>
&gt;&gt;&gt; On Wed, Jul 1, 2009 at 4:34 PM, Robert Dailey wrote:<br>
[...]<br>
<div class="im">&gt; Interesting, this seems to work:<br>
&gt; project( foo )<br>
&gt; add_library( foo1 STATIC foo1.cpp )<br>
&gt; add_library( foo2 STATIC foo2.cpp )<br>
&gt; add_library( foo3 STATIC foo3.cpp )<br>
&gt; This creates a solution called &quot;foo.sln&quot; and 3 projects: &quot;foo1.vcproj&quot;,<br>
&gt; &quot;foo2.vcproj&quot;, &quot;foo3.vcproj&quot;. Why does this work? I thought for every<br>
&gt; add_library() there must be 1 call to project(). Since I didn&#39;t call<br>
&gt; project() for foo1, foo2, or foo3, I don&#39;t know why it&#39;s letting me create<br>
&gt; those libraries. Can someone explain this behavior?<br>
<br>
</div>There is no place that I have read that indicates that you need more<br>
than one project. In fact, it doesn&#39;t make much sense to me to have<br>
more than one cmake project command per directory.<br>
<br>
I many times use multiple nested project commands so that in IDEs like<br>
MS Visual Studio I get a solution file for each (of course, each is in<br>
different directories). This allows me to load only a small number of<br>
Visual Studio Projects (*.vcproj), which are created per each CMake<br>
target.<br>
<br>
You might be confusing a CMake project with Visual Studio&#39;s notion of<br>
a project which would be created for each target as opposed to each<br>
cmake project instruction.<br>
<br>
Below is the help, which clearly states what the command is for:<br>
<br>
$ cmake --help-command project<br>
cmake version 2.7.20090329<br>
------------------------------------------------------------------------------<br>
SingleItem<br>
<br>
  project<br>
       Set a name for the entire project.<br>
<br>
         project(&lt;projectname&gt; [languageName1 languageName2 ... ] )<br>
<br>
       Sets the name of the project.  Additionally this sets the variables<br>
       &lt;projectName&gt;_BINARY_DIR and &lt;projectName&gt;_SOURCE_DIR to the<br>
       respective values.<br>
<br>
       Optionally you can specify which languages your project supports.<br>
       Example languages are CXX (i.e.  C++), C, Fortran, etc.  By default C<br>
       and CXX are enabled.  E.g.  if you do not have a C++ compiler, you can<br>
       disable the check for it by explicitely listing the languages you want<br>
       to support, e.g.  C.  By using the special language &quot;NONE&quot; all checks<br>
       for any language can be disabled.</blockquote><div><br></div><div>I&#39;ve read this and I clearly understand it. However, this all comes down to a misunderstanding. To me, a project() in CMake has always represented a configuration set. For example, once I call project( foo ), I&#39;ve now told CMake that I plan to create a new build configuration called &quot;foo&quot;, which allows me to set project properties, apply source files, and other things. However now that I think about it, you only set these things after add_library() has been called.</div>
<div><br></div><div>Again, this is all just a misunderstanding on my part. It was a bit misleading. What purpose does project() serve on other generators, like XCode or Makefile? I&#39;d test these myself if I had those platforms available. I think the thing that would help me understand this to the fullest is how project() affects the output of other generators.</div>
</div>