Why would add_custom_command call the C++ compiler?<br><br>add_custom_command will add a build rule that runs whatever command you tell it to run. You also have to tell it what the OUTPUT is (full path to a file) and what the DEPENDS (also full paths to files) are...<br>
<br>It doesn&#39;t do anything with the C++ compiler unless you tell it to....<br><br>If you are going to run &quot;make&quot; from a custom command, then the OUTPUT might be a *.lib, *.dll or *.exe file that you expect to be there after a successful make... And the DEPENDS would be the makefile and anything else that you would want to cause a rebuild if it changed...<br>
<br>Does that make sense?<br><br>There are examples of add_custom_command on the CMake wiki and in the CMake Tests directory. Check those out, too.<br><br><br>HTH,<br>David<br><br><br><div class="gmail_quote">On Sat, Dec 12, 2009 at 7:26 AM, Mark Jones <span dir="ltr">&lt;<a href="mailto:mark.jones1112@gmail.com">mark.jones1112@gmail.com</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;">Hi David,<br>
<br>
The documentation for add_custom_command seems to imply that it will
only add a build command and not replace a build command.  The way that I
interpret this is that cmake will generate a vcproj that executes my
custom build command (gmake) that I add using add_custom_command but will also attempt to build the project
in the normal Visual Studio fashion by calling the C++ compiler
(CL.exe) directly.<br>
<br>
Am I misreading it?<br><font color="#888888">
<br>
Mark</font><div><div></div><div class="h5"><br>
<br><br><div class="gmail_quote">On Fri, Dec 11, 2009 at 10:14 AM, David Cole <span dir="ltr">&lt;<a href="mailto:david.cole@kitware.com" target="_blank">david.cole@kitware.com</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;">

You can do what you want with add_custom_command and add_custom_target. Have you read about those CMake commands...?<br><br><div><a href="http://cmake.org/cmake/help/cmake-2-8-docs.html#command:add_custom_command" target="_blank">http://cmake.org/cmake/help/cmake-2-8-docs.html#command:add_custom_command</a></div>


<div><a href="http://cmake.org/cmake/help/cmake-2-8-docs.html#command:add_custom_target" target="_blank">http://cmake.org/cmake/help/cmake-2-8-docs.html#command:add_custom_target</a><br><div><br></div><div><br></div><div>

HTH,</div><div>David</div>
<div><br></div><div><br><div class="gmail_quote"><div><div></div><div>On Fri, Dec 11, 2009 at 9:17 AM, Mark Jones <span dir="ltr">&lt;<a href="mailto:mark.jones1112@gmail.com" target="_blank">mark.jones1112@gmail.com</a>&gt;</span> wrote:<br>

</div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div>
If I have a build system in place (that uses gmake) that I am already comfortable with and would just like to use cmake to create Visual Studio (or XCode) projects that simply have release and debug targets that call gmake for me, can I do that with cmake?  Or, does cmake always generate a makefile too that is used by the projects that it creates?<br>



<br>In other words, I want cmake to generate something like the following in the vcproj file:<br><br>    &lt;Configurations&gt;<br>        &lt;Configuration<br>            Name=&quot;debug|Win32&quot;<br>            OutputDirectory=&quot;log&quot;<br>



            IntermediateDirectory=&quot;log&quot;<br>            ConfigurationType=&quot;0&quot;<br>            &gt;<br>            &lt;Tool<br>                Name=&quot;VCNMakeTool&quot;<br>                BuildCommandLine=&quot;gmake DEBUG=1 build&quot;<br>



                ReBuildCommandLine=&quot;gmake DEBUG=1 rebuild&quot;<br>                CleanCommandLine=&quot;gmake DEBUG=1 clean&quot;<br>                Output=&quot;&quot;<br>                PreprocessorDefinitions=&quot;_DEBUG;DEBUG&quot;<br>



[snip]<br>            /&gt;<br>        &lt;/Configuration&gt;<br><br>and I don&#39;t want it to write out any makefile at all as I want gmake to use the makefile that I already have in place.<br><br>Also, I&#39;d like to do the same kind of thing with XCode project generation and I&#39;d like to know if that is possible too.<br>



<br>If it always generates a makefile too, I imagine a workaround would be to let cmake create the vcproj file that builds using the cmake generated makefile, but then tell cmake to generate the makefile so that it then calls gmake on my already existing makefile, but that is not ideal since it would be an unnecessary step in the build process.<br>



<br>Thanks,<br><font color="#888888">Mark<br><br>
</font><br></div></div><div>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a 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 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 href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></div></blockquote></div><br></div></div>
</blockquote></div><br>
</div></div></blockquote></div><br>