<p>However, it is well-known technique called Unity Build and has some side, effects both useful (more room for optimizer) and not (always full rebuild). You may google a bit more about it. </p>
<p>On Apr 27, 2011 12:01 AM, &quot;Alexander Neundorf&quot; &lt;<a href="mailto:a.neundorf-work@gmx.net">a.neundorf-work@gmx.net</a>&gt; wrote:<br type="attribution">&gt; On Tuesday 26 April 2011, Martin Nielsen wrote:<br>
&gt;&gt; Hi,<br>&gt;&gt;<br>&gt;&gt; I have been asked to look into the possibilities of compiling multiple<br>&gt;&gt; files in one invocation of the compiler like:<br>&gt;&gt;<br>&gt;&gt; armcc.exe ... file1.c file2.c ... fileN.c -o mylib.lib<br>
&gt;&gt;<br>&gt;&gt; The cross compiler we are using requires a license in order to compile the<br>&gt;&gt; file. It is a network floating license mechanism and the majority of the<br>&gt;&gt; time it take to build the code is spent on acquiring the license. Parallel<br>
&gt;&gt; build is sadly not an option either since it just requests multiple<br>&gt;&gt; licenses and we quickly run out.<br>&gt;&gt;<br>&gt;&gt; I was wondering if CMake could be directed to somehow do this? or it would<br>
&gt;&gt; break some dependency between the source files and the generation of the<br>&gt;&gt; library.<br>&gt;&gt;<br>&gt;&gt; I suspect it isn&#39;t possible but would like to confirm this or explore other<br>&gt;&gt; ideas on how to get around this problem.<br>
&gt; <br>&gt; In KDE we have an option KDE4_ENABLE_FINAL.<br>&gt; If this is set to TRUE, then for each binary a cpp-file is generated, which <br>&gt; has #include &quot;file.cpp&quot; statements for each of the original source files, and <br>
&gt; then this one file, which then contains basically the whole source code, is <br>&gt; compiled at once.<br>&gt; <br>&gt; You can search for &quot;enable_final&quot; e.g. here:<br>&gt; <a href="http://websvn.kde.org/branches/KDE/4.5/kdelibs/cmake/modules/KDE4Macros.cmake?revision=1143427&amp;view=markup">http://websvn.kde.org/branches/KDE/4.5/kdelibs/cmake/modules/KDE4Macros.cmake?revision=1143427&amp;view=markup</a><br>
&gt; <br>&gt; This is transparent for the user.<br>&gt; If he uses kde4_add_executable(foo a.cpp b.cpp main.cpp)<br>&gt; and turns the option on, then the all-in-one file is created automatically and <br>&gt; built.<br>&gt; <br>
&gt; Alex<br>&gt; _______________________________________________<br>&gt; Powered by <a href="http://www.kitware.com">www.kitware.com</a><br>&gt; <br>&gt; Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>
&gt; <br>&gt; Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ">http://www.cmake.org/Wiki/CMake_FAQ</a><br>&gt; <br>&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.cmake.org/mailman/listinfo/cmake">http://www.cmake.org/mailman/listinfo/cmake</a><br></p>